diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7414bb3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,68 @@ +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..f13fa33 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ef004d1 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..6437d0c --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/task2.iml b/.idea/task2.iml new file mode 100644 index 0000000..0b872d8 --- /dev/null +++ b/.idea/task2.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..9661ac7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..c61b94b --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + main + ar + art + id + ma + text_button + link + cancel + text_left + cancel_ + button + chec + let + lett + deleteLetter + letter_h + hidden + + + text_letter + letter[i] + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
Переслать
+
Удалить
+
Это спам!
+
Прочитано
+
+
+
+ +
yaicon
+
ЯндексПаспорт
+
+
Доступ к аккаунту восстановлён
+
6 авг
+
+
+
+ +
yaicon
+
ЯндексПаспорт
+
+
Доступ к аккаунту восстановлён
+
6 авг
+
+
+
+ +
yaicon
+
ЯндексПаспорт
+
+
Доступ к аккаунту восстановлён
+
6 авг
+
+
+
+ +
yaicon
+
ЯндексПаспорт
+
+
Доступ к аккаунту восстановлён
+
6 авг
+
+
+
+ +
yaicon
+
ЯндексПаспорт
+
+
Доступ к аккаунту восстановлён
+
6 авг
+
+
+
+ +
+
+ + + diff --git a/node_modules/@bem/sdk.entity-name/CHANGELOG.md b/node_modules/@bem/sdk.entity-name/CHANGELOG.md new file mode 100644 index 0000000..f472bb0 --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/CHANGELOG.md @@ -0,0 +1,189 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.2.11](https://github.com/bem/bem-sdk/compare/@bem/sdk.entity-name@0.2.10...@bem/sdk.entity-name@0.2.11) (2019-02-03) + +**Note:** Version bump only for package @bem/sdk.entity-name + + + + + + +## [0.2.10](https://github.com/bem/bem-sdk/compare/@bem/sdk.entity-name@0.2.9...@bem/sdk.entity-name@0.2.10) (2018-07-16) + + + + +**Note:** Version bump only for package @bem/sdk.entity-name + + +## [0.2.9](https://github.com/bem/bem-sdk/compare/@bem/sdk.entity-name@0.2.6...@bem/sdk.entity-name@0.2.9) (2018-07-01) + + +### Bug Fixes + +* **entity-name:** fix typo in typings ([37ca24c](https://github.com/bem/bem-sdk/commit/37ca24c)) +* **entity-name:** rely on constructor in isBemEntityName ([74224de](https://github.com/bem/bem-sdk/commit/74224de)) + + + + + +## [0.2.6](https://github.com/bem/bem-sdk/compare/@bem/sdk.entity-name@0.2.5...@bem/sdk.entity-name@0.2.6) (2018-04-17) + + + + +**Note:** Version bump only for package @bem/sdk.entity-name + + +## [0.2.5](https://github.com/bem/bem-sdk/compare/@bem/sdk.entity-name@0.2.4...@bem/sdk.entity-name@0.2.5) (2018-04-17) + + +### Bug Fixes + +* **entity-name:** fix typings exports ([df3f3d6](https://github.com/bem/bem-sdk/commit/df3f3d6)) + + + + + +## [0.2.4](https://github.com/bem/bem-sdk/compare/@bem/sdk.entity-name@0.2.3...@bem/sdk.entity-name@0.2.4) (2017-12-16) + + + + +**Note:** Version bump only for package @bem/sdk.entity-name + + +## [0.2.3](https://github.com/bem/bem-sdk/compare/@bem/sdk.entity-name@0.2.2...@bem/sdk.entity-name@0.2.3) (2017-12-12) + + +### Bug Fixes + +* **entity-name:** dont add mod if value is falsy ([62b3453](https://github.com/bem/bem-sdk/commit/62b3453)) + + + + + +## [0.2.2](https://github.com/bem/bem-sdk/compare/@bem/sdk.entity-name@0.2.0...@bem/sdk.entity-name@0.2.2) (2017-11-07) + + + + +**Note:** Version bump only for package @bem/sdk.entity-name + + +## [0.2.1](https://github.com/bem/bem-sdk/compare/@bem/sdk.entity-name@0.2.0...@bem/sdk.entity-name@0.2.1) (2017-10-02) + + + + +**Note:** Version bump only for package @bem/sdk.entity-name + + +# 0.2.0 (2017-10-01) + + +### Bug Fixes + +* renames inside the code ([913b259](https://github.com/bem/bem-sdk/commit/913b259)) +* **entity-name:** normalizing tunings ([7e107af](https://github.com/bem/bem-sdk/commit/7e107af)) +* **entity-name:** Return value must be always boolean ([7bf03b8](https://github.com/bem/bem-sdk/commit/7bf03b8)) + + +### Features + +* split bem-naming to naming.entity.* packages ([0bf481d](https://github.com/bem/bem-sdk/commit/0bf481d)) + + + + + +# 0.1.0 (2017-09-30) + + +### Bug Fixes + +* renames inside the code ([913b259](https://github.com/bem/bem-sdk/commit/913b259)) +* **entity-name:** normalizing tunings ([7e107af](https://github.com/bem/bem-sdk/commit/7e107af)) + + +### Features + +* split bem-naming to naming.entity.* packages ([0bf481d](https://github.com/bem/bem-sdk/commit/0bf481d)) + + + + +Changelog +========= + +1.5.0 (2017-04-20) +------------------ + +* Add [scope](./README.md#scope) field (@blond [#110]). +* Add [belongsTo](./README.md#belongstoentityname) method (@zxqfox @blond [#71], [#99]). +* Support [TypeScript](./README.md#typescript-support) (@blond [#93], [#113]). +* Handy error messages for invalid entities (@Yeti-or @blond [#77], [#95]). +* [Deprecation](./README.md#deprecation) messages for `modName` and `modVal` fields (@blond [#98], [#105]). +* [Serialization](./README.md#serialization) recipe (@blond [#113]). + +[#113]: https://github.com/bem-sdk/bem-entity-name/pull/113 +[#110]: https://github.com/bem-sdk/bem-entity-name/pull/110 +[#105]: https://github.com/bem-sdk/bem-entity-name/pull/105 +[#99]: https://github.com/bem-sdk/bem-entity-name/pull/99 +[#98]: https://github.com/bem-sdk/bem-entity-name/pull/98 +[#95]: https://github.com/bem-sdk/bem-entity-name/pull/95 +[#93]: https://github.com/bem-sdk/bem-entity-name/pull/93 +[#77]: https://github.com/bem-sdk/bem-entity-name/pull/77 +[#71]: https://github.com/bem-sdk/bem-entity-name/pull/71 + +1.4.0 +----- + +* Support string in `BemEntityName.create()` method (@zxqfox [#89]). + +[#89]: https://github.com/bem-sdk/bem-entity-name/pull/89 + +1.3.2 +----- + +* Update `@bem/naming` to `2.x` (@blond [#84]). + +[#84]: https://github.com/bem-sdk/bem-entity-name/pull/84 + +1.3.1 +----- + +* Improve `isSimpleMod` method (@yeti-or [#82]). +Now it returns `null` for entities without modifier. + +[#82]: https://github.com/bem-sdk/bem-entity-name/pull/82 + +1.3.0 +----- + +* Added `isSimpleMod` method (@yeti-or [#79]). + +[#79]: https://github.com/bem-sdk/bem-entity-name/pull/79 + +1.2.0 +----- + +* Added `create` method (@zxqfox [#72]). +* Added `toJSON` method (@zxqfox [#66]). + +[#72]: https://github.com/bem-sdk/bem-entity-name/pull/72 +[#66]: https://github.com/bem-sdk/bem-entity-name/pull/66 + +1.1.0 +----- + +* Added `isBemEntityName` method ([#65]). + +[#65]: https://github.com/bem-sdk/bem-entity-name/pull/65 diff --git a/node_modules/@bem/sdk.entity-name/LICENSE.txt b/node_modules/@bem/sdk.entity-name/LICENSE.txt new file mode 100644 index 0000000..d9dee19 --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/LICENSE.txt @@ -0,0 +1,369 @@ +© YANDEX LLC, 2016-present + +The Source Code called `@bem/sdk.entity-name` available at https://github.com/bem/bem-sdk/tree/master/packages/entity-name is subject to the terms of the Mozilla Public License, v. 2.0 (hereinafter - MPL). The text of MPL is the following: + +Mozilla Public License, version 2.0 + +1. Definitions + +1.1. "Contributor" + + means each individual or legal entity that creates, contributes to the + creation of, or owns Covered Software. + +1.2. "Contributor Version" + + means the combination of the Contributions of others (if any) used by a + Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + + means Source Code Form to which the initial Contributor has attached the + notice in Exhibit A, the Executable Form of such Source Code Form, and + Modifications of such Source Code Form, in each case including portions + thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + a. that the initial Contributor has attached the notice described in + Exhibit B to the Covered Software; or + + b. that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the terms of + a Secondary License. + +1.6. "Executable Form" + + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + + means a work that combines Covered Software with other material, in a + separate file or files, that is not Covered Software. + +1.8. "License" + + means this document. + +1.9. "Licensable" + + means having the right to grant, to the maximum extent possible, whether + at the time of the initial grant or subsequently, any and all of the + rights conveyed by this License. + +1.10. "Modifications" + + means any of the following: + + a. any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered Software; or + + b. any new file in Source Code Form that contains any Covered Software. + +1.11. "Patent Claims" of a Contributor + + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the License, + by the making, using, selling, offering for sale, having made, import, + or transfer of either its Contributions or its Contributor Version. + +1.12. "Secondary License" + + means either the GNU General Public License, Version 2.0, the GNU Lesser + General Public License, Version 2.1, the GNU Affero General Public + License, Version 3.0, or any later versions of those licenses. + +1.13. "Source Code Form" + + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that controls, is + controlled by, or is under common control with You. For purposes of this + definition, "control" means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by contract or + otherwise, or (b) ownership of more than fifty percent (50%) of the + outstanding shares or beneficial ownership of such entity. + + +2. License Grants and Conditions + +2.1. Grants + + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + a. under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + + b. under Patent Claims of such Contributor to make, use, sell, offer for + sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + + The licenses granted in Section 2.1 with respect to any Contribution + become effective for each Contribution on the date the Contributor first + distributes such Contribution. + +2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under + this License. No additional rights or licenses will be implied from the + distribution or licensing of Covered Software under this License. + Notwithstanding Section 2.1(b) above, no patent license is granted by a + Contributor: + + a. for any code that a Contributor has removed from Covered Software; or + + b. for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + c. under Patent Claims infringed by Covered Software in the absence of + its Contributions. + + This License does not grant any rights in the trademarks, service marks, + or logos of any Contributor (except as may be necessary to comply with + the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this + License (see Section 10.2) or under the terms of a Secondary License (if + permitted under the terms of Section 3.3). + +2.5. Representation + + Each Contributor represents that the Contributor believes its + Contributions are its original creation(s) or it has sufficient rights to + grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + + This License is not intended to limit any rights You have under + applicable copyright doctrines of fair use, fair dealing, or other + equivalents. + +2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in + Section 2.1. + + +3. Responsibilities + +3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under + the terms of this License. You must inform recipients that the Source + Code Form of the Covered Software is governed by the terms of this + License, and how they can obtain a copy of this License. You may not + attempt to alter or restrict the recipients' rights in the Source Code + Form. + +3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + a. such Covered Software must also be made available in Source Code Form, + as described in Section 3.1, and You must inform recipients of the + Executable Form how they can obtain a copy of such Source Code Form by + reasonable means in a timely manner, at a charge no more than the cost + of distribution to the recipient; and + + b. You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter the + recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for + the Covered Software. If the Larger Work is a combination of Covered + Software with a work governed by one or more Secondary Licenses, and the + Covered Software is not Incompatible With Secondary Licenses, this + License permits You to additionally distribute such Covered Software + under the terms of such Secondary License(s), so that the recipient of + the Larger Work may, at their option, further distribute the Covered + Software under the terms of either this License or such Secondary + License(s). + +3.4. Notices + + You may not remove or alter the substance of any license notices + (including copyright notices, patent notices, disclaimers of warranty, or + limitations of liability) contained within the Source Code Form of the + Covered Software, except that You may alter any license notices to the + extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on + behalf of any Contributor. You must make it absolutely clear that any + such warranty, support, indemnity, or liability obligation is offered by + You alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + + If it is impossible for You to comply with any of the terms of this License + with respect to some or all of the Covered Software due to statute, + judicial order, or regulation then You must: (a) comply with the terms of + this License to the maximum extent possible; and (b) describe the + limitations and the code they affect. Such description must be placed in a + text file included with all distributions of the Covered Software under + this License. Except to the extent prohibited by statute or regulation, + such description must be sufficiently detailed for a recipient of ordinary + skill to be able to understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically if You + fail to comply with any of its terms. However, if You become compliant, + then the rights granted under this License from a particular Contributor + are reinstated (a) provisionally, unless and until such Contributor + explicitly and finally terminates Your grants, and (b) on an ongoing + basis, if such Contributor fails to notify You of the non-compliance by + some reasonable means prior to 60 days after You have come back into + compliance. Moreover, Your grants from a particular Contributor are + reinstated on an ongoing basis if such Contributor notifies You of the + non-compliance by some reasonable means, this is the first time You have + received notice of non-compliance with this License from such + Contributor, and You become compliant prior to 30 days after Your receipt + of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, + counter-claims, and cross-claims) alleging that a Contributor Version + directly or indirectly infringes any patent, then the rights granted to + You by any and all Contributors for the Covered Software under Section + 2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user + license agreements (excluding distributors and resellers) which have been + validly granted by You or Your distributors under this License prior to + termination shall survive termination. + +6. Disclaimer of Warranty + + Covered Software is provided under this License on an "as is" basis, + without warranty of any kind, either expressed, implied, or statutory, + including, without limitation, warranties that the Covered Software is free + of defects, merchantable, fit for a particular purpose or non-infringing. + The entire risk as to the quality and performance of the Covered Software + is with You. Should any Covered Software prove defective in any respect, + You (not any Contributor) assume the cost of any necessary servicing, + repair, or correction. This disclaimer of warranty constitutes an essential + part of this License. No use of any Covered Software is authorized under + this License except under this disclaimer. + +7. Limitation of Liability + + Under no circumstances and under no legal theory, whether tort (including + negligence), contract, or otherwise, shall any Contributor, or anyone who + distributes Covered Software as permitted above, be liable to You for any + direct, indirect, special, incidental, or consequential damages of any + character including, without limitation, damages for lost profits, loss of + goodwill, work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses, even if such party shall have been + informed of the possibility of such damages. This limitation of liability + shall not apply to liability for death or personal injury resulting from + such party's negligence to the extent applicable law prohibits such + limitation. Some jurisdictions do not allow the exclusion or limitation of + incidental or consequential damages, so this exclusion and limitation may + not apply to You. + +8. Litigation + + Any litigation relating to this License may be brought only in the courts + of a jurisdiction where the defendant maintains its principal place of + business and such litigation shall be governed by laws of that + jurisdiction, without reference to its conflict-of-law provisions. Nothing + in this Section shall prevent a party's ability to bring cross-claims or + counter-claims. + +9. Miscellaneous + + This License represents the complete agreement concerning the subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. Any law or regulation which provides that + the language of a contract shall be construed against the drafter shall not + be used to construe this License against a Contributor. + + +10. Versions of the License + +10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + +10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version + of the License under which You originally received the Covered Software, + or under the terms of any subsequent version published by the license + steward. + +10.3. Modified Versions + + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a + modified version of this License if you rename the license and remove + any references to the name of the license steward (except to note that + such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary + Licenses If You choose to distribute Source Code Form that is + Incompatible With Secondary Licenses under the terms of this version of + the License, the notice described in Exhibit B of this License must be + attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the + terms of the Mozilla Public License, v. + 2.0. If a copy of the MPL was not + distributed with this file, You can + obtain one at + http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, +then You may include the notice in a location (such as a LICENSE file in a +relevant directory) where a recipient would be likely to look for such a +notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice + + This Source Code Form is "Incompatible + With Secondary Licenses", as defined by + the Mozilla Public License, v. 2.0. + + +A copy of the MPL is also available at http://mozilla.org/MPL/2.0/. diff --git a/node_modules/@bem/sdk.entity-name/README.md b/node_modules/@bem/sdk.entity-name/README.md new file mode 100644 index 0000000..7754d66 --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/README.md @@ -0,0 +1,430 @@ +# BemEntityName + +[BEM entity](https://en.bem.info/methodology/key-concepts/#bem-entity) name representation. + +[![NPM Status][npm-img]][npm] + +[npm]: https://www.npmjs.org/package/@bem/sdk.entity-name +[npm-img]: https://img.shields.io/npm/v/@bem/sdk.entity-name.svg + +Contents +-------- + +* [Install](#install) +* [Usage](#usage) +* [API](#api) +* [Serialization](#serialization) +* [TypeScript support](#typescript-support) +* [Debuggability](#debuggability) +* [Deprecation](#deprecation) + +Install +------- + +```sh +$ npm install --save @bem/sdk.entity-name +``` + +Usage +----- + +```js +const BemEntityName = require('@bem/sdk.entity-name'); + +const entityName = new BemEntityName({ block: 'button', elem: 'text' }); + +entityName.block; // button +entityName.elem; // text +entityName.mod; // undefined + +entityName.id; // button__elem +entityName.type; // elem + +entityName.isEqual(new BemEntityName({ block: 'button' })); // false +entityName.isEqual(new BemEntityName({ block: 'button', elem: 'text' })); // true +``` + +API +--- + +* [constructor({ block, elem, mod })](#constructor-block-elem-mod-) +* [block](#block) +* [elem](#elem) +* [mod](#mod) +* [type](#type) +* [scope](#scope) +* [id](#id) +* [isSimpleMod()](#issimplemod) +* [isEqual(entityName)](#isequalentityname) +* [belongsTo(entityName)](#belongstoentityname) +* [valueOf()](#valueof) +* [toJSON()](#tojson) +* [toString()](#tostring) +* [static create(obj)](#static-createobj) +* [static isBemEntityName(entityName)](#static-isbementitynameentityname) + +### constructor({ block, elem, mod }) + +Parameter | Type | Description +----------|----------|------------------------------ +`block` | `string` | The block name of entity. +`elem` | `string` | The element name of entity. +`mod` | `string`, `object` | The modifier of entity.

If specified value is `string` then it will be equivalent to `{ name: string, val: true }`. Optional. +`mod.name`| `string` | The modifier name of entity. +`mod.val` | `string`, `true` | The modifier value of entity. Optional. + +BEM entities can be defined with a help of JS object with the following fields: + +* `block` — a block name. The field is required because only a block exists as an independent BEM entity +* `elem` — an element name. +* `mod` — a modifier. + +The modifier consists of a pair of fields `mod.name` and `mod.val`. This means that the field `mod.val` without `mod.name` has no meaning. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); + +// The modifier of block +new BemEntityName({ + block: 'button', + mod: { name: 'view', val: 'action' } +}); + +// Not valid modifier +new BemEntityName({ + block: 'button', + mod: { val: 'action' } +}); +// ➜ EntityTypeError: the object `{ block: 'block', mod: { val: 'action' } }` is not valid BEM entity, the field `mod.name` is undefined +``` + +To describe a simple modifier the `mod.val` field must be omitted. + +```js +// Simple modifier of a block +new BemEntityName({ block: 'button', mod: 'focused' }); + +// Is equivalent to simple modifier, if `mod.val` is `true` +new BemEntityName({ + block: 'button', + mod: { name: 'focused', val: true } +}); +``` + +### block + +The name of block to which this entity belongs. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); +const name = new BemEntityName({ block: 'button' }); + +name.block; // button +``` + +### elem + +The element name of this entity. + +If entity is not element or modifier of element then returns empty string. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); +const name = new BemEntityName({ block: 'button', elem: 'text' }); + +name.elem; // text +``` + +### mod + +The modifier of this entity. + +**Important:** If entity is not a modifier then returns `undefined`. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); + +const blockName = new BemEntityName({ block: 'button' }); +const modName = new BemEntityName({ block: 'button', mod: 'disabled' }); + +modName.mod; // { name: 'disabled', val: true } +blockName.mod; // undefined +``` + +### type + +The type for this entity. + +Possible values: `block`, `elem`, `blockMod`, `elemMod`. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); + +const elemName = new BemEntityName({ block: 'button', elem: 'text' }); +const modName = new BemEntityName({ block: 'menu', elem: 'item', mod: 'current' }); + +elemName.type; // elem +modName.type; // elemMod +``` + +### scope + +The scope of this entity. + +**Important:** block-typed entities has no scope. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); + +const buttonName = new BemEntityName({ block: 'button' }); +const buttonTextName = new BemEntityName({ block: 'button', elem: 'text' }); +const buttonTextBoldName = new BemEntityName({ block: 'button', elem: 'text', mod: 'bold' }); + +buttonName.scope; // null +buttonTextName.scope; // BemEntityName { block: 'button' } +buttonTextBoldName.scope; // BemEntityName { block: 'button', elem: 'elem' } +``` + +### id + +The id for this entity. + +**Important:** should only be used to determine uniqueness of entity. + +If you want to get string representation in accordance with the provisions naming convention you should use [@bem/naming](https://github.com/bem/bem-sdk/tree/master/packages/naming) package. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); +const name = new BemEntityName({ block: 'button', mod: 'disabled' }); + +name.id; // button_disabled +``` + +### isSimpleMod() + +Determines whether modifier simple or not. + +**NOTE**: For entity without modifier `isSimpleMod()` returns `null`. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); +const modName = new BemEntityName({ block: 'button', mod: { name: 'theme' } }); +const modVal = new BemEntityName({ block: 'button', mod: { name: 'theme', val: 'normal' } }); +const block = new BemEntityName({ block: 'button' }); + +modName.isSimpleMod(); // true +modVal.isSimpleMod(); // false +block.isSimpleMod(); // null +``` + +### isEqual(entityName) + +Parameter | Type | Description +-------------|-----------------|----------------------- +`entityName` | `BemEntityName` | The entity to compare. + +Determines whether specified entity is the deepEqual entity. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); + +const inputName = new BemEntityName({ block: 'input' }); +const buttonName = new BemEntityName({ block: 'button' }); + +inputName.isEqual(buttonName); // false +buttonName.isEqual(buttonName); // true +``` + +### belongsTo(entityName) + +Parameter | Type | Description +-------------|-----------------|----------------------- +`entityName` | `BemEntityName` | The entity to compare. + +Determines whether specified entity belongs to this. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); + +const buttonName = new BemEntityName({ block: 'button' }); +const buttonTextName = new BemEntityName({ block: 'button', elem: 'text' }); +const buttonTextBoldName = new BemEntityName({ block: 'button', elem: 'text', mod: 'bold' }); + +buttonTextName.belongsTo(buttonName); // true +buttonName.belongsTo(buttonTextName); // false +buttonTextBoldName.belongsTo(buttonTextName); // true +buttonTextBoldName.belongsTo(buttonName); // false +``` + +### valueOf() + +Returns normalized object representing the entity name. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); +const name = new BemEntityName({ block: 'button', mod: 'focused' }); + +name.valueOf(); + +// ➜ { block: 'button', mod: { name: 'focused', value: true } } +``` + +### toJSON() + +Returns raw data for `JSON.stringify()` purposes. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); + +const name = new BemEntityName({ block: 'input', mod: 'available' }); + +JSON.stringify(name); // {"block":"input","mod":{"name":"available","val":true}} +``` + +### toString() + +Returns string representing the entity name. + +**Important:** if you want to get string representation in accordance with the provisions naming convention +you should use [@bem/naming](https://github.com/bem/bem-sdk/tree/master/packages/naming) package. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); +const name = new BemEntityName({ block: 'button', mod: 'focused' }); + +name.toString(); // button_focused +``` + +### static create(object) + +Creates BemEntityName instance by any object representation or a string. + +Helper for sugar-free simplicity. + +Parameter | Type | Description +-------------|--------------------|-------------------------- +`object` | `object`, `string` | Representation of entity name. + +Passed Object could have the common field names for entities: + +Object field | Type | Description +-------------|----------|------------------------------ +`block` | `string` | The block name of entity. +`elem` | `string` | The element name of entity. Optional. +`mod` | `string`, `object` | The modifier of entity.

If specified value is `string` then it will be equivalent to `{ name: string, val: true }`. Optional. +`val` | `string` | The modifier value of entity. Used if `mod` is a string. Optional. +`mod.name` | `string` | The modifier name of entity. Optional. +`mod.val` | `string`, `true` | The modifier value of entity. Optional. +`modName` | `string` | The modifier name of entity. Used if `mod.name` was not specified. Optional. +`modVal` | `string`, `true` | The modifier value of entity. Used if neither `mod.val` nor `val` were not specified. Optional. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); + +BemEntityName.create('my-button'); +BemEntityName.create({ block: 'my-button' }); +// ➜ BemEntityName { block: 'my-button' } + +BemEntityName.create({ block: 'my-button', mod: 'theme', val: 'red' }); +BemEntityName.create({ block: 'my-button', modName: 'theme', modVal: 'red' }); +// ➜ BemEntityName { block: 'my-button', mod: { name: 'theme', val: 'red' } } + +BemEntityName.create({ block: 'my-button', mod: 'focused' }); +// ➜ BemEntityName { block: 'my-button', mod: { name: 'focused', val: true } } +``` + +### static isBemEntityName(entityName) + +Determines whether specified entity is an instance of BemEntityName. + +Parameter | Type | Description +-------------|-----------------|----------------------- +`entityName` | `*` | The entity to check. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); + +const entityName = new BemEntityName({ block: 'input' }); + +BemEntityName.isBemEntityName(entityName); // true +BemEntityName.isBemEntityName({ block: 'button' }); // false +``` + +Serialization +------------- + +The `BemEntityName` has `toJSON` method to support `JSON.stringify()` behaviour. + +Use `JSON.stringify` to serialize an instance of `BemEntityName`. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); + +const name = new BemEntityName({ block: 'input', mod: 'available' }); + +JSON.stringify(name); // {"block":"input","mod":{"name":"available","val":true}} +``` + +Use `JSON.parse` to deserialize JSON string and create an instance of `BemEntityName`. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); + +const str = '{"block":"input","mod":{"name":"available","val":true}}'; + +new BemEntityName(JSON.parse(str)); // BemEntityName({ block: 'input', mod: 'available' }); +``` + +TypeScript support +------------------ + +The package includes [typings](./index.d.ts) for TypeScript. You have to set up transpilation yourself. When you set `module` to `commonjs` in your `tsconfig.json` file, TypeScript will automatically find the type definitions for `@bem/sdk.entity-name`. + +The interfaces are provided in global namespace `BEMSDK.EntityName`. It is necessary to use interfaces in JsDoc. + +Debuggability +------------- + +In Node.js, `console.log()` calls `util.inspect()` on each argument without a formatting placeholder. + +`BemEntityName` has `inspect()` method to get custom string representation of the object. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); + +const name = new BemEntityName({ block: 'input', mod: 'available' }); + +console.log(name); + +// ➜ BemEntityName { block: 'input', mod: { name: 'available' } } +``` + +You can also convert `BemEntityName` object to `string`. + +```js +const BemEntityName = require('@bem/sdk.entity-name'); + +const name = new BemEntityName({ block: 'input', mod: 'available' }); + +console.log(`name: ${name}`); + +// ➜ name: input_available +``` + +Deprecation +----------- + +Deprecation is performed with [depd](https://github.com/dougwilson/nodejs-depd). + +To silencing deprecation warnings from being output use the `NO_DEPRECATION` environment variable. + +``` +NO_DEPRECATION=@bem/sdk.entity-name node app.js +``` + +> More [details](https://github.com/dougwilson/nodejs-depd#processenvno_deprecation) in `depd` documentation + +License +------- + +Code and documentation © 2016 YANDEX LLC. Code released under the [Mozilla Public License 2.0](LICENSE.txt). diff --git a/node_modules/@bem/sdk.entity-name/index.d.ts b/node_modules/@bem/sdk.entity-name/index.d.ts new file mode 100644 index 0000000..0de6794 --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/index.d.ts @@ -0,0 +1,117 @@ +declare module '@bem/sdk.entity-name' { + export default class BemEntityName { + constructor(obj: EntityName.IOptions); + + readonly block: EntityName.BlockName; + readonly elem: EntityName.ElementName | undefined; + readonly mod: EntityName.IModifier | undefined; + readonly modName: EntityName.ModifierName | undefined; + readonly modVal: EntityName.ModifierValue | undefined; + readonly type: EntityName.Type; + readonly scope: BemEntityName | null; + readonly id: EntityName.Id; + + isSimpleMod(): boolean | null; + isEqual(entityName: BemEntityName): boolean; + belongsTo(entityName: BemEntityName): boolean; + valueOf(): EntityName.IRepresentation; + toJSON(): EntityName.IRepresentation; + toString(): string; + inspect(depth: number, options: object): string; + + static create(obj: EntityName.ICreateOptions | string): BemEntityName; + static isBemEntityName(entityName: any): boolean; + } + + export namespace EntityName { + /** + * Types of BEM entities. + */ + export type Type = 'block' | 'blockMod' | 'elem' | 'elemMod'; + export type BlockName = string; + export type ElementName = string; + export type ModifierName = string; + export type ModifierValue = string | boolean; + export type Id = string; + + /** + * Abstract object to represent entity name + */ + interface IAbstractRepresentation { + /** + * The block name of entity. + */ + block: BlockName; + /** + * The element name of entity. + */ + elem?: ElementName; + mod?: any; + } + + /** + * Object to represent modifier of entity name. + */ + export interface IModifier { + /** + * The modifier name of entity. + */ + name: ModifierName; + /** + * The modifier value of entity. + */ + val: ModifierValue; + } + + /** + * Strict object to represent entity name. + */ + export interface IRepresentation extends IAbstractRepresentation { + /** + * The modifier of entity. + */ + mod?: IModifier; + } + + /** + * Object to create representation of entity name. + */ + export interface IOptions extends IAbstractRepresentation { + /** + * The modifier of entity. + */ + mod?: ModifierName | { + /** + * The modifier name of entity. + */ + name: ModifierName; + /** + * The modifier value of entity. + */ + val?: ModifierValue; + }; + /** + * The modifier name of entity. Used if `mod.name` wasn't specified. + * @deprecated use `mod.name` instead. + */ + modName?: ModifierName; + /** + * The modifier value of entity. Used if neither `mod.val` nor `val` were not specified. + * @deprecated use `mod.name` instead. + */ + modVal?: ModifierValue; + } + + /** + * Object to create representation of entity name with `create` method. + * + * Contains old field: `val`, `modName` and `modVal. + */ + export interface ICreateOptions extends IOptions { + /** + * The modifier value of entity. Used if neither `mod.val` were not specified. + */ + val?: ModifierValue; + } + } +} diff --git a/node_modules/@bem/sdk.entity-name/index.js b/node_modules/@bem/sdk.entity-name/index.js new file mode 100644 index 0000000..f3d1a28 --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/entity-name'); diff --git a/node_modules/@bem/sdk.entity-name/lib/deprecate.js b/node_modules/@bem/sdk.entity-name/lib/deprecate.js new file mode 100644 index 0000000..811de91 --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/lib/deprecate.js @@ -0,0 +1,22 @@ +'use strict'; + +const util = require('util'); + +const deprecate = require('depd')('@bem/sdk.entity-name'); + +/** + * Logs deprecation messages. + * + * @param {object} obj + * @param {string} deprecateName + * @param {string} newName + */ +module.exports = (obj, deprecateName, newName) => { + const objStr = util.inspect(obj, { depth: 1 }); + const message = [ + `\`${deprecateName}\` is kept just for compatibility and can be dropped in the future.`, + `Use \`${newName}\` instead in \`${objStr}\` at` + ].join(' '); + + deprecate(message); +}; diff --git a/node_modules/@bem/sdk.entity-name/lib/entity-name.js b/node_modules/@bem/sdk.entity-name/lib/entity-name.js new file mode 100644 index 0000000..0e5a43b --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/lib/entity-name.js @@ -0,0 +1,446 @@ +'use strict'; + +const util = require('util'); + +const originNaming = require('@bem/sdk.naming.presets/origin'); +const stringifyEntity = require('@bem/sdk.naming.entity.stringify')(originNaming); + +const deprecate = require('./deprecate'); +const EntityTypeError = require('./entity-type-error'); + +/** + * Enum for types of BEM entities. + * + * @readonly + * @enum {string} + */ +const TYPES = { + BLOCK: 'block', + BLOCK_MOD: 'blockMod', + ELEM: 'elem', + ELEM_MOD: 'elemMod' +}; + +class BemEntityName { + /** + * @param {BEMSDK.EntityName.Options} obj — representation of entity name. + */ + constructor(obj) { + if (!obj.block) { + throw new EntityTypeError(obj, 'the field `block` is undefined'); + } + + if (obj instanceof BemEntityName) { + return obj; + } + + const isBemEntityName = obj.__isBemEntityName__; + + if (!isBemEntityName) { + obj.modName && deprecate(obj, 'modName', 'mod.name'); + obj.modVal && deprecate(obj, 'modVal', 'mod.val'); + } + + const data = this._data = { block: obj.block }; + + obj.elem && (data.elem = obj.elem); + + const modObj = obj.mod; + const modName = (typeof modObj === 'string' ? modObj : modObj && modObj.name) || + !isBemEntityName && obj.modName; + const hasModVal = modObj && modObj.hasOwnProperty('val') || obj.hasOwnProperty('modVal'); + + if (modName) { + const normalizeValue = v => v === 0 ? '0' : v; + const val = hasModVal ? modObj && normalizeValue(modObj.val) || normalizeValue(obj.modVal) : true; + val && (data.mod = { + name: modName, + val + }); + } else if (modObj || hasModVal) { + throw new EntityTypeError(obj, 'the field `mod.name` is undefined'); + } + + this.__isBemEntityName__ = true; + } + + /** + * Returns the name of block to which this entity belongs. + * + * @example + * const BemEntityName = require('@bem/sdk.entity-name'); + * const name = new BemEntityName({ block: 'button' }); + * + * name.block; // button + * + * @returns {BEMSDK.EntityName.BlockName} name of entity block. + */ + get block() { return this._data.block; } + + /** + * Returns the element name of this entity. + * + * If entity is not element or modifier of element then returns empty string. + * + * @example + * const BemEntityName = require('@bem/sdk.entity-name'); + * const name = new BemEntityName({ block: 'button', elem: 'text' }); + * + * name.elem; // text + * + * @returns {?BEMSDK.EntityName.ElementName} - name of entity element. + */ + get elem() { return this._data.elem; } + + /** + * Returns the modifier of this entity. + * + * Important: If entity is not a modifier then returns `undefined`. + * + * @example + * const BemEntityName = require('@bem/sdk.entity-name'); + * + * const blockName = new BemEntityName({ block: 'button' }); + * const modName = new BemEntityName({ block: 'button', mod: 'disabled' }); + * + * modName.mod; // { name: 'disabled', val: true } + * blockName.mod; // undefined + * + * @returns {?BEMSDK.EntityName.Modifier} - entity modifier. + */ + get mod() { return this._data.mod; } + + /** + * Returns the modifier name of this entity. + * + * If entity is not modifier then returns `undefined`. + * + * @returns {?BEMSDK.EntityName.ModifierName} - entity modifier name. + * @deprecated use {@link BemEntityName#mod.name} + */ + get modName() { + deprecate(this, 'modName', 'mod.name'); + + return this.mod && this.mod.name; + } + + /** + * Returns the modifier value of this entity. + * + * If entity is not modifier then returns `undefined`. + * + * @returns {?BEMSDK.EntityName.ModifierValue} - entity modifier name. + * @deprecated use {@link BemEntityName#mod.val} + */ + get modVal() { + deprecate(this, 'modVal', 'mod.val'); + + return this.mod && this.mod.val; + } + + /** + * Returns type for this entity. + * + * @example type of element + * const BemEntityName = require('@bem/sdk.entity-name'); + * const name = new BemEntityName({ block: 'button', elem: 'text' }); + * + * name.type; // elem + * + * @example type of element modifier + * const BemEntityName = require('@bem/sdk.entity-name'); + * const name = new BemEntityName({ block: 'menu', elem: 'item', mod: 'current' }); + * + * name.type; // elemMod + * + * @returns {BEMSDK.EntityName.Type} - type of entity. + */ + get type() { + if (this._type) { return this._type; } + + const data = this._data; + const isMod = data.mod; + + this._type = data.elem + ? isMod ? TYPES.ELEM_MOD : TYPES.ELEM + : isMod ? TYPES.BLOCK_MOD : TYPES.BLOCK; + + return this._type; + } + + /** + * Returns scope of this entity. + * + * Important: block-typed entities has no scope. + * + * @example + * const BemEntityName = require('@bem/sdk.entity-name'); + * + * const buttonName = new BemEntityName({ block: 'button' }); + * const buttonTextName = new BemEntityName({ block: 'button', elem: 'text' }); + * const buttonTextBoldName = new BemEntityName({ block: 'button', elem: 'text', mod: 'bold' }); + * + * buttonName.scope; // null + * buttonTextName.scope; // BemEntityName { block: 'button' } + * buttonTextBoldName.scope; // BemEntityName { block: 'button', elem: 'elem' } + * + * @returns {(BemEntityName|null)} - scope entity name. + */ + get scope() { + if (this.type === TYPES.BLOCK) { return null; } + if (this._scope) { return this._scope; } + + this._scope = new BemEntityName({ + block: this.block, + elem: this.type === TYPES.ELEM_MOD && this.elem + }); + + return this._scope; + } + + /** + * Returns id for this entity. + * + * Important: should only be used to determine uniqueness of entity. + * + * If you want to get string representation in accordance with the provisions naming convention + * you should use `@bem/naming` package. + * + * @example + * const BemEntityName = require('@bem/sdk.entity-name'); + * const name = new BemEntityName({ block: 'button', mod: 'disabled' }); + * + * name.id; // button_disabled + * + * @returns {BEMSDK.EntityName.Id} - id of entity. + */ + get id() { + if (this._id) { return this._id; } + + this._id = stringifyEntity(this._data); + + return this._id; + } + + /** + * Determines whether modifier simple or not + * + * @example simple mod + * const BemEntityName = require('@bem/sdk.entity-name'); + * const name = new BemEntityName({ block: 'button', mod: { name: 'theme' } }); + * + * name.isSimpleMod(); // true + * + * @example mod with value + * const BemEntityName = require('@bem/sdk.entity-name'); + * const name = new BemEntityName({ block: 'button', mod: { name: 'theme', val: 'normal' } }); + * + * name.isSimpleMod(); // false + * + * @example block + * const BemEntityName = require('@bem/sdk.entity-name'); + * const name = new BemEntityName({ block: 'button' }); + * + * name.isSimpleMod(); // null + * + * @returns {(boolean|null)} + */ + isSimpleMod() { + return this.mod ? this.mod.val === true : null; + } + + /** + * Determines whether specified entity is the deepEqual entity. + * + * @example + * const BemEntityName = require('@bem/sdk.entity-name'); + * + * const inputName = new BemEntityName({ block: 'input' }); + * const buttonName = new BemEntityName({ block: 'button' }); + * + * inputName.isEqual(buttonName); // false + * buttonName.isEqual(buttonName); // true + * + * @param {BemEntityName} entityName - the entity to compare. + * @returns {boolean} - A Boolean indicating whether or not specified entity is the deepEqual entity. + */ + isEqual(entityName) { + return entityName && (this.id === entityName.id); + } + + /** + * Determines whether specified entity belongs to this. + * + * @example + * const BemEntityName = require('@bem/sdk.entity-name'); + * + * const buttonName = new BemEntityName({ block: 'button' }); + * const buttonTextName = new BemEntityName({ block: 'button', elem: 'text' }); + * const buttonTextBoldName = new BemEntityName({ block: 'button', elem: 'text', mod: 'bold' }); + * + * buttonTextName.belongsTo(buttonName); // true + * buttonName.belongsTo(buttonTextName); // false + * + * buttonTextBoldName.belongsTo(buttonTextName); // true + * buttonTextBoldName.belongsTo(buttonName); // false + * + * @param {BemEntityName} entityName - the entity to compare. + * + * @returns {boolean} + */ + belongsTo(entityName) { + if (entityName.block !== this.block) { return false; } + + return entityName.type === TYPES.BLOCK && (this.type === TYPES.BLOCK_MOD || this.type === TYPES.ELEM) + || entityName.elem === this.elem && (entityName.type === TYPES.ELEM && this.type === TYPES.ELEM_MOD); + } + + /** + * Returns normalized object representing the entity name. + * + * In some browsers `console.log()` calls `valueOf()` on each argument. + * This method will be called to get custom string representation of the object. + * + * The representation object contains only `block`, `elem` and `mod` fields + * without private and deprecated fields (`modName` and `modVal`). + * + * @example + * const BemEntityName = require('@bem/sdk.entity-name'); + * const name = new BemEntityName({ block: 'button', mod: 'focused' }); + * + * name.valueOf(); + * + * // ➜ { block: 'button', mod: { name: 'focused', value: true } } + * + * @returns {BEMSDK.EntityName.Representation} + */ + valueOf() { return this._data; } + + /** + * Returns raw data for `JSON.stringify()` purposes. + * + * @example + * const BemEntityName = require('@bem/sdk.entity-name'); + * + * const name = new BemEntityName({ block: 'input', mod: 'available' }); + * + * JSON.stringify(name); // {"block":"input","mod":{"name":"available","val":true}} + * + * @returns {BEMSDK.EntityName.Representation} + */ + toJSON() { + return this._data; + } + + /** + * Returns string representing the entity name. + * + * Important: If you want to get string representation in accordance with the provisions naming convention + * you should use `@bem/naming` package. + * + * @example + * const BemEntityName = require('@bem/sdk.entity-name'); + * const name = new BemEntityName({ block: 'button', mod: 'focused' }); + * + * name.toString(); // button_focused + * + * @returns {string} + */ + toString() { return this.id; } + + /** + * Returns object representing the entity name. Is needed for debug in Node.js. + * + * In Node.js, `console.log()` calls `util.inspect()` on each argument without a formatting placeholder. + * This method will be called to get custom string representation of the object. + * + * The representation object contains only `block`, `elem` and `mod` fields + * without private and deprecated fields (`modName` and `modVal`). + * + * @example + * const BemEntityName = require('@bem/sdk.entity-name'); + * const name = new BemEntityName({ block: 'button' }); + * + * console.log(name); // BemEntityName { block: 'button' } + * + * @param {number} depth — tells inspect how many times to recurse while formatting the object. + * @param {object} options — An optional `options` object may be passed + * that alters certain aspects of the formatted string. + * + * @returns {string} + */ + inspect(depth, options) { + const stringRepresentation = util.inspect(this._data, options); + + return `BemEntityName ${stringRepresentation}`; + } + + /** + * Creates BemEntityName instance by any object representation. + * + * @example + * const BemEntityName = require('@bem/sdk.entity-name'); + * + * BemEntityName.create({ block: 'my-button', mod: 'theme', val: 'red' }); + * BemEntityName.create({ block: 'my-button', modName: 'theme', modVal: 'red' }); + * // → BemEntityName { block: 'my-button', mod: { name: 'theme', val: 'red' } } + * + * @param {(BEMSDK.EntityName.CreateOptions|string)} obj — representation of entity name. + * @returns {BemEntityName} An object representing entity name. + */ + static create(obj) { + if (BemEntityName.isBemEntityName(obj)) { + return obj; + } + + if (typeof obj === 'string') { + obj = { block: obj }; + } + + const data = { block: obj.block }; + const mod = obj.mod; + + obj.elem && (data.elem = obj.elem); + + if (mod || obj.modName) { + const isString = typeof mod === 'string'; + const modName = (isString ? mod : mod && mod.name) || obj.modName; + const modObj = !isString && mod || obj; + + data.mod = { + name: modName, + val: modObj.val || modObj.val === 0 ? modObj.val : + obj.modVal || obj.modVal === 0 ? obj.modVal : + true + }; + } + + return new BemEntityName(data); + } + + /** + * Determines whether specified entity is instance of BemEntityName. + * + * @example + * const BemEntityName = require('@bem/sdk.entity-name'); + * + * const entityName = new BemEntityName({ block: 'input' }); + * + * BemEntityName.isBemEntityName(entityName); // true + * BemEntityName.isBemEntityName({}); // false + * + * @param {*} entityName - the entity to check. + * @returns {boolean} A Boolean indicating whether or not specified entity is instance of BemEntityName. + */ + static isBemEntityName(entityName) { + const C = entityName && entityName.constructor; + return C === this || Boolean(C && entityName.__isBemEntityName__ && C !== Object); + } +} + +module.exports = BemEntityName; + +// TypeScript imports the `default` property for +// an ES2015 default import (`import BemEntityName from '@bem/sdk.entity-name'`) +// See: https://github.com/Microsoft/TypeScript/issues/2242#issuecomment-83694181 +module.exports.default = BemEntityName; diff --git a/node_modules/@bem/sdk.entity-name/lib/entity-type-error.js b/node_modules/@bem/sdk.entity-name/lib/entity-type-error.js new file mode 100644 index 0000000..a50755d --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/lib/entity-type-error.js @@ -0,0 +1,22 @@ +'use strict'; + +const util = require('util'); + +const ExtendableError = require('es6-error'); + +/** + * The EntityTypeError object represents an error when a value is not valid BEM entity. + */ +module.exports = class EntityTypeError extends ExtendableError { + /** + * @param {*} obj — not valid object + * @param {string} [reason] — human-readable reason why object is not valid + */ + constructor(obj, reason) { + const str = util.inspect(obj, { depth: 1 }); + const type = obj ? typeof obj : ''; + const message = `the ${type} \`${str}\` is not valid BEM entity`; + + super(reason ? `${message}, ${reason}` : message); + } +}; diff --git a/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/CHANGELOG.md b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/CHANGELOG.md new file mode 100644 index 0000000..3f7b388 --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/CHANGELOG.md @@ -0,0 +1,74 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + + +## [0.0.9](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.0.8...@bem/sdk.naming.presets@0.0.9) (2018-04-17) + + +### Bug Fixes + +* degradate to es5 for entity.stringify ([ad4f8c1](https://github.com/bem/bem-sdk/commit/ad4f8c1)) + + + + + +## [0.0.8](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.0.7...@bem/sdk.naming.presets@0.0.8) (2018-04-17) + + + + +**Note:** Version bump only for package @bem/sdk.naming.presets + + +## [0.0.7](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.0.6...@bem/sdk.naming.presets@0.0.7) (2017-12-16) + + +### Bug Fixes + +* **walk:** resolve cycle dependency ([9e8d925](https://github.com/bem/bem-sdk/commit/9e8d925)) + + + + + +## [0.0.6](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.0.5...@bem/sdk.naming.presets@0.0.6) (2017-12-12) + + + + +**Note:** Version bump only for package @bem/sdk.naming.presets + + +## [0.0.5](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.0.3...@bem/sdk.naming.presets@0.0.5) (2017-11-07) + + + + +**Note:** Version bump only for package @bem/sdk.naming.presets + + +## [0.0.4](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.0.3...@bem/sdk.naming.presets@0.0.4) (2017-10-02) + + + + +**Note:** Version bump only for package @bem/sdk.naming.presets + + +## 0.0.3 (2017-10-01) + + + + +**Note:** Version bump only for package @bem/sdk.naming.presets + + +## 0.0.2 (2017-09-30) + + + + +**Note:** Version bump only for package @bem/sdk.naming.presets diff --git a/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/LICENSE.txt b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/LICENSE.txt new file mode 100644 index 0000000..bf9c4e7 --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/LICENSE.txt @@ -0,0 +1,369 @@ +© YANDEX LLC, 2017-present + +The Source Code called `@bem/sdk.naming.presets` available at https://github.com/bem/bem-sdk/tree/master/packages/naming.presets is subject to the terms of the Mozilla Public License, v. 2.0 (hereinafter - MPL). The text of MPL is the following: + +Mozilla Public License, version 2.0 + +1. Definitions + +1.1. "Contributor" + + means each individual or legal entity that creates, contributes to the + creation of, or owns Covered Software. + +1.2. "Contributor Version" + + means the combination of the Contributions of others (if any) used by a + Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + + means Source Code Form to which the initial Contributor has attached the + notice in Exhibit A, the Executable Form of such Source Code Form, and + Modifications of such Source Code Form, in each case including portions + thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + a. that the initial Contributor has attached the notice described in + Exhibit B to the Covered Software; or + + b. that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the terms of + a Secondary License. + +1.6. "Executable Form" + + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + + means a work that combines Covered Software with other material, in a + separate file or files, that is not Covered Software. + +1.8. "License" + + means this document. + +1.9. "Licensable" + + means having the right to grant, to the maximum extent possible, whether + at the time of the initial grant or subsequently, any and all of the + rights conveyed by this License. + +1.10. "Modifications" + + means any of the following: + + a. any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered Software; or + + b. any new file in Source Code Form that contains any Covered Software. + +1.11. "Patent Claims" of a Contributor + + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the License, + by the making, using, selling, offering for sale, having made, import, + or transfer of either its Contributions or its Contributor Version. + +1.12. "Secondary License" + + means either the GNU General Public License, Version 2.0, the GNU Lesser + General Public License, Version 2.1, the GNU Affero General Public + License, Version 3.0, or any later versions of those licenses. + +1.13. "Source Code Form" + + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that controls, is + controlled by, or is under common control with You. For purposes of this + definition, "control" means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by contract or + otherwise, or (b) ownership of more than fifty percent (50%) of the + outstanding shares or beneficial ownership of such entity. + + +2. License Grants and Conditions + +2.1. Grants + + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + a. under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + + b. under Patent Claims of such Contributor to make, use, sell, offer for + sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + + The licenses granted in Section 2.1 with respect to any Contribution + become effective for each Contribution on the date the Contributor first + distributes such Contribution. + +2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under + this License. No additional rights or licenses will be implied from the + distribution or licensing of Covered Software under this License. + Notwithstanding Section 2.1(b) above, no patent license is granted by a + Contributor: + + a. for any code that a Contributor has removed from Covered Software; or + + b. for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + c. under Patent Claims infringed by Covered Software in the absence of + its Contributions. + + This License does not grant any rights in the trademarks, service marks, + or logos of any Contributor (except as may be necessary to comply with + the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this + License (see Section 10.2) or under the terms of a Secondary License (if + permitted under the terms of Section 3.3). + +2.5. Representation + + Each Contributor represents that the Contributor believes its + Contributions are its original creation(s) or it has sufficient rights to + grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + + This License is not intended to limit any rights You have under + applicable copyright doctrines of fair use, fair dealing, or other + equivalents. + +2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in + Section 2.1. + + +3. Responsibilities + +3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under + the terms of this License. You must inform recipients that the Source + Code Form of the Covered Software is governed by the terms of this + License, and how they can obtain a copy of this License. You may not + attempt to alter or restrict the recipients' rights in the Source Code + Form. + +3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + a. such Covered Software must also be made available in Source Code Form, + as described in Section 3.1, and You must inform recipients of the + Executable Form how they can obtain a copy of such Source Code Form by + reasonable means in a timely manner, at a charge no more than the cost + of distribution to the recipient; and + + b. You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter the + recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for + the Covered Software. If the Larger Work is a combination of Covered + Software with a work governed by one or more Secondary Licenses, and the + Covered Software is not Incompatible With Secondary Licenses, this + License permits You to additionally distribute such Covered Software + under the terms of such Secondary License(s), so that the recipient of + the Larger Work may, at their option, further distribute the Covered + Software under the terms of either this License or such Secondary + License(s). + +3.4. Notices + + You may not remove or alter the substance of any license notices + (including copyright notices, patent notices, disclaimers of warranty, or + limitations of liability) contained within the Source Code Form of the + Covered Software, except that You may alter any license notices to the + extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on + behalf of any Contributor. You must make it absolutely clear that any + such warranty, support, indemnity, or liability obligation is offered by + You alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + + If it is impossible for You to comply with any of the terms of this License + with respect to some or all of the Covered Software due to statute, + judicial order, or regulation then You must: (a) comply with the terms of + this License to the maximum extent possible; and (b) describe the + limitations and the code they affect. Such description must be placed in a + text file included with all distributions of the Covered Software under + this License. Except to the extent prohibited by statute or regulation, + such description must be sufficiently detailed for a recipient of ordinary + skill to be able to understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically if You + fail to comply with any of its terms. However, if You become compliant, + then the rights granted under this License from a particular Contributor + are reinstated (a) provisionally, unless and until such Contributor + explicitly and finally terminates Your grants, and (b) on an ongoing + basis, if such Contributor fails to notify You of the non-compliance by + some reasonable means prior to 60 days after You have come back into + compliance. Moreover, Your grants from a particular Contributor are + reinstated on an ongoing basis if such Contributor notifies You of the + non-compliance by some reasonable means, this is the first time You have + received notice of non-compliance with this License from such + Contributor, and You become compliant prior to 30 days after Your receipt + of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, + counter-claims, and cross-claims) alleging that a Contributor Version + directly or indirectly infringes any patent, then the rights granted to + You by any and all Contributors for the Covered Software under Section + 2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user + license agreements (excluding distributors and resellers) which have been + validly granted by You or Your distributors under this License prior to + termination shall survive termination. + +6. Disclaimer of Warranty + + Covered Software is provided under this License on an "as is" basis, + without warranty of any kind, either expressed, implied, or statutory, + including, without limitation, warranties that the Covered Software is free + of defects, merchantable, fit for a particular purpose or non-infringing. + The entire risk as to the quality and performance of the Covered Software + is with You. Should any Covered Software prove defective in any respect, + You (not any Contributor) assume the cost of any necessary servicing, + repair, or correction. This disclaimer of warranty constitutes an essential + part of this License. No use of any Covered Software is authorized under + this License except under this disclaimer. + +7. Limitation of Liability + + Under no circumstances and under no legal theory, whether tort (including + negligence), contract, or otherwise, shall any Contributor, or anyone who + distributes Covered Software as permitted above, be liable to You for any + direct, indirect, special, incidental, or consequential damages of any + character including, without limitation, damages for lost profits, loss of + goodwill, work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses, even if such party shall have been + informed of the possibility of such damages. This limitation of liability + shall not apply to liability for death or personal injury resulting from + such party's negligence to the extent applicable law prohibits such + limitation. Some jurisdictions do not allow the exclusion or limitation of + incidental or consequential damages, so this exclusion and limitation may + not apply to You. + +8. Litigation + + Any litigation relating to this License may be brought only in the courts + of a jurisdiction where the defendant maintains its principal place of + business and such litigation shall be governed by laws of that + jurisdiction, without reference to its conflict-of-law provisions. Nothing + in this Section shall prevent a party's ability to bring cross-claims or + counter-claims. + +9. Miscellaneous + + This License represents the complete agreement concerning the subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. Any law or regulation which provides that + the language of a contract shall be construed against the drafter shall not + be used to construe this License against a Contributor. + + +10. Versions of the License + +10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + +10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version + of the License under which You originally received the Covered Software, + or under the terms of any subsequent version published by the license + steward. + +10.3. Modified Versions + + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a + modified version of this License if you rename the license and remove + any references to the name of the license steward (except to note that + such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary + Licenses If You choose to distribute Source Code Form that is + Incompatible With Secondary Licenses under the terms of this version of + the License, the notice described in Exhibit B of this License must be + attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the + terms of the Mozilla Public License, v. + 2.0. If a copy of the MPL was not + distributed with this file, You can + obtain one at + http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, +then You may include the notice in a location (such as a LICENSE file in a +relevant directory) where a recipient would be likely to look for such a +notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice + + This Source Code Form is "Incompatible + With Secondary Licenses", as defined by + the Mozilla Public License, v. 2.0. + + +A copy of the MPL is also available at http://mozilla.org/MPL/2.0/. diff --git a/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/create.js b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/create.js new file mode 100644 index 0000000..85eb61c --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/create.js @@ -0,0 +1,46 @@ +'use strict'; + +var presets = require('.'); + +module.exports = init; + +/** + * Returns delims and wordPattern. + * + * @param {Object} options - user options + * @returns {BemNamingDelims} + */ +function init(options) { + if (!options) { + return presets.origin; + } + + if (typeof options === 'string') { + var preset = presets[options]; + + if (!preset) { + throw new Error('The `' + options + '` naming is unknown.'); + } + + return preset; + } + + var defaults = presets.origin; + var defaultDelims = defaults.delims; + var defaultModDelims = defaultDelims.mod; + var optionsDelims = options.delims || {}; + var mod = optionsDelims.mod || defaultDelims.mod; + + return { + delims: { + elem: optionsDelims.elem || defaultDelims.elem, + mod: typeof mod === 'string' + ? { name: mod, val: mod } + : { + name: mod.name || defaultModDelims.name, + val: mod.val || defaultModDelims.val + } + }, + wordPattern: options.wordPattern || defaults.wordPattern + }; +} diff --git a/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/index.js b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/index.js new file mode 100644 index 0000000..39577f0 --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/index.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = { + origin: require('./origin'), + react: require('./react'), + 'two-dashes': require('./two-dashes') +}; diff --git a/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/origin.js b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/origin.js new file mode 100644 index 0000000..d9adc56 --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/origin.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = { + delims: { + elem: '__', + mod: { name: '_', val: '_' } + }, + fs: { + // delims: { elem: '__', mod: '_' }, // redundand because of defaults + pattern: '${layer}.blocks/${entity}.${tech}', + scheme: 'nested' + }, + wordPattern: '[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*' +}; diff --git a/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/package.json b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/package.json new file mode 100644 index 0000000..a9d46fc --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/package.json @@ -0,0 +1,126 @@ +{ + "_args": [ + [ + "@bem/sdk.naming.presets@^0.0.9", + "/mnt/c/users/1/Documents/Frontend/task2/node_modules/@bem/sdk.entity-name" + ] + ], + "_from": "@bem/sdk.naming.presets@>=0.0.9 <0.0.10", + "_hasShrinkwrap": false, + "_id": "@bem/sdk.naming.presets@0.0.9", + "_inCache": true, + "_installable": true, + "_location": "/@bem/sdk.entity-name/@bem/sdk.naming.presets", + "_nodeVersion": "8.4.0", + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/sdk.naming.presets_0.0.9_1523986419604_0.6409384048129463" + }, + "_npmUser": { + "email": "zxqfox@gmail.com", + "name": "qfox" + }, + "_npmVersion": "5.6.0", + "_phantomChildren": {}, + "_requested": { + "name": "@bem/sdk.naming.presets", + "raw": "@bem/sdk.naming.presets@^0.0.9", + "rawSpec": "^0.0.9", + "scope": "@bem", + "spec": ">=0.0.9 <0.0.10", + "type": "range" + }, + "_requiredBy": [ + "/@bem/sdk.entity-name" + ], + "_resolved": "https://registry.npmjs.org/@bem/sdk.naming.presets/-/sdk.naming.presets-0.0.9.tgz", + "_shasum": "1d3be02fe5a13d357c5e64dcd3f10b7a02f90a61", + "_shrinkwrap": null, + "_spec": "@bem/sdk.naming.presets@^0.0.9", + "_where": "/mnt/c/users/1/Documents/Frontend/task2/node_modules/@bem/sdk.entity-name", + "author": { + "email": "zxqfox@gmail.com", + "name": "Alexej Yaroshevich", + "url": "http://github.com/zxqfox" + }, + "bugs": { + "url": "https://github.com/bem/bem-sdk/issues?q=label%3Apkg%3Anaming.presets" + }, + "dependencies": {}, + "description": "Presets for naming", + "devDependencies": { + "@bem/sdk.cell": "^0.2.6", + "@bem/sdk.entity-name": "^0.2.6", + "@bem/sdk.naming.cell.stringify": "^0.0.9", + "@bem/sdk.naming.entity": "^0.2.6" + }, + "directories": {}, + "dist": { + "fileCount": 8, + "integrity": "sha512-FIjmZZF5m0Evm6YDmyWyGjXvdkFHoyAJSRY3rKHA5VInFjw1zZLCH45GI86CIAkDUvbYzjlY+rsmyY5YBz3HQw==", + "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa1i/0CRA9TVsSAnZWagAAqTIP/23duU928FYryBrqbsYF\n0hGYbC51Hlwxzj7M3yswKIUdluyhegFr7RZt5fPbA1ewHp5ZZzucoR43KqUr\nB+n9XmKlTEvwPvCXazPR0zElKqzDe/VeFXhU+zwxXVL5qrsJnoC0HOboY1l5\nT8brQVDRGVpKyinw+1flz/HxfBGHCBDc9JFRQmZf4+ooozifyfm0+z8AWrCW\ntT9FBqXaIg5oi2bFr2kR8BMqVf+/SvzDNb3Ct8hhYnkFiuV42i13dv5KKufA\ns11oODPy3FHzZzmAMeJtpHrLsKLMLzDYpBbFQRBU6qXdrVsxLKFcd+nuBLSH\nHCoG9qAva/1mrN2rdLP3Q2lY9J4G4iVhdU+ArYe0jJlLe4aUcNiEHlpqlKVh\nIozxEg51gMyGUzKizpBWMMqs22IkIqIzSuNI2RfTsnYMxMAJur5nS55he7AA\n56Ko2iKMarovZ82x7WgcTn9zKrmXuxRTkERkamAFC0iwMSM+P4SajGuIpBri\nfUUv9UO2UUC8ZCaJQOLiNsfUhOJv33NsB8/ipgJGrsghSm2Ha5Z3TKeTstUP\nB6vapsL8fs60dm7HhsB8YeHSAia7vcJerwidfungaQ74YWlZ306pKtaCp/K7\n9HkculCxwlEj6bE23Ym7vFZvlg1gMUrsMMXT7tj3YFvjhXBYd97St8MSqkz0\n4CDI\r\n=gcW/\r\n-----END PGP SIGNATURE-----\r\n", + "shasum": "1d3be02fe5a13d357c5e64dcd3f10b7a02f90a61", + "tarball": "https://registry.npmjs.org/@bem/sdk.naming.presets/-/sdk.naming.presets-0.0.9.tgz", + "unpackedSize": 21221 + }, + "engines": { + "node": ">= 4.0" + }, + "files": [ + "*.js" + ], + "homepage": "https://github.com/bem/bem-sdk/tree/master/packages/naming.presets#readme", + "keywords": [ + "bem", + "cell", + "conventions", + "entity", + "name", + "naming", + "origin", + "react", + "two-dashes" + ], + "license": "MPL-2.0", + "main": "index.js", + "maintainers": [ + { + "name": "blond", + "email": "mail@blond.im" + }, + { + "name": "qfox", + "email": "zxqfox@gmail.com" + }, + { + "name": "tadatuta", + "email": "i@tadatuta.com" + }, + { + "name": "veged", + "email": "veged@ya.ru" + }, + { + "name": "vithar", + "email": "vitaly@harisov.name" + }, + { + "name": "yeti-or", + "email": "yeti.or@gmail.com" + } + ], + "name": "@bem/sdk.naming.presets", + "optionalDependencies": {}, + "publishConfig": { + "access": "public" + }, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/bem/bem-sdk.git" + }, + "scripts": { + "test": "nyc mocha" + }, + "version": "0.0.9" +} diff --git a/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/react.js b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/react.js new file mode 100644 index 0000000..e1ffab6 --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/react.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = { + delims: { + elem: '-', + mod: { name: '_', val: '_' } + }, + fs: { + delims: { elem: '' }, + pattern: '${layer?${layer}.}blocks/${entity}.${tech}', + scheme: 'nested' + }, + wordPattern: '[a-zA-Z0-9]+' +}; diff --git a/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/two-dashes.js b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/two-dashes.js new file mode 100644 index 0000000..330fbf0 --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/node_modules/@bem/sdk.naming.presets/two-dashes.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = { + delims: { + elem: '__', + mod: { name: '--', val: '_' } + }, + fs: { + // delims: { elem: '__', mod: '--' }, // redundand because of defaults + pattern: '${layer}.blocks/${entity}.${tech}', + scheme: 'nested' + }, + wordPattern: '[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*' +}; diff --git a/node_modules/@bem/sdk.entity-name/package.json b/node_modules/@bem/sdk.entity-name/package.json new file mode 100644 index 0000000..594820d --- /dev/null +++ b/node_modules/@bem/sdk.entity-name/package.json @@ -0,0 +1,139 @@ +{ + "_args": [ + [ + "@bem/sdk.entity-name@^0.2.11", + "/mnt/c/users/1/Documents/Frontend/task2/node_modules/@bem/sdk.naming.entity" + ] + ], + "_from": "@bem/sdk.entity-name@>=0.2.11 <0.3.0", + "_hasShrinkwrap": false, + "_id": "@bem/sdk.entity-name@0.2.11", + "_inCache": true, + "_installable": true, + "_location": "/@bem/sdk.entity-name", + "_nodeVersion": "8.6.0", + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/sdk.entity-name_0.2.11_1549205366474_0.30188367587661435" + }, + "_npmUser": { + "email": "zxqfox@gmail.com", + "name": "qfox" + }, + "_npmVersion": "lerna/3.10.5/node@v8.6.0+x64 (darwin)", + "_phantomChildren": {}, + "_requested": { + "name": "@bem/sdk.entity-name", + "raw": "@bem/sdk.entity-name@^0.2.11", + "rawSpec": "^0.2.11", + "scope": "@bem", + "spec": ">=0.2.11 <0.3.0", + "type": "range" + }, + "_requiredBy": [ + "/@bem/sdk.naming.entity", + "/@bem/sdk.naming.entity.parse" + ], + "_resolved": "https://registry.npmjs.org/@bem/sdk.entity-name/-/sdk.entity-name-0.2.11.tgz", + "_shasum": "0e693427ac85a2498ad1280a25428797085da211", + "_shrinkwrap": null, + "_spec": "@bem/sdk.entity-name@^0.2.11", + "_where": "/mnt/c/users/1/Documents/Frontend/task2/node_modules/@bem/sdk.naming.entity", + "author": { + "email": "mail@blond.im", + "name": "Andrew Abramov", + "url": "github.com/blond" + }, + "bugs": { + "url": "https://github.com/bem/bem-sdk/issues?q=label%3Apkg%3Aentity-name" + }, + "dependencies": { + "@bem/sdk.naming.entity.stringify": "^1.1.2", + "@bem/sdk.naming.presets": "^0.0.9", + "depd": "1.1.0", + "es6-error": "4.0.2" + }, + "description": "BEM entity name representation", + "devDependencies": { + "@types/node": "^8.0" + }, + "directories": {}, + "dist": { + "fileCount": 9, + "integrity": "sha512-fOz/hSqbuHdeD94b0hpX9HLNxjIh2GyFAfjeMGxUa/yGxDIIg5Vth4xk/hhT4WByzzZzBjFhenUJMvi2b202UA==", + "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVv93CRA9TVsSAnZWagAA0bYP/ibNipb2QZp8cvlzdqvg\nxy67PCIyM1szoVOzRFI4dWd7tqS4nZnH5A5bBCcbWwNsGbw/NScInuVgULy4\n3pIAMwI5ElS8VEx6NWIVfrns1yU40c3AzxkSla/6gmcaeqbgfxWwl02gcJNE\nZKijKm6ojefR1FzN6epV0nznPf4DwZ/tzWxf+V8KG6cxtGIexTWYjJm7v1w2\nfnybkABbXOJB/iApFwrWqgXLnN1OQWaBepxLV/S70DA9UnUwbmunGGFnwTX5\nBr+dlhEw6WqiCMFTeH586uuFdyN9yJd6hUh7Ri2WHhvJRR0fro/QmfIUHDGp\nIDJUbZ199sRzR/WEaMCrCLL/5O9+3q3sq1zkn/JuOvUYxiEJSxPq+1QpKiPZ\nKAtYcFjZf+QlrvZfsHh7mHWo2Iv1x4Sky5heaLT5RdZ9tFNNr9CCg0llM9JE\ndCdL1adbZTRrou/QsrZ4bPLcqrzuin8Ffgho/RjRYGuzF7zT4i62De0C42MF\nwq5q9YlI0oxcGFb0cDJPEIbXvVdTuEQpWNL+atNb8uNB8ddPKST9yLhLEaN8\nQfby7pWI6kB/ZSyUBSixAAWjrJjawznB8VGYrgJzDCMxw/UA1fM7Ry9otx7b\nPVh/voEgjkXIZgfUrOL1b0HZt8b/MF6DNoIFghP+FiNj4mHcntuTplqHpV3l\nSnax\r\n=LM+C\r\n-----END PGP SIGNATURE-----\r\n", + "shasum": "0e693427ac85a2498ad1280a25428797085da211", + "tarball": "https://registry.npmjs.org/@bem/sdk.entity-name/-/sdk.entity-name-0.2.11.tgz", + "unpackedSize": 55095 + }, + "engines": { + "node": ">= 8.0" + }, + "gitHead": "1ec9066d241303e5dc2abc01171f111effffff3a", + "greenkeeper": { + "ignore": [ + "@types/node" + ] + }, + "homepage": "https://github.com/bem/bem-sdk/tree/master/packages/entity-name#readme", + "keywords": [ + "bem", + "block", + "elem", + "element", + "entity", + "equal", + "is", + "mod", + "modifier", + "name", + "type", + "val", + "value" + ], + "license": "MPL-2.0", + "main": "index.js", + "maintainers": [ + { + "name": "blond", + "email": "mail@blond.im" + }, + { + "name": "qfox", + "email": "zxqfox@gmail.com" + }, + { + "name": "tadatuta", + "email": "i@tadatuta.com" + }, + { + "name": "veged", + "email": "veged@ya.ru" + }, + { + "name": "vithar", + "email": "vitaly@harisov.name" + }, + { + "name": "yeti-or", + "email": "yeti.or@gmail.com" + } + ], + "name": "@bem/sdk.entity-name", + "optionalDependencies": {}, + "publishConfig": { + "access": "public" + }, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/bem/bem-sdk.git" + }, + "scripts": { + "cover": "nyc mocha", + "specs": "mocha", + "test": "npm run specs" + }, + "typings": "index.d.ts", + "version": "0.2.11" +} diff --git a/node_modules/@bem/sdk.naming.entity.parse/CHANGELOG.md b/node_modules/@bem/sdk.naming.entity.parse/CHANGELOG.md new file mode 100644 index 0000000..af8e126 --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity.parse/CHANGELOG.md @@ -0,0 +1,95 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.2.9](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.parse@0.2.8...@bem/sdk.naming.entity.parse@0.2.9) (2019-02-03) + +**Note:** Version bump only for package @bem/sdk.naming.entity.parse + + + + + + +## [0.2.8](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.parse@0.2.7...@bem/sdk.naming.entity.parse@0.2.8) (2018-07-16) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity.parse + + +## [0.2.7](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.parse@0.2.6...@bem/sdk.naming.entity.parse@0.2.7) (2018-07-01) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity.parse + + +## [0.2.6](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.parse@0.2.5...@bem/sdk.naming.entity.parse@0.2.6) (2018-04-17) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity.parse + + +## [0.2.5](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.parse@0.2.4...@bem/sdk.naming.entity.parse@0.2.5) (2018-04-17) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity.parse + + +## [0.2.4](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.parse@0.2.3...@bem/sdk.naming.entity.parse@0.2.4) (2017-12-16) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity.parse + + +## [0.2.3](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.parse@0.2.2...@bem/sdk.naming.entity.parse@0.2.3) (2017-12-12) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity.parse + + +## [0.2.2](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.parse@0.2.0...@bem/sdk.naming.entity.parse@0.2.2) (2017-11-07) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity.parse + + +## [0.2.1](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.parse@0.2.0...@bem/sdk.naming.entity.parse@0.2.1) (2017-10-02) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity.parse + + +# 0.2.0 (2017-10-01) + + +### Features + +* split bem-naming to naming.entity.* packages ([0bf481d](https://github.com/bem/bem-sdk/commit/0bf481d)) + + + + + +# 0.1.0 (2017-09-30) + + +### Features + +* split bem-naming to naming.entity.* packages ([0bf481d](https://github.com/bem/bem-sdk/commit/0bf481d)) diff --git a/node_modules/@bem/sdk.naming.entity.parse/LICENSE.txt b/node_modules/@bem/sdk.naming.entity.parse/LICENSE.txt new file mode 100644 index 0000000..83371ff --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity.parse/LICENSE.txt @@ -0,0 +1,369 @@ +© YANDEX LLC, 2017-present + +The Source Code called `@bem/sdk.naming.entity.parse` available at https://github.com/bem/bem-sdk/tree/master/packages/naming.entity.parse is subject to the terms of the Mozilla Public License, v. 2.0 (hereinafter - MPL). The text of MPL is the following: + +Mozilla Public License, version 2.0 + +1. Definitions + +1.1. "Contributor" + + means each individual or legal entity that creates, contributes to the + creation of, or owns Covered Software. + +1.2. "Contributor Version" + + means the combination of the Contributions of others (if any) used by a + Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + + means Source Code Form to which the initial Contributor has attached the + notice in Exhibit A, the Executable Form of such Source Code Form, and + Modifications of such Source Code Form, in each case including portions + thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + a. that the initial Contributor has attached the notice described in + Exhibit B to the Covered Software; or + + b. that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the terms of + a Secondary License. + +1.6. "Executable Form" + + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + + means a work that combines Covered Software with other material, in a + separate file or files, that is not Covered Software. + +1.8. "License" + + means this document. + +1.9. "Licensable" + + means having the right to grant, to the maximum extent possible, whether + at the time of the initial grant or subsequently, any and all of the + rights conveyed by this License. + +1.10. "Modifications" + + means any of the following: + + a. any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered Software; or + + b. any new file in Source Code Form that contains any Covered Software. + +1.11. "Patent Claims" of a Contributor + + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the License, + by the making, using, selling, offering for sale, having made, import, + or transfer of either its Contributions or its Contributor Version. + +1.12. "Secondary License" + + means either the GNU General Public License, Version 2.0, the GNU Lesser + General Public License, Version 2.1, the GNU Affero General Public + License, Version 3.0, or any later versions of those licenses. + +1.13. "Source Code Form" + + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that controls, is + controlled by, or is under common control with You. For purposes of this + definition, "control" means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by contract or + otherwise, or (b) ownership of more than fifty percent (50%) of the + outstanding shares or beneficial ownership of such entity. + + +2. License Grants and Conditions + +2.1. Grants + + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + a. under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + + b. under Patent Claims of such Contributor to make, use, sell, offer for + sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + + The licenses granted in Section 2.1 with respect to any Contribution + become effective for each Contribution on the date the Contributor first + distributes such Contribution. + +2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under + this License. No additional rights or licenses will be implied from the + distribution or licensing of Covered Software under this License. + Notwithstanding Section 2.1(b) above, no patent license is granted by a + Contributor: + + a. for any code that a Contributor has removed from Covered Software; or + + b. for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + c. under Patent Claims infringed by Covered Software in the absence of + its Contributions. + + This License does not grant any rights in the trademarks, service marks, + or logos of any Contributor (except as may be necessary to comply with + the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this + License (see Section 10.2) or under the terms of a Secondary License (if + permitted under the terms of Section 3.3). + +2.5. Representation + + Each Contributor represents that the Contributor believes its + Contributions are its original creation(s) or it has sufficient rights to + grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + + This License is not intended to limit any rights You have under + applicable copyright doctrines of fair use, fair dealing, or other + equivalents. + +2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in + Section 2.1. + + +3. Responsibilities + +3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under + the terms of this License. You must inform recipients that the Source + Code Form of the Covered Software is governed by the terms of this + License, and how they can obtain a copy of this License. You may not + attempt to alter or restrict the recipients' rights in the Source Code + Form. + +3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + a. such Covered Software must also be made available in Source Code Form, + as described in Section 3.1, and You must inform recipients of the + Executable Form how they can obtain a copy of such Source Code Form by + reasonable means in a timely manner, at a charge no more than the cost + of distribution to the recipient; and + + b. You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter the + recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for + the Covered Software. If the Larger Work is a combination of Covered + Software with a work governed by one or more Secondary Licenses, and the + Covered Software is not Incompatible With Secondary Licenses, this + License permits You to additionally distribute such Covered Software + under the terms of such Secondary License(s), so that the recipient of + the Larger Work may, at their option, further distribute the Covered + Software under the terms of either this License or such Secondary + License(s). + +3.4. Notices + + You may not remove or alter the substance of any license notices + (including copyright notices, patent notices, disclaimers of warranty, or + limitations of liability) contained within the Source Code Form of the + Covered Software, except that You may alter any license notices to the + extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on + behalf of any Contributor. You must make it absolutely clear that any + such warranty, support, indemnity, or liability obligation is offered by + You alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + + If it is impossible for You to comply with any of the terms of this License + with respect to some or all of the Covered Software due to statute, + judicial order, or regulation then You must: (a) comply with the terms of + this License to the maximum extent possible; and (b) describe the + limitations and the code they affect. Such description must be placed in a + text file included with all distributions of the Covered Software under + this License. Except to the extent prohibited by statute or regulation, + such description must be sufficiently detailed for a recipient of ordinary + skill to be able to understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically if You + fail to comply with any of its terms. However, if You become compliant, + then the rights granted under this License from a particular Contributor + are reinstated (a) provisionally, unless and until such Contributor + explicitly and finally terminates Your grants, and (b) on an ongoing + basis, if such Contributor fails to notify You of the non-compliance by + some reasonable means prior to 60 days after You have come back into + compliance. Moreover, Your grants from a particular Contributor are + reinstated on an ongoing basis if such Contributor notifies You of the + non-compliance by some reasonable means, this is the first time You have + received notice of non-compliance with this License from such + Contributor, and You become compliant prior to 30 days after Your receipt + of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, + counter-claims, and cross-claims) alleging that a Contributor Version + directly or indirectly infringes any patent, then the rights granted to + You by any and all Contributors for the Covered Software under Section + 2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user + license agreements (excluding distributors and resellers) which have been + validly granted by You or Your distributors under this License prior to + termination shall survive termination. + +6. Disclaimer of Warranty + + Covered Software is provided under this License on an "as is" basis, + without warranty of any kind, either expressed, implied, or statutory, + including, without limitation, warranties that the Covered Software is free + of defects, merchantable, fit for a particular purpose or non-infringing. + The entire risk as to the quality and performance of the Covered Software + is with You. Should any Covered Software prove defective in any respect, + You (not any Contributor) assume the cost of any necessary servicing, + repair, or correction. This disclaimer of warranty constitutes an essential + part of this License. No use of any Covered Software is authorized under + this License except under this disclaimer. + +7. Limitation of Liability + + Under no circumstances and under no legal theory, whether tort (including + negligence), contract, or otherwise, shall any Contributor, or anyone who + distributes Covered Software as permitted above, be liable to You for any + direct, indirect, special, incidental, or consequential damages of any + character including, without limitation, damages for lost profits, loss of + goodwill, work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses, even if such party shall have been + informed of the possibility of such damages. This limitation of liability + shall not apply to liability for death or personal injury resulting from + such party's negligence to the extent applicable law prohibits such + limitation. Some jurisdictions do not allow the exclusion or limitation of + incidental or consequential damages, so this exclusion and limitation may + not apply to You. + +8. Litigation + + Any litigation relating to this License may be brought only in the courts + of a jurisdiction where the defendant maintains its principal place of + business and such litigation shall be governed by laws of that + jurisdiction, without reference to its conflict-of-law provisions. Nothing + in this Section shall prevent a party's ability to bring cross-claims or + counter-claims. + +9. Miscellaneous + + This License represents the complete agreement concerning the subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. Any law or regulation which provides that + the language of a contract shall be construed against the drafter shall not + be used to construe this License against a Contributor. + + +10. Versions of the License + +10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + +10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version + of the License under which You originally received the Covered Software, + or under the terms of any subsequent version published by the license + steward. + +10.3. Modified Versions + + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a + modified version of this License if you rename the license and remove + any references to the name of the license steward (except to note that + such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary + Licenses If You choose to distribute Source Code Form that is + Incompatible With Secondary Licenses under the terms of this version of + the License, the notice described in Exhibit B of this License must be + attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the + terms of the Mozilla Public License, v. + 2.0. If a copy of the MPL was not + distributed with this file, You can + obtain one at + http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, +then You may include the notice in a location (such as a LICENSE file in a +relevant directory) where a recipient would be likely to look for such a +notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice + + This Source Code Form is "Incompatible + With Secondary Licenses", as defined by + the Mozilla Public License, v. 2.0. + + +A copy of the MPL is also available at http://mozilla.org/MPL/2.0/. diff --git a/node_modules/@bem/sdk.naming.entity.parse/README.md b/node_modules/@bem/sdk.naming.entity.parse/README.md new file mode 100644 index 0000000..abaae32 --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity.parse/README.md @@ -0,0 +1,245 @@ +# parse + +Parser for a [BEM entity](https://bem.info/methodology/key-concepts/#bem-entity) string representation. + +[![NPM Status][npm-img]][npm] + +[npm]: https://www.npmjs.org/package/@bem/sdk.naming.entity.parse +[npm-img]: https://img.shields.io/npm/v/@bem/sdk.naming.entity.parse.svg + +* [Introduction](#introduction) +* [Try parse](#try-parse) +* [Quick start](#quick-start) +* [API reference](#api-reference) +* [Parameter tuning](#parameter-tuning) + * [Using Two Dashes style](#using-two-dashes-style) + * [Using React style](#using-react-style) + * [Using a custom naming convention](#using-a-custom-naming-convention) +* [Usage examples](#usage-examples) + * [Parsing filenames](#parsing-filenames) + +## Introduction + +The tool parses a [BEM entity](https://bem.info/methodology/key-concepts/#bem-entity) string representation and creates an object representation from it. + +You can choose which [naming convention](https://bem.info/methodology/naming-convention/) to use for creating a `parse()` function. + +> **Note.** If you don't have any BEM projects available to try out the `@bem/sdk.naming.entity.parse` package, the quickest way to create one is to use [bem-express](https://github.com/bem/bem-express). + +## Try parse + +An example is available in the [RunKit editor](https://runkit.com/migs911/how-bem-sdk-naming-entity-parse-works). + +## Quick start + +> **Attention.** To use `@bem/sdk.naming.entity.parse`, you must install [Node.js 8.0+](https://nodejs.org/en/download/). + +To run the `@bem/sdk.naming.entity.parse` package: + +1. [Install required packages](#installing-required-packages). +1. [Create a parse() function](#creating-a-parse-function). +1. [Parse a string](#parsing-a-string). + +### Installing required packages + +Install the following packages: + +* [@bem/sdk.naming.entity.parse](https://www.npmjs.org/package/@bem/sdk.naming.entity.parse), which contains the `parse()` function. +* [@bem/sdk.naming.presets](https://www.npmjs.com/package/@bem/sdk.naming.presets), which contains presets with well-known naming conventions. + +To install the packages, run the following command: + +``` +$ npm install --save @bem/sdk.naming.entity.parse @bem/sdk.naming.presets +``` + +### Creating a `parse()` function + +Create a JavaScript file with any name (for example, **app.js**) and do the following: + +1. Choose the [naming convention](https://bem.info/methodology/naming-convention/) and import the preset with this convention (for example, origin naming convention). + + For examples with other naming conventions, see the [Parameter tuning](#parameter-tuning) section. +1. Import the `@bem/sdk.naming.entity.parse` package and create the `parse()` function using the imported preset: + +```js +const originNaming = require('@bem/sdk.naming.presets/origin'); +const parse = require('@bem/sdk.naming.entity.parse')(originNaming); +``` + +### Parsing a string + +Parse a string representation of a BEM entity: + +```js +parse('button__run'); +``` + +This function will return the [BemEnityName](https://github.com/bem/bem-sdk/tree/master/packages/entity-name) object with the block name `button` and the element name `run`. + +**Example**: + +```js +const originNaming = require('@bem/sdk.naming.presets/origin'); +const parse = require('@bem/sdk.naming.entity.parse')(originNaming); + +// Parse a block name. +parse('my-block'); + +// Parse an element name. +parse('my-block__my-element'); + +// Parse a block modifier name. +parse('my-block_my-modifier'); + +// Parse a block modifier name with a value. +parse('my-block_my-modifier_some-value'); + +// Parse an element modifier name. +parse('my-block__my-element_my-modifier'); + +// Parse an element modifier name with a value. +parse('my-block__my-element_my-modifier_some-value'); +``` + +Also you can normalize a returned [BemEnityName](https://github.com/bem/bem-sdk/tree/master/packages/entity-name) object with the [valueOf()](https://github.com/bem/bem-sdk/tree/master/packages/entity-name#valueof) function: + +```js +parse('my-block__my-element_my-modifier_some-value').valueOf(); +// => Object { block: "my-block", +// elem: "my-element", +// mod: Object {name: "my-modifier", val: "some-value"}} +``` + +[RunKit live example](https://runkit.com/migs911/parse-a-string-using-origin-naming-convention) + +## API reference + +### parse() + +Parses string into object representation. + +```js +/** + * @typedef BemEntityName + * @property {string} block — Block name. + * @property {string} [elem] — Element name. + * @property {Object} [mod] — Modifier name or object with name and value. + * @property {string} mod.name — Modifier name. + * @property {string} [mod.val=true] — modifier value. + */ + +/** + * @param {string} str — String representation of a BEM entity. + * @returns {(BemEntityName|undefined)} + */ +parse(str); +``` + +## Parameter tuning + +### Using Two Dashes style + +Parse a string using the [Two Dashes style](https://bem.info/methodology/naming-convention/#two-dashes-style) naming convention. + +**Example:** + +```js +const twoDashesNaming = require('@bem/sdk.naming.presets/two-dashes'); +const parse = require('@bem/sdk.naming.entity.parse')(twoDashesNaming); + +// Parse a block name. +parse('my-block'); + +// Parse an element name. +parse('my-block__my-element'); + +// Parse a block modifier name. +parse('my-block--my-modifier'); + +// Parse a block modifier name with a value. +parse('my-block--my-modifier_some-value'); + +// Parse an element modifier name. +parse('my-block__my-element--my-modifier'); + +// Parse an element modifier name with a value. +parse('my-block__my-element--my-modifier_some-value'); +``` + +[RunKit live example](https://runkit.com/migs911/parse-a-string-using-two-dashes-style) + +### Using React style + +Parse a string using the [React style](https://bem.info/methodology/naming-convention/#react-style) naming convention. + +For creating a parse function there is no difference between the `react` and `origin-react` presets. You can use either of them. + +**Example:** + +```js +const reactNaming = require('@bem/sdk.naming.presets/react'); +const parse = require('@bem/sdk.naming.entity.parse')(reactNaming); + +// Parse a block name. +parse('myBlock'); + +// Parse an element name. +parse('myBlock-myElement'); + +// Parse a block modifier name. +parse('myBlock_myModifier'); + +// Parse a block modifier name with a value. +parse('myBlock_myModifier_value'); + +// Parse an element modifier name. +parse('myBlock-myElement_myModifier'); + +// Parse an element modifier name with a value. +parse('myBlock-myElement_myModifier_value'); +``` + +[RunKit live example](https://runkit.com/migs911/parse-a-string-using-react-style) + +### Using a custom naming convention + +Specify an [INamingConvention](https://github.com/bem/bem-sdk/blob/master/packages/naming.presets/index.d.ts#L10) object with the following fields: + +* `delims` — the delimiters that are used to separate names in the naming convention. +* `wordPattern` — a regular expression that will be used to match an entity name. + +Use this object to make your `parse()` function. + +**Example:** + +```js +const convention = { + wordPattern: '\\w+?', + delims: { + elem: '_EL-', + mod: { + name: '_MOD-', + val: '-' + }}}; +const parse = require('@bem/sdk.naming.entity.parse')(convention); + +// Parse an element modifier name. +console.log(parse('myBlock_EL-myElement_MOD-myModifier')); +/** + * => BemEntityName { + * block: 'myBlock', + * elem: 'myElement', + * mod: { name: 'myModifier', val: true } } + */ +``` + +[RunKit live example](https://runkit.com/migs911/parse-usage-examples-custom-naming-convention) + +## Usage examples + +### Parsing filenames + +If you have the `input_type_search.css` file, you can parse the filename and get the [BemEnityName](https://github.com/bem/bem-sdk/tree/master/packages/entity-name) object that represents this file. You can parse all files in your project this way. + +The `parse()` function uses in the walk package to parse filenames in the BEM project. You can find more examples in the walkers' code for following the [file structure organization](https://bem.info/methodology/filestructure): [Flat](https://github.com/bem/bem-sdk/blob/master/packages/walk/lib/walkers/flat.js) and [Nested](https://github.com/bem/bem-sdk/blob/master/packages/walk/lib/walkers/nested.js). \ No newline at end of file diff --git a/node_modules/@bem/sdk.naming.entity.parse/index.js b/node_modules/@bem/sdk.naming.entity.parse/index.js new file mode 100644 index 0000000..3aee7da --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity.parse/index.js @@ -0,0 +1,56 @@ +'use strict'; + +const BemEntityName = require('@bem/sdk.entity-name'); + +/** + * Builds regex for specified naming convention. + * + * @param {INamingConventionDelims} delims — separates entity names from each other. + * @param {String} wordPattern — defines which symbols can be used for block, element and modifier's names. + * @returns {RegExp} + */ +function buildRegex(delims, wordPattern) { + const block = '(' + wordPattern + ')'; + const elem = '(?:' + delims.elem + '(' + wordPattern + '))?'; + const modName = '(?:' + delims.mod.name + '(' + wordPattern + '))?'; + const modVal = '(?:' + delims.mod.val + '(' + wordPattern + '))?'; + const mod = modName + modVal; + + return new RegExp('^' + block + mod + '$|^' + block + elem + mod + '$'); +} + +/** + * Parses string into object representation. + * + * @param {String} str - string representation of BEM entity. + * @param {RegExp} regex - build regex for specified naming. + * @returns {BemEntityName|undefined} + */ +function parse(str, regex) { + const executed = regex.exec(str); + + if (!executed) { return undefined; } + + const modName = executed[2] || executed[6]; + + return new BemEntityName({ + block: executed[1] || executed[4], + elem: executed[5], + mod: modName && { + name: modName, + val: executed[3] || executed[7] || true + } + }); +} + +/** + * Creates `parse` function for specified naming convention. + * + * @param {INamingConvention} convention - options for naming convention. + * @returns {Function} + */ +module.exports = (convention) => { + const regex = buildRegex(convention.delims, convention.wordPattern); + + return (str) => parse(str, regex); +}; diff --git a/node_modules/@bem/sdk.naming.entity.parse/package.json b/node_modules/@bem/sdk.naming.entity.parse/package.json new file mode 100644 index 0000000..078982f --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity.parse/package.json @@ -0,0 +1,118 @@ +{ + "_args": [ + [ + "@bem/sdk.naming.entity.parse@^0.2.9", + "/mnt/c/users/1/Documents/Frontend/task2/node_modules/@bem/sdk.naming.entity" + ] + ], + "_from": "@bem/sdk.naming.entity.parse@>=0.2.9 <0.3.0", + "_hasShrinkwrap": false, + "_id": "@bem/sdk.naming.entity.parse@0.2.9", + "_inCache": true, + "_installable": true, + "_location": "/@bem/sdk.naming.entity.parse", + "_nodeVersion": "8.6.0", + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/sdk.naming.entity.parse_0.2.9_1549205372170_0.16948737660098145" + }, + "_npmUser": { + "email": "zxqfox@gmail.com", + "name": "qfox" + }, + "_npmVersion": "lerna/3.10.5/node@v8.6.0+x64 (darwin)", + "_phantomChildren": {}, + "_requested": { + "name": "@bem/sdk.naming.entity.parse", + "raw": "@bem/sdk.naming.entity.parse@^0.2.9", + "rawSpec": "^0.2.9", + "scope": "@bem", + "spec": ">=0.2.9 <0.3.0", + "type": "range" + }, + "_requiredBy": [ + "/@bem/sdk.naming.entity" + ], + "_resolved": "https://registry.npmjs.org/@bem/sdk.naming.entity.parse/-/sdk.naming.entity.parse-0.2.9.tgz", + "_shasum": "ecc7413bba3b4a41ba8db4dee20a18874c7fee0f", + "_shrinkwrap": null, + "_spec": "@bem/sdk.naming.entity.parse@^0.2.9", + "_where": "/mnt/c/users/1/Documents/Frontend/task2/node_modules/@bem/sdk.naming.entity", + "author": { + "email": "mail@blond.im", + "name": "Andrew Abramov" + }, + "bugs": { + "url": "https://github.com/bem/bem-sdk/issues?q=label%3Apkg%3Anaming.entity.parse" + }, + "dependencies": { + "@bem/sdk.entity-name": "^0.2.11" + }, + "description": "Parses slugs of BEM entities", + "devDependencies": {}, + "directories": {}, + "dist": { + "fileCount": 5, + "integrity": "sha512-+2Fckk+JltPLxpNXqE4Sa+RUsW6aimuqXZ0fdRmyS+exKc+UR5GTBWtigqLqo/xydHFw7SOFmxC4z4inmDdKng==", + "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVv98CRA9TVsSAnZWagAAd54P/0VaYYTuvz2rr/VP1xZ5\nk9VZY4JFhYj+UfUFfW8+7Q4eM/FizSoE65TybBw4heFgL4a/xxZlKK8vg7/6\n60EuKtcOE9/+np4skYsPW2nHd018ieBzRyvZY9TvIGkf5Sc0j3Ika1K47VQ/\n//aKRZZmLvIp5Chr9D0rN7JFBcu6lWxebL0Smb9YNPSc6GrUpHwgW5qYNrMQ\nAL6N6AH0XezAXUfqvQBqsxRzQwYLRm6j1VEHMX//UUVP/u+R4WpbgRSHMQsR\na/JeGJJhIv8JwwesRokvk1XTXytqcH+NnxI7AELYc5C9c3KarGOV7g+s0cs4\nAvyUCCtqrvlATh3hCLPWyX/IzkAoGtrSmIpBiyZwNXX3JGQgNN862W+ce2+g\nzf6a0KDOAp/RrH16MwTsvr0AfV7pRizux7wehthXmZDAjEfyULId1hh2xYFo\nOR1Z/wBL7A2uI7OROP5S37CwDRSsUUxWYf2ysnqjOyB5PinpJ4wJJAWFW9Nm\ni/HAfMIHK+rObZqUnZAjfniU4/q9qDHNAlWESsOeVUZ9LUvxEWHQqI0YwAIt\nweI2G+woNUNP1CF/o0dLjdrvzqk8kvofCWTtTPKho8CTTMvEc1DUoylaqDhq\nOzwXNDcOGhNonvzW0ckHGa/koELyOF7uldhr9Atm+YVHKik9VPSHTcmL+7Yi\nwFS/\r\n=V4gP\r\n-----END PGP SIGNATURE-----\r\n", + "shasum": "ecc7413bba3b4a41ba8db4dee20a18874c7fee0f", + "tarball": "https://registry.npmjs.org/@bem/sdk.naming.entity.parse/-/sdk.naming.entity.parse-0.2.9.tgz", + "unpackedSize": 29636 + }, + "engines": { + "node": ">= 8.0" + }, + "gitHead": "1ec9066d241303e5dc2abc01171f111effffff3a", + "homepage": "https://github.com/bem/bem-sdk/tree/master/packages/naming.entity.parse#readme", + "keywords": [ + "bem", + "entity", + "name", + "naming", + "parse", + "representation" + ], + "license": "MPL-2.0", + "main": "index.js", + "maintainers": [ + { + "name": "blond", + "email": "mail@blond.im" + }, + { + "name": "qfox", + "email": "zxqfox@gmail.com" + }, + { + "name": "tadatuta", + "email": "i@tadatuta.com" + }, + { + "name": "veged", + "email": "veged@ya.ru" + }, + { + "name": "vithar", + "email": "vitaly@harisov.name" + }, + { + "name": "yeti-or", + "email": "yeti.or@gmail.com" + } + ], + "name": "@bem/sdk.naming.entity.parse", + "optionalDependencies": {}, + "publishConfig": { + "access": "public" + }, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/bem/bem-sdk.git" + }, + "scripts": { + "bench": "matcha benchmark/*.js", + "test": "exit 0" + }, + "version": "0.2.9" +} diff --git a/node_modules/@bem/sdk.naming.entity.stringify/CHANGELOG.md b/node_modules/@bem/sdk.naming.entity.stringify/CHANGELOG.md new file mode 100644 index 0000000..b2756a2 --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity.stringify/CHANGELOG.md @@ -0,0 +1,113 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [1.1.2](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.stringify@1.1.1...@bem/sdk.naming.entity.stringify@1.1.2) (2019-02-03) + +**Note:** Version bump only for package @bem/sdk.naming.entity.stringify + + + + + + +## [1.1.1](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.stringify@1.1.0...@bem/sdk.naming.entity.stringify@1.1.1) (2018-07-16) + + +### Bug Fixes + +* **naming.entity.stringify:** remove assert ([ab1854c](https://github.com/bem/bem-sdk/commit/ab1854c)) + + + + + +# [1.1.0](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.stringify@1.0.3...@bem/sdk.naming.entity.stringify@1.1.0) (2018-07-01) + + +### Features + +* **naming.entity.stringify:** add stringifyWrapper export ([ad3b0f9](https://github.com/bem/bem-sdk/commit/ad3b0f9)) + + + + + +## [1.0.3](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.stringify@1.0.2...@bem/sdk.naming.entity.stringify@1.0.3) (2018-04-17) + + +### Bug Fixes + +* degradate to es5 for entity.stringify ([ad4f8c1](https://github.com/bem/bem-sdk/commit/ad4f8c1)) + + + + + +## [1.0.2](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.stringify@1.0.1...@bem/sdk.naming.entity.stringify@1.0.2) (2018-04-17) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity.stringify + + +## [1.0.1](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.stringify@1.0.0...@bem/sdk.naming.entity.stringify@1.0.1) (2017-12-16) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity.stringify + + +# [1.0.0](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.stringify@0.2.2...@bem/sdk.naming.entity.stringify@1.0.0) (2017-12-12) + + +### Bug Fixes + +* **naming.entity.stringify:** change node-assert to console.assert ([781aaf9](https://github.com/bem/bem-sdk/commit/781aaf9)) +* **naming.entity.stringify:** purify method ([1c451c7](https://github.com/bem/bem-sdk/commit/1c451c7)) + + +### BREAKING CHANGES + +* **naming.entity.stringify:** Remove normalization logic from the method + + + + + +## [0.2.2](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.stringify@0.2.0...@bem/sdk.naming.entity.stringify@0.2.2) (2017-11-07) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity.stringify + + +## [0.2.1](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity.stringify@0.2.0...@bem/sdk.naming.entity.stringify@0.2.1) (2017-10-02) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity.stringify + + +# 0.2.0 (2017-10-01) + + +### Features + +* split bem-naming to naming.entity.* packages ([0bf481d](https://github.com/bem/bem-sdk/commit/0bf481d)) + + + + + +# 0.1.0 (2017-09-30) + + +### Features + +* split bem-naming to naming.entity.* packages ([0bf481d](https://github.com/bem/bem-sdk/commit/0bf481d)) diff --git a/node_modules/@bem/sdk.naming.entity.stringify/LICENSE.txt b/node_modules/@bem/sdk.naming.entity.stringify/LICENSE.txt new file mode 100644 index 0000000..6fb499b --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity.stringify/LICENSE.txt @@ -0,0 +1,369 @@ +© YANDEX LLC, 2017-present + +The Source Code called `@bem/sdk.naming.entity.stringify` available at https://github.com/bem/bem-sdk/tree/master/packages/naming.entity.stringify is subject to the terms of the Mozilla Public License, v. 2.0 (hereinafter - MPL). The text of MPL is the following: + +Mozilla Public License, version 2.0 + +1. Definitions + +1.1. "Contributor" + + means each individual or legal entity that creates, contributes to the + creation of, or owns Covered Software. + +1.2. "Contributor Version" + + means the combination of the Contributions of others (if any) used by a + Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + + means Source Code Form to which the initial Contributor has attached the + notice in Exhibit A, the Executable Form of such Source Code Form, and + Modifications of such Source Code Form, in each case including portions + thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + a. that the initial Contributor has attached the notice described in + Exhibit B to the Covered Software; or + + b. that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the terms of + a Secondary License. + +1.6. "Executable Form" + + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + + means a work that combines Covered Software with other material, in a + separate file or files, that is not Covered Software. + +1.8. "License" + + means this document. + +1.9. "Licensable" + + means having the right to grant, to the maximum extent possible, whether + at the time of the initial grant or subsequently, any and all of the + rights conveyed by this License. + +1.10. "Modifications" + + means any of the following: + + a. any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered Software; or + + b. any new file in Source Code Form that contains any Covered Software. + +1.11. "Patent Claims" of a Contributor + + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the License, + by the making, using, selling, offering for sale, having made, import, + or transfer of either its Contributions or its Contributor Version. + +1.12. "Secondary License" + + means either the GNU General Public License, Version 2.0, the GNU Lesser + General Public License, Version 2.1, the GNU Affero General Public + License, Version 3.0, or any later versions of those licenses. + +1.13. "Source Code Form" + + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that controls, is + controlled by, or is under common control with You. For purposes of this + definition, "control" means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by contract or + otherwise, or (b) ownership of more than fifty percent (50%) of the + outstanding shares or beneficial ownership of such entity. + + +2. License Grants and Conditions + +2.1. Grants + + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + a. under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + + b. under Patent Claims of such Contributor to make, use, sell, offer for + sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + + The licenses granted in Section 2.1 with respect to any Contribution + become effective for each Contribution on the date the Contributor first + distributes such Contribution. + +2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under + this License. No additional rights or licenses will be implied from the + distribution or licensing of Covered Software under this License. + Notwithstanding Section 2.1(b) above, no patent license is granted by a + Contributor: + + a. for any code that a Contributor has removed from Covered Software; or + + b. for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + c. under Patent Claims infringed by Covered Software in the absence of + its Contributions. + + This License does not grant any rights in the trademarks, service marks, + or logos of any Contributor (except as may be necessary to comply with + the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this + License (see Section 10.2) or under the terms of a Secondary License (if + permitted under the terms of Section 3.3). + +2.5. Representation + + Each Contributor represents that the Contributor believes its + Contributions are its original creation(s) or it has sufficient rights to + grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + + This License is not intended to limit any rights You have under + applicable copyright doctrines of fair use, fair dealing, or other + equivalents. + +2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in + Section 2.1. + + +3. Responsibilities + +3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under + the terms of this License. You must inform recipients that the Source + Code Form of the Covered Software is governed by the terms of this + License, and how they can obtain a copy of this License. You may not + attempt to alter or restrict the recipients' rights in the Source Code + Form. + +3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + a. such Covered Software must also be made available in Source Code Form, + as described in Section 3.1, and You must inform recipients of the + Executable Form how they can obtain a copy of such Source Code Form by + reasonable means in a timely manner, at a charge no more than the cost + of distribution to the recipient; and + + b. You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter the + recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for + the Covered Software. If the Larger Work is a combination of Covered + Software with a work governed by one or more Secondary Licenses, and the + Covered Software is not Incompatible With Secondary Licenses, this + License permits You to additionally distribute such Covered Software + under the terms of such Secondary License(s), so that the recipient of + the Larger Work may, at their option, further distribute the Covered + Software under the terms of either this License or such Secondary + License(s). + +3.4. Notices + + You may not remove or alter the substance of any license notices + (including copyright notices, patent notices, disclaimers of warranty, or + limitations of liability) contained within the Source Code Form of the + Covered Software, except that You may alter any license notices to the + extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on + behalf of any Contributor. You must make it absolutely clear that any + such warranty, support, indemnity, or liability obligation is offered by + You alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + + If it is impossible for You to comply with any of the terms of this License + with respect to some or all of the Covered Software due to statute, + judicial order, or regulation then You must: (a) comply with the terms of + this License to the maximum extent possible; and (b) describe the + limitations and the code they affect. Such description must be placed in a + text file included with all distributions of the Covered Software under + this License. Except to the extent prohibited by statute or regulation, + such description must be sufficiently detailed for a recipient of ordinary + skill to be able to understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically if You + fail to comply with any of its terms. However, if You become compliant, + then the rights granted under this License from a particular Contributor + are reinstated (a) provisionally, unless and until such Contributor + explicitly and finally terminates Your grants, and (b) on an ongoing + basis, if such Contributor fails to notify You of the non-compliance by + some reasonable means prior to 60 days after You have come back into + compliance. Moreover, Your grants from a particular Contributor are + reinstated on an ongoing basis if such Contributor notifies You of the + non-compliance by some reasonable means, this is the first time You have + received notice of non-compliance with this License from such + Contributor, and You become compliant prior to 30 days after Your receipt + of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, + counter-claims, and cross-claims) alleging that a Contributor Version + directly or indirectly infringes any patent, then the rights granted to + You by any and all Contributors for the Covered Software under Section + 2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user + license agreements (excluding distributors and resellers) which have been + validly granted by You or Your distributors under this License prior to + termination shall survive termination. + +6. Disclaimer of Warranty + + Covered Software is provided under this License on an "as is" basis, + without warranty of any kind, either expressed, implied, or statutory, + including, without limitation, warranties that the Covered Software is free + of defects, merchantable, fit for a particular purpose or non-infringing. + The entire risk as to the quality and performance of the Covered Software + is with You. Should any Covered Software prove defective in any respect, + You (not any Contributor) assume the cost of any necessary servicing, + repair, or correction. This disclaimer of warranty constitutes an essential + part of this License. No use of any Covered Software is authorized under + this License except under this disclaimer. + +7. Limitation of Liability + + Under no circumstances and under no legal theory, whether tort (including + negligence), contract, or otherwise, shall any Contributor, or anyone who + distributes Covered Software as permitted above, be liable to You for any + direct, indirect, special, incidental, or consequential damages of any + character including, without limitation, damages for lost profits, loss of + goodwill, work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses, even if such party shall have been + informed of the possibility of such damages. This limitation of liability + shall not apply to liability for death or personal injury resulting from + such party's negligence to the extent applicable law prohibits such + limitation. Some jurisdictions do not allow the exclusion or limitation of + incidental or consequential damages, so this exclusion and limitation may + not apply to You. + +8. Litigation + + Any litigation relating to this License may be brought only in the courts + of a jurisdiction where the defendant maintains its principal place of + business and such litigation shall be governed by laws of that + jurisdiction, without reference to its conflict-of-law provisions. Nothing + in this Section shall prevent a party's ability to bring cross-claims or + counter-claims. + +9. Miscellaneous + + This License represents the complete agreement concerning the subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. Any law or regulation which provides that + the language of a contract shall be construed against the drafter shall not + be used to construe this License against a Contributor. + + +10. Versions of the License + +10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + +10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version + of the License under which You originally received the Covered Software, + or under the terms of any subsequent version published by the license + steward. + +10.3. Modified Versions + + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a + modified version of this License if you rename the license and remove + any references to the name of the license steward (except to note that + such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary + Licenses If You choose to distribute Source Code Form that is + Incompatible With Secondary Licenses under the terms of this version of + the License, the notice described in Exhibit B of this License must be + attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the + terms of the Mozilla Public License, v. + 2.0. If a copy of the MPL was not + distributed with this file, You can + obtain one at + http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, +then You may include the notice in a location (such as a LICENSE file in a +relevant directory) where a recipient would be likely to look for such a +notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice + + This Source Code Form is "Incompatible + With Secondary Licenses", as defined by + the Mozilla Public License, v. 2.0. + + +A copy of the MPL is also available at http://mozilla.org/MPL/2.0/. diff --git a/node_modules/@bem/sdk.naming.entity.stringify/README.md b/node_modules/@bem/sdk.naming.entity.stringify/README.md new file mode 100644 index 0000000..b1f81a2 --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity.stringify/README.md @@ -0,0 +1,154 @@ +# stringify + +Stringifier for a [BEM entity](https://bem.info/methodology/key-concepts/#bem-entity) representation. + +[![NPM Status][npm-img]][npm] + +[npm]: https://www.npmjs.org/package/@bem/sdk.naming.entity.stringify +[npm-img]: https://img.shields.io/npm/v/@bem/sdk.naming.entity.stringify.svg + +* [Introduction](#introduction) +* [Try stringify](#try-stringify) +* [Quick start](#quick-start) +* [API reference](#api-reference) +* [Parameter tuning](#parameter-tuning) + +## Introduction + +Stringify returns a string with the name of the specified BEM entity representation. This name can be used in class attributes. + +You can choose which [naming convention](https://en.bem.info/methodology/naming-convention/) to use for creating a `stingify()` function. + +> **Note.** If you don't have any BEM projects available to try out the `@bem/sdk.naming.entity.stringify` package, the quickest way to create one is to use [bem-express](https://github.com/bem/bem-express). + +## Try stringify + +An example is available in the [RunKit editor](https://runkit.com/migs911/how-bem-sdk-naming-entity-stringify-works). + +## Quick start + +> **Attention.** To use `@bem/sdk.naming.entity.stringify`, you must install [Node.js 8.0+](https://nodejs.org/en/download/). + +To run the `@bem/sdk.naming.entity.stringify` package: + +1. [Install required packages](#installing-required-packages). +3. [Create a stringify() function](#creating-a-stringify-function). +4. [Make a string from a BEM entity](#creating-a-string-from-a-bem-entity-name). + +### Installing required packages + +Install the following packages: + +* [@bem/sdk.naming.entity.stringify](https://www.npmjs.org/package/@bem/sdk.naming.entity.stringify), which contains the `stringify()` function. +* [@bem/sdk.naming.presets](https://www.npmjs.com/package/@bem/sdk.naming.presets), which contains presets with well-known naming conventions. + +To install the packages, run the following command: + +``` +$ npm install --save @bem/sdk.naming.entity.stringify @bem/sdk.naming.presets +``` + +### Creating a `stringify()` function + +Create a JavaScript file with any name (for example, **app.js**) and do the following: + +1. Choose the [naming convention](https://bem.info/methodology/naming-convention/) and import the preset with this convention (for example, origin naming convention). +1. Import the `@bem/sdk.naming.entity.stringify` package and create the `stringify()` function using the imported preset: + +```js +const originNaming = require('@bem/sdk.naming.presets/origin'); +const stringify = require('@bem/sdk.naming.entity.stringify')(originNaming); +``` + +### Creating a string from a BEM entity name + +Stringify an object representation of a BEM entity: + +```js +stringify({ block: 'my-block', mod: 'my-modifier' }); +``` + +This function will return the string `my-block_my-modifier`. + +**Example**: + +```js +const originNaming = require('@bem/sdk.naming.presets/origin'); +const stringify = require('@bem/sdk.naming.entity.stringify')(originNaming); + +console.log(stringify({ block: 'my-block', mod: 'my-modifier' })); +// => my-block_my-modifier + +console.log(stringify({ block: 'my-block', mod: { name: 'my-modifier'}})); +// => my-block_my-modifier + +console.log(stringify({ block: 'my-block', + mod: { name: 'my-modifier', val: 'some-value'}})); +// => my-block__my-modifier_some-value + +console.log(stringify({ block: 'my-block', elem: 'my-element' })); +// => my-block__my-element + +console.log(stringify({ block: 'my-block', + elem: 'my-element', + mod: 'my-modifier'})); +// => my-block__my-element_my-modifier + +console.log(stringify({ block: 'my-block', + elem: 'my-element', + mod: { name: 'my-modifier', val: 'some-value'}})); +// => my-block__my-element_my-modifier_some-value +``` + +[RunKit live example](https://runkit.com/migs911/stringify-using-origin-convention). + +## API reference + +### stringify() + +Forms a string based on the object representation of a BEM entity. + +```js +/** + * @typedef BemEntityName + * @property {string} block — Block name. + * @property {string} [elem] — Element name. + * @property {string|Object} [mod] — Modifier name or object with name and value. + * @property {string} mod.name — Modifier name. + * @property {string|boolean} [mod.val] — Modifier value. + */ + +/** + * @param {object|BemEntityName} entity — Object representation of the BEM entity. + * @returns {string} — Name of the BEM entity. This name can be used in class attributes. + */ +stringify(entity); +``` + +## Parameter tuning + +### Using a custom naming convention + +Specify an [INamingConvention](https://github.com/bem/bem-sdk/blob/master/packages/naming.presets/index.d.ts#L10) object with the `delims` field, which defines the delimiters that are used to separate names in the naming convention. + +Use this object to make your `stringify()` function. + +**Example:** + +```js +const convention = { + delims: { + elem: '_EL-', + mod: { + name: '_MOD-', + val: '-' + }}}; +const stringify = require('@bem/sdk.naming.entity.stringify')(convention); + +console.log(stringify({ block: 'myBlock', + elem: 'myElement', + mod: 'myModifier'})); +// => myBlock_EL-myElement_MOD-myModifier +``` + +[RunKit live example](https://runkit.com/migs911/stringify-usage-examples-custom-naming-convention). diff --git a/node_modules/@bem/sdk.naming.entity.stringify/index.d.ts b/node_modules/@bem/sdk.naming.entity.stringify/index.d.ts new file mode 100644 index 0000000..ff740fb --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity.stringify/index.d.ts @@ -0,0 +1,7 @@ +declare module '@bem/sdk.naming.entity.stringify' { + import { INamingConvention } from '@bem/sdk.naming.presets'; + import { EntityName } from '@bem/sdk.entity-name'; + + export type Stringify = (entity: EntityName.IOptions) => string; + export function stringifyWrapper(convention: INamingConvention): Stringify; +} diff --git a/node_modules/@bem/sdk.naming.entity.stringify/index.js b/node_modules/@bem/sdk.naming.entity.stringify/index.js new file mode 100644 index 0000000..90dbc63 --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity.stringify/index.js @@ -0,0 +1,54 @@ +'use strict'; + +/** + * Forms a string according to object representation of BEM entity. + * + * @param {Object|BemEntityName} entity - object representation of BEM entity. + * @param {INamingConventionDelims} delims - separates entity names from each other. + * @returns {String} + */ +function stringify(entity, delims) { + if (!entity || !entity.block) { + return ''; + } + + var res = [entity.block]; + + if (entity.elem !== undefined) { + res.push(delims.elem, entity.elem); + } + + var mod = entity.mod; + if (mod !== undefined) { + var val = mod.val; + if (typeof mod === 'string') { + res.push(delims.mod.name, mod); + } else if (val || !('val' in mod)) { + res.push(delims.mod.name, mod.name); + + if (val && val !== true) { + res.push(delims.mod.val, val); + } + } + } + + return res.join(''); +} + +/** + * Creates `stringify` function for specified naming convention. + * + * @param {INamingConvention} convention - options for naming convention. + * @returns {Function} + */ +function stringifyWrapper(convention) { + // TODO: https://github.com/bem/bem-sdk/issues/326 + // console.assert(convention.delims && convention.delims.elem && convention.delims.mod, + // '@bem/sdk.naming.entity.stringify: convention should be an instance of BemNamingEntityConvention'); + return function (entity) { + return stringify(entity, convention.delims); + }; +} + +module.exports = stringifyWrapper; +module.exports.stringifyWrapper = stringifyWrapper; diff --git a/node_modules/@bem/sdk.naming.entity.stringify/package.json b/node_modules/@bem/sdk.naming.entity.stringify/package.json new file mode 100644 index 0000000..9f249ab --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity.stringify/package.json @@ -0,0 +1,121 @@ +{ + "_args": [ + [ + "@bem/sdk.naming.entity.stringify@^1.1.2", + "/mnt/c/users/1/Documents/Frontend/task2/node_modules/@bem/sdk.naming.entity" + ] + ], + "_from": "@bem/sdk.naming.entity.stringify@>=1.1.2 <2.0.0", + "_hasShrinkwrap": false, + "_id": "@bem/sdk.naming.entity.stringify@1.1.2", + "_inCache": true, + "_installable": true, + "_location": "/@bem/sdk.naming.entity.stringify", + "_nodeVersion": "8.6.0", + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/sdk.naming.entity.stringify_1.1.2_1549205361381_0.6137797034512613" + }, + "_npmUser": { + "email": "zxqfox@gmail.com", + "name": "qfox" + }, + "_npmVersion": "lerna/3.10.5/node@v8.6.0+x64 (darwin)", + "_phantomChildren": {}, + "_requested": { + "name": "@bem/sdk.naming.entity.stringify", + "raw": "@bem/sdk.naming.entity.stringify@^1.1.2", + "rawSpec": "^1.1.2", + "scope": "@bem", + "spec": ">=1.1.2 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/@bem/sdk.entity-name", + "/@bem/sdk.naming.entity" + ], + "_resolved": "https://registry.npmjs.org/@bem/sdk.naming.entity.stringify/-/sdk.naming.entity.stringify-1.1.2.tgz", + "_shasum": "ed0419af86e9de087939f5fff35d7e028036bd27", + "_shrinkwrap": null, + "_spec": "@bem/sdk.naming.entity.stringify@^1.1.2", + "_where": "/mnt/c/users/1/Documents/Frontend/task2/node_modules/@bem/sdk.naming.entity", + "author": { + "email": "mail@blond.im", + "name": "Andrew Abramov" + }, + "bugs": { + "url": "https://github.com/bem/bem-sdk/issues?q=label%3Apkg%3Anaming.entity.stringify" + }, + "dependencies": {}, + "description": "Stringifier for BEM entities", + "devDependencies": { + "@bem/sdk.entity-name": "^0.2.11", + "@bem/sdk.naming.presets": "^0.0.9" + }, + "directories": {}, + "dist": { + "fileCount": 6, + "integrity": "sha512-tPK1DZDIpTG5tCn2mqhfY7rwvL4ALwTeoWxtcFHwfoFruzofJYbPhKUeHZaRO0NOHs/TROOQJmoaUYESDCWH/w==", + "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVv9yCRA9TVsSAnZWagAALdoP/0SAZU+ipjees/96/6r6\nzMukKn02zrlS/PpHzg/gnq8V5XwzDNeT6LlSSDneFoQYhHLTml1W1pI4tpLm\nJ6VUgyYvT6wztr5t4NdGNlKUVVwQw90hwkYaoIoj5R4XtesdfQHFmIR+OWww\nAIH6Wcd2f6VoEx/r2lEjrvMn3SnqybmVivrJEbMfVtg/9TWxN/Ouz8oLMEoh\n9Ow2TToBsUegyr7RiwFRdlFryQmJaGDtwH4LCm5PnEFLHd/5n43QsxcytJR0\nscp7oBcZI28a1Lm1DBLuf6NI3gfV00uj4xxIqz/YjhrrRrXGhPnMYAvVmGLx\nbVXQ6z1dvl2J37UuBd4RNxdwUfqiYVWkwtmtP6HnI+Cs4Sy29rahfsRJDtxF\nbPO8ovzTDTD/G9RxDHoia2HzQLjXF8XGTbuy4DeinxF/bV1d1dVFs2zsl/Nx\ncCb3YPXhcYOj91A2eG+8p9hYUwBbS9TwurUU1jEF4Ut66Bn1bodP/D6J3BnG\nv7ThUUIYCc9eyvXRcxRcCCQlI4q0AUcM2wFa5E32zEhFKhJNJWtbNRNaH25V\nQuO79SbMke/Dtc1MIh+N6EX9pmVBQ/kFfVRngCi+zWdR2Vakn8uYzv3V+bBr\n+moMFmBl0sVzM+sAv7cYGwOiOURlvmC0eKr9zTWvuNcY2EhXYQr9CPFxCRQ4\nF3mk\r\n=Bkmb\r\n-----END PGP SIGNATURE-----\r\n", + "shasum": "ed0419af86e9de087939f5fff35d7e028036bd27", + "tarball": "https://registry.npmjs.org/@bem/sdk.naming.entity.stringify/-/sdk.naming.entity.stringify-1.1.2.tgz", + "unpackedSize": 27630 + }, + "engines": { + "node": ">= 8.0" + }, + "gitHead": "1ec9066d241303e5dc2abc01171f111effffff3a", + "homepage": "https://github.com/bem/bem-sdk/tree/master/packages/naming.entity.stringify#readme", + "keywords": [ + "bem", + "entity", + "name", + "naming", + "representation", + "stringify" + ], + "license": "MPL-2.0", + "main": "index.js", + "maintainers": [ + { + "name": "blond", + "email": "mail@blond.im" + }, + { + "name": "qfox", + "email": "zxqfox@gmail.com" + }, + { + "name": "tadatuta", + "email": "i@tadatuta.com" + }, + { + "name": "veged", + "email": "veged@ya.ru" + }, + { + "name": "vithar", + "email": "vitaly@harisov.name" + }, + { + "name": "yeti-or", + "email": "yeti.or@gmail.com" + } + ], + "name": "@bem/sdk.naming.entity.stringify", + "optionalDependencies": {}, + "publishConfig": { + "access": "public" + }, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/bem/bem-sdk.git" + }, + "scripts": { + "bench": "matcha benchmark/*.js", + "test": "nyc mocha" + }, + "typings": "index.d.ts", + "version": "1.1.2" +} diff --git a/node_modules/@bem/sdk.naming.entity/CHANGELOG.md b/node_modules/@bem/sdk.naming.entity/CHANGELOG.md new file mode 100644 index 0000000..9864fd5 --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity/CHANGELOG.md @@ -0,0 +1,666 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.2.11](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity@0.2.10...@bem/sdk.naming.entity@0.2.11) (2019-02-03) + +**Note:** Version bump only for package @bem/sdk.naming.entity + + + + + + +## [0.2.10](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity@0.2.9...@bem/sdk.naming.entity@0.2.10) (2018-07-16) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity + + +## [0.2.9](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity@0.2.8...@bem/sdk.naming.entity@0.2.9) (2018-07-12) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity + + +## [0.2.8](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity@0.2.6...@bem/sdk.naming.entity@0.2.8) (2018-07-01) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity + + +## [0.2.6](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity@0.2.5...@bem/sdk.naming.entity@0.2.6) (2018-04-17) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity + + +## [0.2.5](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity@0.2.4...@bem/sdk.naming.entity@0.2.5) (2018-04-17) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity + + +## [0.2.4](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity@0.2.3...@bem/sdk.naming.entity@0.2.4) (2017-12-16) + + +### Bug Fixes + +* **walk:** resolve cycle dependency ([9e8d925](https://github.com/bem/bem-sdk/commit/9e8d925)) + + + + + +## [0.2.3](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity@0.2.2...@bem/sdk.naming.entity@0.2.3) (2017-12-12) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity + + +## [0.2.2](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity@0.2.0...@bem/sdk.naming.entity@0.2.2) (2017-11-07) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity + + +## [0.2.1](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.entity@0.2.0...@bem/sdk.naming.entity@0.2.1) (2017-10-02) + + + + +**Note:** Version bump only for package @bem/sdk.naming.entity + + +# 0.2.0 (2017-10-01) + + +### Features + +* split bem-naming to naming.entity.* packages ([0bf481d](https://github.com/bem/bem-sdk/commit/0bf481d)) + + + + + +# 0.1.0 (2017-09-30) + + +### Features + +* split bem-naming to naming.entity.* packages ([0bf481d](https://github.com/bem/bem-sdk/commit/0bf481d)) + + + + +Changelog +========= + +2.0.0 +----- + +### BEM SDK + +The `bem-naming` became part of the [BEM SDK](https://github.com/bem/bem-sdk). In this regard, there have been several changes for consistency with other packages of BEM SDK. + +Now BEM SDK modules are used in assembly systems and `bem-tools` plugins. Therefore, the modules support `Node.js` only. + +* Removed support of `YModules` and `AMD` (@blond [#138]). +* Stopped publishing to `Bower` (@blond [#118]). + +If it becomes necessary to use BEM SDK in browsers or other environments we'll figure out a system solution for all modules. + +[#138]: https://github.com/bem/bem-sdk/issues/138 +[#118]: https://github.com/bem/bem-sdk/issues/118 + +### API + +According to the principles of BEM SDK each module solves only one problem. + +The `bem-naming` module did more than just `parse` and `stringify` BEM names. + +#### Removed `typeOf` method ([#98]) + +To work with BEM entities there is package [@bem/sdk.entity-name](https://github.com/bem/bem-sdk/tree/master/packages/entity-name). + +**API v1.x.x** + +```js +const bemNaming = require('bem-naming'); + +// get type by string +bemNaming.typeOf('button'); // block + +// get type by entity object +bemNaming.typeOf({ block: 'button', modName: 'focused' }); // blockMod +``` + +**API v2.x.x** + +```js +// get type by string +const parseBemName = require('@bem/naming').parse; +const blockName = parseBemName('button'); + +blockName.type // block + +// get type by entity object +const BemEntityName = require('@bem/sdk.entity-name'); +const modName = new BemEntityName({ block: 'button', mod: 'focused' }); + +modName.type; // blockMod +``` + +[#98]: https://github.com/bem/bem-sdk/issues/98 + +#### Removed `validate` method ([#147]) + +Use `parse` method instead. + +**API v1.x.x** + +```js +const validate = require('bem-naming').validate; + +validate('block-name'); // true +validate('^*^'); // false +``` + +**API v2.x.x** + +```js +const parse = require('@bem/naming').parse; + +Boolean(parse('block-name')); // true +Boolean(parse('^*^')); // false +``` + +[#147]: https://github.com/bem/bem-sdk/issues/147 + +#### The `parse` method returns [BemEntityName](https://github.com/bem/bem-sdk/tree/master/packages/entity-name) object ([#126]). + +It will allow to use helpers of `BemEntityName`. + +**Important:** in `BemEntityName` the `modName` and `modVal` fields are deprecated. Use the `mod` field instead ([#95]). + +**API v1.x.x** + +```js +const parse = require('bem-naming').parse; + +const entityName = parse('button_disabled'); + +entityName.modName; // disabled +entityName.modVal; // true + +console.log(entityName); // { block: 'button', modName: 'disabled', modVal: true } +``` + +**API v2.x.x** + +```js +const parse = require('@bem/naming').parse; + +const entityName = parse('button_disabled'); + +entityName.mod; // { name: 'disabled', val: true } +entityName.id; // button_disabled +entityName.type; // mod + +console.log(entityName); // BemEntityName { block: 'button', mod: { name: 'disabled', val: true } } +``` + +[#126]: https://github.com/bem/bem-sdk/issues/126 +[#95]: https://github.com/bem/bem-sdk/issues/95 + +#### The `stringify` method supports [BemEntityName](https://github.com/bem/bem-sdk/tree/master/packages/entity-name) instance ([#152]). + +**Important:** in `BemEntityName` the `modName` and `modVal` fields are deprecated. Use the `mod` field instead ([#95]). + +**API v1.x.x** + +```js +const stringify = require('bem-naming').stringify; + +stringify({ block: 'button', modName: 'disabled', modVal: true }); + +// ➜ button_disabled +``` + +**API v2.x.x** + +```js +const stringify = require('@bem/naming').stringify; +const BemEntityName = require('@bem/sdk.entity-name'); + +const entityName = new BemEntityName({ block: 'button', mod: 'disabled' }); + +stringify(entityName); + +// ➜ button_disabled +``` + +[#152]: https://github.com/bem/bem-sdk/issues/152 +[#95]: https://github.com/bem/bem-sdk/issues/95 + +#### The `bem-naming` constructor signature for custom-naming was changed ([#160]). + +`{ elem: '…', mod: '…' }` → `{ delims: { elem: '…', mod: '…' } }` + +**API v1.x.x** + +```js +const bemNaming = require('bem-naming'); + +const myNaming = bemNaming({ +elem: '-', +mod: { name: '--', val: '_' } +wordPattern: '[a-zA-Z0-9]+' +}); + +myNaming.parse('block--mod_val'); // { block: 'block' + // modName: 'mod', + // modVal: 'val' } +``` + +**API v2.x.x** + +```js +const bemNaming = require('@bem/naming'); + +const myNaming = bemNaming({ +delims: { +elem: '-', +mod: { name: '--', val: '_' } +}, +wordPattern: '[a-zA-Z0-9]+' +}); + +myNaming.parse('block--mod_val'); // BemEntityName + // { block: 'block', + // mod: { name: 'mod', val: 'val' } } +``` + +**Important:** now if the delimiter of modifier value is not specified it doesn't inherit from delimiter of modifier name and falls back to default `bemNaming.modValDelim` ([#169]). + +**API v1.x.x** + +```js +const bemNaming = require('bem-naming'); + +// myNaming1 is equal myNaming2 +const myNaming1 = bemNaming({ mod: { name: '--' } }); +const myNaming2 = bemNaming({ mod: { name: '--', val: '--' } }); +``` + +**API v2.x.x** + +```js +const bemNaming = require('@bem/naming'); + +// myNaming1 is equal myNaming2 +const myNaming1 = bemNaming({ delims: { mod: '--' } }); +const myNaming2 = bemNaming({ delims: { mod: { name: '--', val: '--' } } }); + +// but myNaming1 is not equal myNaming3 +const myNaming3 = bemNaming({ delims: { mod: { name: '--' } } }); +// because myNaming3 is equal myNaming4 +const myNaming4 = bemNaming({ delims: { mod: { name: '--', val: bemNaming.modValDelim } } }); +``` + +[#160]: https://github.com/bem/bem-sdk/pull/160 +[#169]: https://github.com/bem/bem-sdk/pull/169 + +#### Delims field ([#167]). + +Added `delims` field instead of `elemDelim`, `modDelim` and `modValDelim` for consistency with [bemNaming](README.md#bemnaming-delims-elem-mod-wordpattern-) function. + +**API v1.x.x** + +```js +const bemNaming = require('bem-naming'); + +bemNaming.elemDelim +bemNaming.modDelim +bemNaming.modValDelim +``` + +**API v2.x.x** + +```js +const bemNaming = require('@bem/naming'); + +bemNaming.delims.elem +bemNaming.delims.mod.name +bemNaming.delims.mod.val +``` + +[#167]: https://github.com/bem/bem-sdk/pull/167 + +### NPM + +Now BEM SDK modules are published in `@bem` scope, so the `bem-naming` module was renamed to [@bem/naming](https://www.npmjs.org/package/@bem/naming) (@blond [#158]). + +> Read more about [scopes](https://docs.npmjs.com/misc/scope) in NPM Documentation. + +To install `1.x` version of the module you need to run the command: + +```shell +$ npm i bem-naming +``` + +To install `2.x` version of the module you need to run the command: + +```shell +$ npm i @bem/naming +``` + +[#158]: https://github.com/bem/bem-sdk/pull/158 + +### Presets + +* Added react preset (@yeti-or [#161]). + +[#161]: https://github.com/bem/bem-sdk/pull/161 + +### Performance + +* Accelerated initialization for `origin` naming (@tadatuta [#134]). + +[#134]: https://github.com/bem/bem-sdk/pull/134 + +### Chore + +* Moved the package to [bem-sdk](https://github.com/bem-sdk/tree/master/packages/sdk) organization (@blond [b22dfc5]). +* Removed Russian docs (@blond [#142]). +* Updated docs (@blond [#153]). +* Run tests in `Node.js` v6 (@blond [#114]). + +[#114]: https://github.com/bem/bem-sdk/pull/114 +[#142]: https://github.com/bem/bem-sdk/pull/142 +[#153]: https://github.com/bem/bem-sdk/pull/153 +[b22dfc5]: https://github.com/bem-sdk/tree/master/packages/naming/commit/b22dfc570aa3c99b9d5b6b335fd8eaa62e1f35c7 + +1.0.1 +----- + +## Bug fixes + +- Functions not working without context ([#91]). + +**Example:** + +```js + +var stringifyEntity = require('bem-naming').stringify; + +stringifyEntity({ block: 'button', modName: 'size', modVal: 's' }); + +// Uncaught TypeError: Cannot read property 'modDelim' of undefined +``` + +[#91]: https://github.com/bem/bem-naming/issues/91 + +### Commits + +* [[`ff861f691e`](https://github.com/Andrew Abramov /bem-naming/commit/ff861f691e)] - **fix**: functions should working without context (blond) +* [[`d5b735f2a4`](https://github.com/Andrew Abramov /bem-naming/commit/d5b735f2a4)] - **test**: use functions without context (blond) +* [[`12909e709b`](https://github.com/Andrew Abramov /bem-naming/commit/12909e709b)] - chore(package): update eslint to version 2.5.3 (greenkeeperio-bot) +* [[`ff8f65fc1a`](https://github.com/Andrew Abramov /bem-naming/commit/ff8f65fc1a)] - chore(package): update eslint to version 2.5.2 (greenkeeperio-bot) + +1.0.0 +----- + +### Modifier Delimiters ([#76]) + +Added support to separate value of modifier from name of modifier with specified string. + +Before one could only specify a string to separate name of a modifier from name of a block or an element. It string used to separate value of modifier from name of modifier. + +**Before:** + +```js +var myNaming = bemNaming({ +mod: '--' +}); + +var obj = { +block: 'block', +modName: 'mod', +modVal: 'val' +}; + +myNaming.stringify(obj); // 'block--mod--val' +``` + +**Now:** + +```js +var myNaming = bemNaming({ +mod: { name: '--', val: '_' } +}); + +var obj = { +block: 'block', +modName: 'mod', +modVal: 'val' +}; + +myNaming.stringify(obj); // 'block--mod_val' +``` + +Also added the [modValDelim](modValDelim) field. + +### Presets ([#81]) + +Added naming presets: +- `origin` (by default) — Yandex convention (`block__elem_mod_val`). +- `two-dashes` — [Harry Roberts convention](harry-roberts-convention) (`block__elem--mod_val`). + +It is nessesary not to pass all options every time you use the convention by Harry Roberts. + +```js +var bemNaming = require('bem-naming'); + +// with preset +var myNaming = bemNaming('two-dashes'); +``` + +## Bug fixes + +- Functions for custom naming not working without context([#72]). + +**Example:** + +```js + +var bemNaming = require('bem-naming'); + +var myNaming = bemNaming({ mod: '--' }); + +['block__elem', 'block--mod'].map(myNaming.parse); // The `parse` function requires context of `myNaming` object. + // To correct work Usage of bind (myNaming.parse.bind(myNaming)) // was necessary. +``` + +- `this` was used instead of global object. ([#86]). + +### Removed deprecated + +- The `BEMNaming` filed removed ([#74]). + +Use `bemNaming` function to create custom naming: + +```js +var bemNaming = require('bemNaming'); + +var myNaming = bemNaming({ elem: '__', mod: '--' }); +``` + +- The `elemSeparator`, `modSeparator` and `literal` options removed ([#75]). + +Use `elem`, `mod` and `wordPattern` instead. + +- The `bem-naming.min.js` file removed. + +### Other + +- The `stringify` method should return `undefined` for invalid objects, but not throw errror ([#71]). + +It will be easier to check for an empty string than use `try..catch`. + +**Before:** + +```js +try { +var str = bemNaming.stringify({ elem: 'elem' }); +} catch(e) { /* ... */ } +``` + +**Now:** + +```js +var str = bemNaming.stringify({ elem: 'elem' }); + +if (str) { +/* ... */ +} +``` + +[custom-naming-convention]: ./README.md#custom-naming-convention +[modValDelim]: ./README.md#modvaldelim +[harry-roberts-convention]: ./README.md#В-стиле-Гарри-Робертса + +[#86]: https://github.com/bem/bem-naming/pull/86 +[#81]: https://github.com/bem/bem-naming/pull/81 +[#76]: https://github.com/bem/bem-naming/pull/76 +[#75]: https://github.com/bem/bem-naming/pull/75 +[#74]: https://github.com/bem/bem-naming/pull/74 +[#72]: https://github.com/bem/bem-naming/pull/72 +[#71]: https://github.com/bem/bem-naming/pull/71 + +### Commits + +* [[`4c26980996`](https://github.com/Andrew Abramov /bem-naming/commit/4c26980996)] - style(browser): add `browser` env for eslint (blond) +* [[`b31f3c068c`](https://github.com/Andrew Abramov /bem-naming/commit/b31f3c068c)] - fix(global): use `window` and `global` instead of `this` (blond) +* [[`7d5cb11f27`](https://github.com/Andrew Abramov /bem-naming/commit/7d5cb11f27)] - docs(common-misconceptions): down info about common misconceptions (blond) +* [[`099ee42b2e`](https://github.com/Andrew Abramov /bem-naming/commit/099ee42b2e)] - docs(naming object): rename BEM-naming to naming object (blond) +* [[`2d7402429f`](https://github.com/Andrew Abramov /bem-naming/commit/2d7402429f)] - test(unknow preset): add test for unknown preset (blond) +* [[`01e680b4f8`](https://github.com/Andrew Abramov /bem-naming/commit/01e680b4f8)] - fix(unknow preset): throw error if preset is unknown (blond) +* [[`7273d172b3`](https://github.com/Andrew Abramov /bem-naming/commit/7273d172b3)] - style(jscs): remove strict options (blond) +* [[`063ccfe877`](https://github.com/Andrew Abramov /bem-naming/commit/063ccfe877)] - refactor(functionality): get rid of `BemNaming` class (blond) +* [[`509a816737`](https://github.com/Andrew Abramov /bem-naming/commit/509a816737)] - chore(package): update eslint to version 2.5.1 (greenkeeperio-bot) +* [[`beaabbe447`](https://github.com/Andrew Abramov /bem-naming/commit/beaabbe447)] - docs(presets): use `two-dashes` preset for convention by Harry Roberts (blond) +* [[`a2e7bd8da4`](https://github.com/Andrew Abramov /bem-naming/commit/a2e7bd8da4)] - test(presets): use presets (blond) +* [[`b93bd98407`](https://github.com/Andrew Abramov /bem-naming/commit/b93bd98407)] - feat(presets): add `two-dashes` preset (blond) +* [[`b225514e1c`](https://github.com/Andrew Abramov /bem-naming/commit/b225514e1c)] - refactor(test): rename `harry-roberts` to `two-dashes` preset (blond) +* [[`4f49550f46`](https://github.com/Andrew Abramov /bem-naming/commit/4f49550f46)] - docs(toc): add toc to readme (blond) +* [[`02c4094b59`](https://github.com/Andrew Abramov /bem-naming/commit/02c4094b59)] - docs(install): add info about install (blond) +* [[`5111759236`](https://github.com/Andrew Abramov /bem-naming/commit/5111759236)] - docs(usage): add info about usage (blond) +* [[`5b7b89770f`](https://github.com/Andrew Abramov /bem-naming/commit/5b7b89770f)] - docs(view): update view of readme (blond) +* [[`bf30206f03`](https://github.com/Andrew Abramov /bem-naming/commit/bf30206f03)] - chore(package): update coveralls to version 2.11.9 (greenkeeperio-bot) +* [[`a56e72f76d`](https://github.com/Andrew Abramov /bem-naming/commit/a56e72f76d)] - docs(harry-roberts): update Convention by Harry Roberts (blond) +* [[`da4497084b`](https://github.com/Andrew Abramov /bem-naming/commit/da4497084b)] - docs(mod): add docs for mod option as object (blond) +* [[`a05bf68d3c`](https://github.com/Andrew Abramov /bem-naming/commit/a05bf68d3c)] - docs(modValDelim): add docs about `modValDelim` field (blond) +* [[`a15ee5b7e9`](https://github.com/Andrew Abramov /bem-naming/commit/a15ee5b7e9)] - docs(nbsp): use normal spaces (blond) +* [[`6627261ccc`](https://github.com/Andrew Abramov /bem-naming/commit/6627261ccc)] - test(presets): update `harry-roberts` cases (blond) +* [[`d3e1ab464a`](https://github.com/Andrew Abramov /bem-naming/commit/d3e1ab464a)] - test(modValDelim): add tests for modValDelim field (blond) +* [[`326e375cd3`](https://github.com/Andrew Abramov /bem-naming/commit/326e375cd3)] - test(options): add tests for options processing (blond) +* [[`4c1c11e186`](https://github.com/Andrew Abramov /bem-naming/commit/4c1c11e186)] - feat(modVal): support custom modifier separator (blond) +* [[`c47b757340`](https://github.com/Andrew Abramov /bem-naming/commit/c47b757340)] - test(fields): add tests for delim fields (blond) +* [[`d5f5e92a7a`](https://github.com/Andrew Abramov /bem-naming/commit/d5f5e92a7a)] - fix(fields): does not delim fields (blond) +* [[`f512b06ee7`](https://github.com/Andrew Abramov /bem-naming/commit/f512b06ee7)] - fix(jsdoc): fix `BemNaming` jsdoc (blond) +* [[`9c0eab77cb`](https://github.com/Andrew Abramov /bem-naming/commit/9c0eab77cb)] - fix(BemNaming): simplify initialization (blond) +* [[`8750bc117b`](https://github.com/Andrew Abramov /bem-naming/commit/8750bc117b)] - fix(options): remove deprecated options (blond) +* [[`6e1a11de84`](https://github.com/Andrew Abramov /bem-naming/commit/6e1a11de84)] - fix(BEMNaming): remove `BEMNaming` filed (blond) +* [[`0b0f78a0a2`](https://github.com/Andrew Abramov /bem-naming/commit/0b0f78a0a2)] - refactor(BemNaming): rename `BEMNaming` to `BemNaming` (blond) +* [[`59637a038f`](https://github.com/Andrew Abramov /bem-naming/commit/59637a038f)] - chore(package): update dependencies (greenkeeperio-bot) +* [[`e08019ba81`](https://github.com/Andrew Abramov /bem-naming/commit/e08019ba81)] - fix(namespace): should return namespace (blond) +* [[`b0cd36c94b`](https://github.com/Andrew Abramov /bem-naming/commit/b0cd36c94b)] - fix(stringify): should not throw error (blond) +* [[`87187a46b3`](https://github.com/Andrew Abramov /bem-naming/commit/87187a46b3)] - chore(cover): add coveralls (blond) +* [[`2c5f0da71c`](https://github.com/Andrew Abramov /bem-naming/commit/2c5f0da71c)] - chore(bower): update bower.json (blond) +* [[`a29fbda2a0`](https://github.com/Andrew Abramov /bem-naming/commit/a29fbda2a0)] - refactor(index): move index file (blond) +* [[`f57a8f2a6c`](https://github.com/Andrew Abramov /bem-naming/commit/f57a8f2a6c)] - refactor(strict): use strict mode (blond) +* [[`a0eb1510ab`](https://github.com/Andrew Abramov /bem-naming/commit/a0eb1510ab)] - chore(npm): update package.json (blond) +* [[`3c5dbc9982`](https://github.com/Andrew Abramov /bem-naming/commit/3c5dbc9982)] - test(coverage): fix coverage (blond) +* [[`237f8def13`](https://github.com/Andrew Abramov /bem-naming/commit/237f8def13)] - chore(npm): remove `.npmignore` file (blond) +* [[`73a494dbf7`](https://github.com/Andrew Abramov /bem-naming/commit/73a494dbf7)] - chore(test): use ava instead of mocha (blond) +* [[`66fe215fb7`](https://github.com/Andrew Abramov /bem-naming/commit/66fe215fb7)] - chore(lint): support ES 2015 (blond) +* [[`41a45e5774`](https://github.com/Andrew Abramov /bem-naming/commit/41a45e5774)] - chore(jscs): update jscs to 2.11.0 (blond) +* [[`2afe2eb855`](https://github.com/Andrew Abramov /bem-naming/commit/2afe2eb855)] - test(travis): run tests in NodeJS 4 and 5 (blond) +* [[`5310cabc19`](https://github.com/Andrew Abramov /bem-naming/commit/5310cabc19)] - style(lint): fix code for eslint (blond) +* [[`b3768aed57`](https://github.com/Andrew Abramov /bem-naming/commit/b3768aed57)] - chore(lint): use eslint instead of jshint (blond) +* [[`58d6d46403`](https://github.com/Andrew Abramov /bem-naming/commit/58d6d46403)] - chore(editorconfig): update .editorconfig (blond) +* [[`95c474f682`](https://github.com/Andrew Abramov /bem-naming/commit/95c474f682)] - chore(min): removed bem-naming.min.js (blond) +* [[`562dda5d08`](https://github.com/Andrew Abramov /bem-naming/commit/562dda5d08)] - docs(badges): updated badges (blond) +* [[`32cc76799c`](https://github.com/Andrew Abramov /bem-naming/commit/32cc76799c)] - chore(browsers): remove tests in browsers (blond) +* [[`d1d5da419f`](https://github.com/Andrew Abramov /bem-naming/commit/d1d5da419f)] - Fixed jshint config (andrewblond) +* [[`3cdd0cb2db`](https://github.com/Andrew Abramov /bem-naming/commit/3cdd0cb2db)] - Updated email (andrewblond) +* [[`54ffa6cdf9`](https://github.com/Andrew Abramov /bem-naming/commit/54ffa6cdf9)] - Fixed typos (andrewblond) +* [[`cce496b844`](https://github.com/Andrew Abramov /bem-naming/commit/cce496b844)] - Updated github username (andrewblond) +* [[`de9e767abb`](https://github.com/Andrew Abramov /bem-naming/commit/de9e767abb)] - Update shields secure http protocol (tavriaforever) +* [[`2332b0da0f`](https://github.com/Andrew Abramov /bem-naming/commit/2332b0da0f)] - **Docs**: fix spell whithin → within (Ludmila Sverbitckaya (Bot)) +* [[`27ad3c4d3f`](https://github.com/Andrew Abramov /bem-naming/commit/27ad3c4d3f)] - **Docs**: fix spell in README.ru.md (Ludmila Sverbitckaya (Bot)) + +0.5.1 +----- + +* Implemented caching for `BEMNaming` instances (#53). +* `stringify` method is speeded up by 2,5 times (#57). +* `parse` method is speeded up on 15% (#58). +* `typeOf` method is speeded up by 2,25 times (#59). + +0.5.0 +----- + +* API: delimiters provided (#48). + +0.4.0 +----- + +* Simplified API for custom naming convention (#37). +* Added method `typeOf` (#35). +* Added support for CamelCase (#34). +* Added license. + +0.3.0 +----- + +* Option `elemSeparator` is **deprecated**, use `elem` instead. +* Option `modSeparator` is **deprecated**, use `mod` instead. +* Option `literal` is **deprecated**, use `wordPattern` instead. + +0.2.1 +----- + +* Fixed `package.json` file. + +0.2.0 +----- + +* Added ability to use BEM-naming object without `modVal` field. +* Added minified version. +* Fixed bug with `is*` methods for invalid strings. +* Fixed bug with `bemNaming` for IE6-8. + +0.1.0 +----- + +* Methods `validate`, `isBlock`, `isElem`, `isBlockMod`, `isElemMod` were added. +* Generated string will not get modifier if `modVal` field of BEM-naming object is `undefined`. +* `stringify` method throws error if invalid BEM-naming object is specified. +* `parse` method was fixed: BEM-naming object does not contain explicit `undefined` fields. diff --git a/node_modules/@bem/sdk.naming.entity/LICENSE.txt b/node_modules/@bem/sdk.naming.entity/LICENSE.txt new file mode 100644 index 0000000..c39d0ad --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity/LICENSE.txt @@ -0,0 +1,369 @@ +© YANDEX LLC, 2014-present + +The Source Code called `@bem/sdk.naming.entity` available at https://github.com/bem/bem-sdk/tree/master/packages/naming.entity is subject to the terms of the Mozilla Public License, v. 2.0 (hereinafter - MPL). The text of MPL is the following: + +Mozilla Public License, version 2.0 + +1. Definitions + +1.1. "Contributor" + + means each individual or legal entity that creates, contributes to the + creation of, or owns Covered Software. + +1.2. "Contributor Version" + + means the combination of the Contributions of others (if any) used by a + Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + + means Source Code Form to which the initial Contributor has attached the + notice in Exhibit A, the Executable Form of such Source Code Form, and + Modifications of such Source Code Form, in each case including portions + thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + a. that the initial Contributor has attached the notice described in + Exhibit B to the Covered Software; or + + b. that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the terms of + a Secondary License. + +1.6. "Executable Form" + + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + + means a work that combines Covered Software with other material, in a + separate file or files, that is not Covered Software. + +1.8. "License" + + means this document. + +1.9. "Licensable" + + means having the right to grant, to the maximum extent possible, whether + at the time of the initial grant or subsequently, any and all of the + rights conveyed by this License. + +1.10. "Modifications" + + means any of the following: + + a. any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered Software; or + + b. any new file in Source Code Form that contains any Covered Software. + +1.11. "Patent Claims" of a Contributor + + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the License, + by the making, using, selling, offering for sale, having made, import, + or transfer of either its Contributions or its Contributor Version. + +1.12. "Secondary License" + + means either the GNU General Public License, Version 2.0, the GNU Lesser + General Public License, Version 2.1, the GNU Affero General Public + License, Version 3.0, or any later versions of those licenses. + +1.13. "Source Code Form" + + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that controls, is + controlled by, or is under common control with You. For purposes of this + definition, "control" means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by contract or + otherwise, or (b) ownership of more than fifty percent (50%) of the + outstanding shares or beneficial ownership of such entity. + + +2. License Grants and Conditions + +2.1. Grants + + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + a. under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + + b. under Patent Claims of such Contributor to make, use, sell, offer for + sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + + The licenses granted in Section 2.1 with respect to any Contribution + become effective for each Contribution on the date the Contributor first + distributes such Contribution. + +2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under + this License. No additional rights or licenses will be implied from the + distribution or licensing of Covered Software under this License. + Notwithstanding Section 2.1(b) above, no patent license is granted by a + Contributor: + + a. for any code that a Contributor has removed from Covered Software; or + + b. for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + c. under Patent Claims infringed by Covered Software in the absence of + its Contributions. + + This License does not grant any rights in the trademarks, service marks, + or logos of any Contributor (except as may be necessary to comply with + the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this + License (see Section 10.2) or under the terms of a Secondary License (if + permitted under the terms of Section 3.3). + +2.5. Representation + + Each Contributor represents that the Contributor believes its + Contributions are its original creation(s) or it has sufficient rights to + grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + + This License is not intended to limit any rights You have under + applicable copyright doctrines of fair use, fair dealing, or other + equivalents. + +2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in + Section 2.1. + + +3. Responsibilities + +3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under + the terms of this License. You must inform recipients that the Source + Code Form of the Covered Software is governed by the terms of this + License, and how they can obtain a copy of this License. You may not + attempt to alter or restrict the recipients' rights in the Source Code + Form. + +3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + a. such Covered Software must also be made available in Source Code Form, + as described in Section 3.1, and You must inform recipients of the + Executable Form how they can obtain a copy of such Source Code Form by + reasonable means in a timely manner, at a charge no more than the cost + of distribution to the recipient; and + + b. You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter the + recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for + the Covered Software. If the Larger Work is a combination of Covered + Software with a work governed by one or more Secondary Licenses, and the + Covered Software is not Incompatible With Secondary Licenses, this + License permits You to additionally distribute such Covered Software + under the terms of such Secondary License(s), so that the recipient of + the Larger Work may, at their option, further distribute the Covered + Software under the terms of either this License or such Secondary + License(s). + +3.4. Notices + + You may not remove or alter the substance of any license notices + (including copyright notices, patent notices, disclaimers of warranty, or + limitations of liability) contained within the Source Code Form of the + Covered Software, except that You may alter any license notices to the + extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on + behalf of any Contributor. You must make it absolutely clear that any + such warranty, support, indemnity, or liability obligation is offered by + You alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + + If it is impossible for You to comply with any of the terms of this License + with respect to some or all of the Covered Software due to statute, + judicial order, or regulation then You must: (a) comply with the terms of + this License to the maximum extent possible; and (b) describe the + limitations and the code they affect. Such description must be placed in a + text file included with all distributions of the Covered Software under + this License. Except to the extent prohibited by statute or regulation, + such description must be sufficiently detailed for a recipient of ordinary + skill to be able to understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically if You + fail to comply with any of its terms. However, if You become compliant, + then the rights granted under this License from a particular Contributor + are reinstated (a) provisionally, unless and until such Contributor + explicitly and finally terminates Your grants, and (b) on an ongoing + basis, if such Contributor fails to notify You of the non-compliance by + some reasonable means prior to 60 days after You have come back into + compliance. Moreover, Your grants from a particular Contributor are + reinstated on an ongoing basis if such Contributor notifies You of the + non-compliance by some reasonable means, this is the first time You have + received notice of non-compliance with this License from such + Contributor, and You become compliant prior to 30 days after Your receipt + of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, + counter-claims, and cross-claims) alleging that a Contributor Version + directly or indirectly infringes any patent, then the rights granted to + You by any and all Contributors for the Covered Software under Section + 2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user + license agreements (excluding distributors and resellers) which have been + validly granted by You or Your distributors under this License prior to + termination shall survive termination. + +6. Disclaimer of Warranty + + Covered Software is provided under this License on an "as is" basis, + without warranty of any kind, either expressed, implied, or statutory, + including, without limitation, warranties that the Covered Software is free + of defects, merchantable, fit for a particular purpose or non-infringing. + The entire risk as to the quality and performance of the Covered Software + is with You. Should any Covered Software prove defective in any respect, + You (not any Contributor) assume the cost of any necessary servicing, + repair, or correction. This disclaimer of warranty constitutes an essential + part of this License. No use of any Covered Software is authorized under + this License except under this disclaimer. + +7. Limitation of Liability + + Under no circumstances and under no legal theory, whether tort (including + negligence), contract, or otherwise, shall any Contributor, or anyone who + distributes Covered Software as permitted above, be liable to You for any + direct, indirect, special, incidental, or consequential damages of any + character including, without limitation, damages for lost profits, loss of + goodwill, work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses, even if such party shall have been + informed of the possibility of such damages. This limitation of liability + shall not apply to liability for death or personal injury resulting from + such party's negligence to the extent applicable law prohibits such + limitation. Some jurisdictions do not allow the exclusion or limitation of + incidental or consequential damages, so this exclusion and limitation may + not apply to You. + +8. Litigation + + Any litigation relating to this License may be brought only in the courts + of a jurisdiction where the defendant maintains its principal place of + business and such litigation shall be governed by laws of that + jurisdiction, without reference to its conflict-of-law provisions. Nothing + in this Section shall prevent a party's ability to bring cross-claims or + counter-claims. + +9. Miscellaneous + + This License represents the complete agreement concerning the subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. Any law or regulation which provides that + the language of a contract shall be construed against the drafter shall not + be used to construe this License against a Contributor. + + +10. Versions of the License + +10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + +10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version + of the License under which You originally received the Covered Software, + or under the terms of any subsequent version published by the license + steward. + +10.3. Modified Versions + + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a + modified version of this License if you rename the license and remove + any references to the name of the license steward (except to note that + such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary + Licenses If You choose to distribute Source Code Form that is + Incompatible With Secondary Licenses under the terms of this version of + the License, the notice described in Exhibit B of this License must be + attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the + terms of the Mozilla Public License, v. + 2.0. If a copy of the MPL was not + distributed with this file, You can + obtain one at + http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, +then You may include the notice in a location (such as a LICENSE file in a +relevant directory) where a recipient would be likely to look for such a +notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice + + This Source Code Form is "Incompatible + With Secondary Licenses", as defined by + the Mozilla Public License, v. 2.0. + + +A copy of the MPL is also available at http://mozilla.org/MPL/2.0/. diff --git a/node_modules/@bem/sdk.naming.entity/README.md b/node_modules/@bem/sdk.naming.entity/README.md new file mode 100644 index 0000000..b81a4e2 --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity/README.md @@ -0,0 +1,349 @@ +# naming.entity + +The tool for working with [BEM entity](https://en.bem.info/methodology/key-concepts/#bem-entity) representations: + +* parse a [string representation](#string-representation); +* stringify an [object representation](#object-representation). + +[![NPM Status][npm-img]][npm] + +[npm]: https://www.npmjs.org/package/@bem/sdk.naming.entity +[npm-img]: https://img.shields.io/npm/v/@bem/sdk.naming.entity.svg + +* [Introduction](#introduction) +* [Try naming.entity](#try-namingentity) +* [Quick start](#quick-start) +* [API Reference](#api-reference) +* [Parameter tuning](#parameter-tuning) +* [Usage examples](#usage-examples) + +## Introduction + +This package combines the capabilities of the following packages: +* [@bem/sdk.naming.parse](https://github.com/bem/bem-sdk/tree/master/packages/naming.entity.parse) — to create a [parse()](#parse) function. +* [@bem/sdk.naming.stringify](https://github.com/bem/bem-sdk/tree/master/packages/naming.entity.stringify) — to create a [stringify()](#stringify) function. +* [@bem/sdk.naming.presets](https://github.com/bem/bem-sdk/tree/master/packages/naming.presets) — to select a [naming convention](https://bem.info/methodology/naming-convention/) for these functions. + + Various naming conventions are supported, such as [origin](https://en.bem.info/methodology/naming-convention/#naming-rules), [two-dashes](https://en.bem.info/methodology/naming-convention/#two-dashes-style) and [react](https://en.bem.info/methodology/naming-convention/#react-style). See the full list of supported presets in the package [documentation](https://github.com/bem/bem-sdk/tree/migelle-naming-presets-doc/packages/naming.presets#naming-conventions). + + You can also [create](#using-a-custom-naming-convention) a custom naming convention and use it for creating the `parse()` and `stringify()` functions. + +## Try naming.entity + +An example is available in the [RunKit editor](https://runkit.com/migs911/how-bem-sdk-naming-entity-works). + +## Quick start + +> **Attention.** To use `@bem/sdk.naming.entity`, you must install [Node.js 8.0+](https://nodejs.org/en/download/). + +To run the `@bem/sdk.naming.entity` package: + +* [Install `naming.entity`](#installing-the-bemsdknamingentity-package). +* [Create a `naming.entity` instance](#creating-a-namingentity-instance). +* [Use the created instance](#using-the-created-instance). + +### Installing the `@bem/sdk.naming.entity` package + +To install the `@bem/sdk.naming.entity` package, run the following command: + +``` +$ npm install --save @bem/sdk.naming.entity +``` + +### Creating a `naming.entity` instance + +To create a `naming.entity` instance, insert the following lines into your code: + +```js +const bemNaming = require('@bem/sdk.naming.entity'); +``` + +By default, the created instance is based on the `origin` preset that represents the default naming convention for BEM entities. To use another preset, see [Using the specified naming convention](#using-the-specified-naming-convention). + +### Using the created instance + +Now you can use the created instance to parse and stringify BEM entity name representations. + +#### Parse a string representation + +```js +bemNaming.parse('my-block__my-element'); +``` + +This code will return the BemEntityName object with the block name `my-block` and the element name `my-element`. + +#### Stringify an object representation + +```js +bemNaming.stringify({ block: 'my-block', mod: 'my-modifier' }); +``` + +This code will return the string `my-block_my-modifier`. + + +## API Reference + +* [bemNaming()](#bemnaming) +* [parse()](#parse) +* [stringify()](#stringify) + +### bemNaming() + +This function creates a `naming.entity` instance with the [parse()](#parse) and [stringify()](#stringify) functions. + +```js +/** + * @typedef INamingConventionDelims + * @property {string} elem — Separates an element name from block. + * @property {string|Object} mod — Separates a modifier name and the value of a modifier. + * @property {string} mod.name — Separates a modifier name from a block or an element. + * @property {string|boolean} mod.val — Separates the value of a modifier from the modifier name. + */ + +/** + * @param {(Object|string)} [options] — User options or the name of the preset to return. + * If not specified, the default preset will be used. + * @param {string} [options.preset] — Preset name that should be used as the default preset. + * @param {Object} [options.delims] — Strings to separate names of bem entities. + * This object has the same structure as `INamingConventionDelims`, + * but all properties inside are optional. + * @param {string} [options.wordPattern] — A regular expression that will be used to match an entity name. + * @returns {Object} — Created instance with the `parse()` and `stringify()` functions. + */ +create(options); +``` + +**Examples:** + +```js +const defaultNaming = require('@bem/sdk.naming.entity'); +const reactNaming = require('@bem/sdk.naming.entity')('react'); +const customNaming = require('@bem/sdk.naming.entity'){ wordPattern: '[a-z]+' }; +``` + +See more examples in the [Parameter tuning](#parameter-tuning) section. + +### parse() + +Parses the string with a BEM entity name into an object representation. + +```js +/** + * @typedef BemEntityName + * @property {string} block — Block name. + * @property {string} [elem] — Element name. + * @property {string|Object} [mod] — Modifier name or object with name and value. + * @property {string} mod.name — Modifier name. + * @property {string} [mod.val=true] — Modifier value. + */ + +/** + * @param {string} str — String representation of a BEM entity. + * @returns {(BemEntityName|undefined)} + */ +parse(str); +``` + +**Example:** + +```js +const bemNaming = require('@bem/sdk.naming.entity'); + +bemNaming.parse('my-block__my-element_my-modifier_some-value'); +// => BemEntityName { +// block: 'my-block', +// elem: 'my-element', +// mod: { name: 'my-modifier', val: 'some-value' } +// } +``` + +For more information about the `parse()` function, see the `@bem/sdk.naming.parse` package [documentation](https://github.com/bem/bem-sdk/tree/master/packages/naming.entity.parse). + +### stringify() + +Forms a string from the object that specifies a BEM entity name. + +```js +/** + * @typedef BemEntityName + * @property {string} block — Block name. + * @property {string} [elem] — Element name. + * @property {string|Object} [mod] — Modifier name or object with name and value. + * @property {string} mod.name — Modifier name. + * @property {string|boolean} [mod.val] — Modifier value. + */ + +/** + * @param {object|BemEntityName} entity — Object representation of a BEM entity. + * @returns {string} — BEM entity name. This name can be used in class attributes. + */ +stringify(entity); +``` + +**Example:** + +```js +const bemNaming = require('@bem/sdk.naming.entity'); + +const bemEntityName = { + block: 'my-block', + elem: 'my-element', + mod: { name: 'my-modifier', val: 'some-value' } +} + +console.log(bemNaming.stringify(bemEntityName)); +// => my-block__my-element_my-modifier_some-value +``` + +For more information about the `stringify()` function, see the `@bem/sdk.naming.stringify` package [documentation](https://github.com/bem/bem-sdk/tree/master/packages/naming.entity.stringify). + +## Parameter tuning + +* [Using a specified naming convention](#using-a-specified-naming-convention) +* [Using a custom naming convention](#using-a-custom-naming-convention) +* [Using another preset as default](#using-another-preset-as-default) + +### Using a specified naming convention + +The [@bem/sdk.naming.presets](https://github.com/bem/bem-sdk/tree/master/packages/naming.presets) package provides presets with various naming conventions. + +Specify the name of a preset to use in the [bemNaming()](#bemnaming) function. See the full list of supported presets in the package [documentation](https://github.com/bem/bem-sdk/tree/migelle-naming-presets-doc/packages/naming.presets#naming-conventions). + +**Example:** + +```js +const createBemNaming = require('@bem/sdk.naming.entity'); +const myEntity = { + block: 'my-block', + elem: 'my-element', + mod: { + name: 'my-modifier', + val: 'some-value' + } +}; + +// Create the new instance from the `two-dashes` preset. +const twoDashes = createBemNaming('two-dashes'); +twoDashes.stringify(myEntity); +// => my-block__my-element--my-modifier_some-value + +// Create an instance from the `react` preset. +const react = createBemNaming('react'); +react.stringify(myEntity); +// => my-block-my-element_my-modifier_some-value +``` + +[RunKit live example](https://runkit.com/migs911/naming-entity-using-the-specified-naming-convention). + +### Using a custom naming convention + +To use a custom naming convention, create an object that will overwrite the default naming convention parameters. Pass this object in the [bemNaming()](#bemnaming) function. + +For example, overwrite the modifier value delimiter and use the equal sign (`=`) as the delimiter. + +**Example:** + +```js +const createBemNaming = require('@bem/sdk.naming.entity'); +const myNamingOptions = { + delims: { + mod: { val: '=' } + } +}; +const myNaming = createBemNaming(myNamingOptions); + +// Parse a BEM entity name to test created instance. +myNaming.parse('my-block_my-modifier=some-value'); +/** + * => BemEntityName { + * block: 'my-block', + * mod: { name: 'my-modifier', val: 'some-value' } } + */ + +// Stringify an object representation of the BEM entity name. +const myEntity = { + block: 'my-block', + elem: 'my-element', + mod: { + name: 'my-modifier', + val: 'some-value' + } +}; +myNaming.stringify(myEntity); +// => my-block__my-element_my-modifier=some-value +``` + +[RunKit live example](https://runkit.com/migs911/naming-entity-using-a-custom-naming-convention). + +### Using another preset as default + +The default preset is `origin`, but you can set another preset as default in the `options.preset` parameter. + +For example, set the `two-dashes` preset as the default and create a `naming.entity` instance based on it. + +**Example:** + +```js +const createBemNaming = require('@bem/sdk.naming.entity'); +const myNamingOptions = { + preset: 'two-dashes', + delims: { + mod: { val: '=' } + } +}; + +const myNaming = createBemNaming(myNamingOptions); + +// Parse a BEM entity name to test created preset. +myNaming.parse('my-block--my-modifier=some-value'); +/** + * => BemEntityName { + * block: 'my-block', + * mod: { name: 'my-modifier', val: 'some-value' } } + */ + +// Stringify an object representation of the BEM entity name. +const myEntity = { + block: 'my-block', + elem: 'my-element', + mod: { + name: 'my-modifier', + val: 'some-value' + } +}; +myNaming.stringify(myEntity); +// => my-block__my-element--my-modifier=some-value +``` + +[RunKit live example](https://runkit.com/migs911/naming-entity-use-another-preset-as-default). + +## Usage examples + +### Convert a string to the Two Dashes style + +In this example, we will convert the string from the [origin](https://en.bem.info/methodology/naming-convention/#naming-rules) naming convention to [Two Dashes](https://en.bem.info/methodology/naming-convention/#two-dashes-style). + +Origin: `my-block__my-element_my-modifier_some-value` + +Two Dashes: `my-block__my-element--my-modifier_some-value` + +**Example:** + +```js +const originNaming = require('@bem/sdk.naming.entity'); +const twoDashesNaming = require('@bem/sdk.naming.entity')('two-dashes'); + +const bemEntityNameStr = 'my-block__my-element_my-modifier_some-value' + +const bemEntityNameObj = originNaming.parse(bemEntityName); +// => BemEntityName { +// block: 'my-block', +// elem: 'my-element', +// mod: { name: 'my-modifier', val: 'some-value' } +// } + +twoDashesNaming.stringify(bemEntityNameObj); +// => my-block__my-element--my-modifier_some-value +``` + +[RunKit live example](https://runkit.com/migs911/naming-entity-convert-a-string-to-another-naming-convention). diff --git a/node_modules/@bem/sdk.naming.entity/index.js b/node_modules/@bem/sdk.naming.entity/index.js new file mode 100644 index 0000000..c4072b3 --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity/index.js @@ -0,0 +1,64 @@ +'use strict'; + +/** + * Delims of bem entity, elem and/or mod. + * + * @typedef {Object} INamingConventionDelims + * @param {String} [elem='__'] — separates element's name from block. + * @param {String|Object} [mod='_'] — separates modifiers from blocks and elements. + * @param {String} [mod.name='_'] — separates name of modifier from blocks and elements. + * @param {String} [mod.val='_'] — separates value of modifier from name of modifier. + */ + + /** + * BEM naming convention options. + * + * @typedef {Object} INamingConvention + * @param {INamingConventionDelims} delims — separates entity names from each other. + * @param {String|Object} [wordPattern='[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*'] — defines which symbols can be used for block, + * element and modifier's names. + */ + +const createStringify = require('@bem/sdk.naming.entity.stringify'); +const createParse = require('@bem/sdk.naming.entity.parse'); +const createPreset = require('@bem/sdk.naming.presets/create'); + +/** + * It is necessary not to create new instances for the same custom naming. + * @readonly + */ +const cache = {}; + +/** + * Creates namespace with methods which allows getting information about BEM entity using string as well + * as forming string representation based on naming object. + * + * @param {INamingConvention} [options] - options for naming convention. + * @return {Object} + */ +function createNaming(options) { + const opts = createPreset(options); + const id = JSON.stringify(opts); + + if (cache[id]) { + return cache[id]; + } + + const delims = opts.delims; + const namespace = { + parse: createParse(opts), + stringify: createStringify(opts), + /** + * String to separate elem from block. + * + * @type {String} + */ + delims + }; + + cache[id] = namespace; + + return namespace; +} + +module.exports = Object.assign(createNaming, createNaming()); diff --git a/node_modules/@bem/sdk.naming.entity/package.json b/node_modules/@bem/sdk.naming.entity/package.json new file mode 100644 index 0000000..fde6c06 --- /dev/null +++ b/node_modules/@bem/sdk.naming.entity/package.json @@ -0,0 +1,127 @@ +{ + "_args": [ + [ + "@bem/sdk.naming.entity", + "/mnt/c/users/1/Documents/Frontend/task2" + ] + ], + "_from": "@bem/sdk.naming.entity@latest", + "_hasShrinkwrap": false, + "_id": "@bem/sdk.naming.entity@0.2.11", + "_inCache": true, + "_installable": true, + "_location": "/@bem/sdk.naming.entity", + "_nodeVersion": "8.6.0", + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/sdk.naming.entity_0.2.11_1549205377785_0.7270642411022405" + }, + "_npmUser": { + "email": "zxqfox@gmail.com", + "name": "qfox" + }, + "_npmVersion": "lerna/3.10.5/node@v8.6.0+x64 (darwin)", + "_phantomChildren": {}, + "_requested": { + "name": "@bem/sdk.naming.entity", + "raw": "@bem/sdk.naming.entity", + "rawSpec": "", + "scope": "@bem", + "spec": "latest", + "type": "tag" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/@bem/sdk.naming.entity/-/sdk.naming.entity-0.2.11.tgz", + "_shasum": "7057f4c3917cce8bb3117d26d9022c45eacd48bd", + "_shrinkwrap": null, + "_spec": "@bem/sdk.naming.entity", + "_where": "/mnt/c/users/1/Documents/Frontend/task2", + "author": { + "email": "mail@blond.im", + "name": "Andrew Abramov" + }, + "bugs": { + "url": "https://github.com/bem/bem-sdk/issues?q=label%3Apkg%3Anaming.entity" + }, + "dependencies": { + "@bem/sdk.entity-name": "^0.2.11", + "@bem/sdk.naming.entity.parse": "^0.2.9", + "@bem/sdk.naming.entity.stringify": "^1.1.2", + "@bem/sdk.naming.presets": "^0.2.3" + }, + "description": "Manage naming of BEM entities", + "devDependencies": {}, + "directories": {}, + "dist": { + "fileCount": 5, + "integrity": "sha512-kC0XbOmRP7AJb4U/+AP47PjfuoXlynmse8OoOFz8iqjeWRZpq8Ezij+NG5DzJBv8w9/zIJ4fX5SPu3VQKY2FKA==", + "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVv+CCRA9TVsSAnZWagAAQfkQAJJrswQGmJ9wINRiZIik\n9Wg0swki+bGrCDw79nWiRZ9dJ4L5Q2x4kZXRPc4qHfjMUyhs80W0lvKhWYOg\n+8aFqqA+LTGHMdUkUvFOL0SnbFNZ9fPNhCxbMsiu5FjixtG3NQWFoRt51CTB\n8LYsC4vXaa28riB2vTJIqk5XpegqgV49M5ukpYrJ3Z+T0qPQMV+yUFFPAsda\n9BaaWLBSud79s7/CIER/2JE29xsEhOGUP7vPJH0fD/2o5LXY9AtsO6bPAso7\nKm4tii0g2NMlc82NwpyiOsI6+egOiFsIdSYUXrDzNKx3Zue8J4hcjFof+KiG\n3aceUysM2BcOBjwOYhK3rUxg/1UVq9y4cIH/zrB25EAgG/wChh/oebmji8aR\nP7V4K3GNBtZxUtPvCO+eZ3YrSCdIu9FiQStv1J4rechEitZYRySEn8K1pd88\n2CgqdsiBBzaWIBpbGlwubWkwuE1G7MFYVaK0muMTQMYCGPM71gzZnvzeMpTs\nrR+zaAkd4ysqAVuQAJQ5okUp/gVfGesFuFT2gBrG4qIU3J/8U0TZnB2+GDUc\nPlAO/+ozVcIFB/x8mppOOBB5wpSvjhvd7ZN/563urxWup8Z6z477WfkeaEBP\nen2ujOIUCTX2QnCU6JfvkjPPZ0P+uWkyARGd2CSupWtchaKJUU3nLORg7reo\n5RFb\r\n=t0lA\r\n-----END PGP SIGNATURE-----\r\n", + "shasum": "7057f4c3917cce8bb3117d26d9022c45eacd48bd", + "tarball": "https://registry.npmjs.org/@bem/sdk.naming.entity/-/sdk.naming.entity-0.2.11.tgz", + "unpackedSize": 55539 + }, + "engines": { + "node": ">= 8.0" + }, + "gitHead": "1ec9066d241303e5dc2abc01171f111effffff3a", + "homepage": "https://github.com/bem/bem-sdk/tree/master/packages/naming.entity#readme", + "keywords": [ + "bem", + "conventions", + "entity", + "name", + "naming", + "origin", + "parse", + "react", + "representation", + "stringify", + "two-dashes" + ], + "license": "MPL-2.0", + "main": "index.js", + "maintainers": [ + { + "name": "blond", + "email": "mail@blond.im" + }, + { + "name": "qfox", + "email": "zxqfox@gmail.com" + }, + { + "name": "tadatuta", + "email": "i@tadatuta.com" + }, + { + "name": "veged", + "email": "veged@ya.ru" + }, + { + "name": "vithar", + "email": "vitaly@harisov.name" + }, + { + "name": "yeti-or", + "email": "yeti.or@gmail.com" + } + ], + "name": "@bem/sdk.naming.entity", + "optionalDependencies": {}, + "publishConfig": { + "access": "public" + }, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/bem/bem-sdk.git" + }, + "scripts": { + "cover": "nyc mocha", + "specs": "mocha", + "test": "npm run specs" + }, + "version": "0.2.11" +} diff --git a/node_modules/@bem/sdk.naming.presets/CHANGELOG.md b/node_modules/@bem/sdk.naming.presets/CHANGELOG.md new file mode 100644 index 0000000..0879025 --- /dev/null +++ b/node_modules/@bem/sdk.naming.presets/CHANGELOG.md @@ -0,0 +1,114 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.2.3](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.2.2...@bem/sdk.naming.presets@0.2.3) (2019-02-03) + +**Note:** Version bump only for package @bem/sdk.naming.presets + + + + + + +## [0.2.1](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.2.0...@bem/sdk.naming.presets@0.2.1) (2018-07-16) + + + + +**Note:** Version bump only for package @bem/sdk.naming.presets + + +# [0.2.0](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.1.0...@bem/sdk.naming.presets@0.2.0) (2018-07-12) + + +### Features + +* **presets:** legacy now known about dogs and aliased to default ([7da72fe](https://github.com/bem/bem-sdk/commit/7da72fe)) +* **presets:** react uses doggy pattern by default, origin-react uses layer.blocks ([9a4e8b6](https://github.com/bem/bem-sdk/commit/9a4e8b6)) + + + + + +# [0.1.0](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.0.9...@bem/sdk.naming.presets@0.1.0) (2018-07-01) + + +### Features + +* **naming.presets:** create now respects fs field in convention ([6eeadc3](https://github.com/bem/bem-sdk/commit/6eeadc3)) +* **naming.presets:** legacy preset, 'blocks' dir, user defaults ([09a232a](https://github.com/bem/bem-sdk/commit/09a232a)) + + + + + +## [0.0.9](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.0.8...@bem/sdk.naming.presets@0.0.9) (2018-04-17) + + +### Bug Fixes + +* degradate to es5 for entity.stringify ([ad4f8c1](https://github.com/bem/bem-sdk/commit/ad4f8c1)) + + + + + +## [0.0.8](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.0.7...@bem/sdk.naming.presets@0.0.8) (2018-04-17) + + + + +**Note:** Version bump only for package @bem/sdk.naming.presets + + +## [0.0.7](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.0.6...@bem/sdk.naming.presets@0.0.7) (2017-12-16) + + +### Bug Fixes + +* **walk:** resolve cycle dependency ([9e8d925](https://github.com/bem/bem-sdk/commit/9e8d925)) + + + + + +## [0.0.6](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.0.5...@bem/sdk.naming.presets@0.0.6) (2017-12-12) + + + + +**Note:** Version bump only for package @bem/sdk.naming.presets + + +## [0.0.5](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.0.3...@bem/sdk.naming.presets@0.0.5) (2017-11-07) + + + + +**Note:** Version bump only for package @bem/sdk.naming.presets + + +## [0.0.4](https://github.com/bem/bem-sdk/compare/@bem/sdk.naming.presets@0.0.3...@bem/sdk.naming.presets@0.0.4) (2017-10-02) + + + + +**Note:** Version bump only for package @bem/sdk.naming.presets + + +## 0.0.3 (2017-10-01) + + + + +**Note:** Version bump only for package @bem/sdk.naming.presets + + +## 0.0.2 (2017-09-30) + + + + +**Note:** Version bump only for package @bem/sdk.naming.presets diff --git a/node_modules/@bem/sdk.naming.presets/LICENSE.txt b/node_modules/@bem/sdk.naming.presets/LICENSE.txt new file mode 100644 index 0000000..bf9c4e7 --- /dev/null +++ b/node_modules/@bem/sdk.naming.presets/LICENSE.txt @@ -0,0 +1,369 @@ +© YANDEX LLC, 2017-present + +The Source Code called `@bem/sdk.naming.presets` available at https://github.com/bem/bem-sdk/tree/master/packages/naming.presets is subject to the terms of the Mozilla Public License, v. 2.0 (hereinafter - MPL). The text of MPL is the following: + +Mozilla Public License, version 2.0 + +1. Definitions + +1.1. "Contributor" + + means each individual or legal entity that creates, contributes to the + creation of, or owns Covered Software. + +1.2. "Contributor Version" + + means the combination of the Contributions of others (if any) used by a + Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + + means Source Code Form to which the initial Contributor has attached the + notice in Exhibit A, the Executable Form of such Source Code Form, and + Modifications of such Source Code Form, in each case including portions + thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + a. that the initial Contributor has attached the notice described in + Exhibit B to the Covered Software; or + + b. that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the terms of + a Secondary License. + +1.6. "Executable Form" + + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + + means a work that combines Covered Software with other material, in a + separate file or files, that is not Covered Software. + +1.8. "License" + + means this document. + +1.9. "Licensable" + + means having the right to grant, to the maximum extent possible, whether + at the time of the initial grant or subsequently, any and all of the + rights conveyed by this License. + +1.10. "Modifications" + + means any of the following: + + a. any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered Software; or + + b. any new file in Source Code Form that contains any Covered Software. + +1.11. "Patent Claims" of a Contributor + + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the License, + by the making, using, selling, offering for sale, having made, import, + or transfer of either its Contributions or its Contributor Version. + +1.12. "Secondary License" + + means either the GNU General Public License, Version 2.0, the GNU Lesser + General Public License, Version 2.1, the GNU Affero General Public + License, Version 3.0, or any later versions of those licenses. + +1.13. "Source Code Form" + + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that controls, is + controlled by, or is under common control with You. For purposes of this + definition, "control" means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by contract or + otherwise, or (b) ownership of more than fifty percent (50%) of the + outstanding shares or beneficial ownership of such entity. + + +2. License Grants and Conditions + +2.1. Grants + + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + a. under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + + b. under Patent Claims of such Contributor to make, use, sell, offer for + sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + + The licenses granted in Section 2.1 with respect to any Contribution + become effective for each Contribution on the date the Contributor first + distributes such Contribution. + +2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under + this License. No additional rights or licenses will be implied from the + distribution or licensing of Covered Software under this License. + Notwithstanding Section 2.1(b) above, no patent license is granted by a + Contributor: + + a. for any code that a Contributor has removed from Covered Software; or + + b. for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + c. under Patent Claims infringed by Covered Software in the absence of + its Contributions. + + This License does not grant any rights in the trademarks, service marks, + or logos of any Contributor (except as may be necessary to comply with + the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this + License (see Section 10.2) or under the terms of a Secondary License (if + permitted under the terms of Section 3.3). + +2.5. Representation + + Each Contributor represents that the Contributor believes its + Contributions are its original creation(s) or it has sufficient rights to + grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + + This License is not intended to limit any rights You have under + applicable copyright doctrines of fair use, fair dealing, or other + equivalents. + +2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in + Section 2.1. + + +3. Responsibilities + +3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under + the terms of this License. You must inform recipients that the Source + Code Form of the Covered Software is governed by the terms of this + License, and how they can obtain a copy of this License. You may not + attempt to alter or restrict the recipients' rights in the Source Code + Form. + +3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + a. such Covered Software must also be made available in Source Code Form, + as described in Section 3.1, and You must inform recipients of the + Executable Form how they can obtain a copy of such Source Code Form by + reasonable means in a timely manner, at a charge no more than the cost + of distribution to the recipient; and + + b. You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter the + recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for + the Covered Software. If the Larger Work is a combination of Covered + Software with a work governed by one or more Secondary Licenses, and the + Covered Software is not Incompatible With Secondary Licenses, this + License permits You to additionally distribute such Covered Software + under the terms of such Secondary License(s), so that the recipient of + the Larger Work may, at their option, further distribute the Covered + Software under the terms of either this License or such Secondary + License(s). + +3.4. Notices + + You may not remove or alter the substance of any license notices + (including copyright notices, patent notices, disclaimers of warranty, or + limitations of liability) contained within the Source Code Form of the + Covered Software, except that You may alter any license notices to the + extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on + behalf of any Contributor. You must make it absolutely clear that any + such warranty, support, indemnity, or liability obligation is offered by + You alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + + If it is impossible for You to comply with any of the terms of this License + with respect to some or all of the Covered Software due to statute, + judicial order, or regulation then You must: (a) comply with the terms of + this License to the maximum extent possible; and (b) describe the + limitations and the code they affect. Such description must be placed in a + text file included with all distributions of the Covered Software under + this License. Except to the extent prohibited by statute or regulation, + such description must be sufficiently detailed for a recipient of ordinary + skill to be able to understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically if You + fail to comply with any of its terms. However, if You become compliant, + then the rights granted under this License from a particular Contributor + are reinstated (a) provisionally, unless and until such Contributor + explicitly and finally terminates Your grants, and (b) on an ongoing + basis, if such Contributor fails to notify You of the non-compliance by + some reasonable means prior to 60 days after You have come back into + compliance. Moreover, Your grants from a particular Contributor are + reinstated on an ongoing basis if such Contributor notifies You of the + non-compliance by some reasonable means, this is the first time You have + received notice of non-compliance with this License from such + Contributor, and You become compliant prior to 30 days after Your receipt + of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, + counter-claims, and cross-claims) alleging that a Contributor Version + directly or indirectly infringes any patent, then the rights granted to + You by any and all Contributors for the Covered Software under Section + 2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user + license agreements (excluding distributors and resellers) which have been + validly granted by You or Your distributors under this License prior to + termination shall survive termination. + +6. Disclaimer of Warranty + + Covered Software is provided under this License on an "as is" basis, + without warranty of any kind, either expressed, implied, or statutory, + including, without limitation, warranties that the Covered Software is free + of defects, merchantable, fit for a particular purpose or non-infringing. + The entire risk as to the quality and performance of the Covered Software + is with You. Should any Covered Software prove defective in any respect, + You (not any Contributor) assume the cost of any necessary servicing, + repair, or correction. This disclaimer of warranty constitutes an essential + part of this License. No use of any Covered Software is authorized under + this License except under this disclaimer. + +7. Limitation of Liability + + Under no circumstances and under no legal theory, whether tort (including + negligence), contract, or otherwise, shall any Contributor, or anyone who + distributes Covered Software as permitted above, be liable to You for any + direct, indirect, special, incidental, or consequential damages of any + character including, without limitation, damages for lost profits, loss of + goodwill, work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses, even if such party shall have been + informed of the possibility of such damages. This limitation of liability + shall not apply to liability for death or personal injury resulting from + such party's negligence to the extent applicable law prohibits such + limitation. Some jurisdictions do not allow the exclusion or limitation of + incidental or consequential damages, so this exclusion and limitation may + not apply to You. + +8. Litigation + + Any litigation relating to this License may be brought only in the courts + of a jurisdiction where the defendant maintains its principal place of + business and such litigation shall be governed by laws of that + jurisdiction, without reference to its conflict-of-law provisions. Nothing + in this Section shall prevent a party's ability to bring cross-claims or + counter-claims. + +9. Miscellaneous + + This License represents the complete agreement concerning the subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. Any law or regulation which provides that + the language of a contract shall be construed against the drafter shall not + be used to construe this License against a Contributor. + + +10. Versions of the License + +10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + +10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version + of the License under which You originally received the Covered Software, + or under the terms of any subsequent version published by the license + steward. + +10.3. Modified Versions + + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a + modified version of this License if you rename the license and remove + any references to the name of the license steward (except to note that + such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary + Licenses If You choose to distribute Source Code Form that is + Incompatible With Secondary Licenses under the terms of this version of + the License, the notice described in Exhibit B of this License must be + attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the + terms of the Mozilla Public License, v. + 2.0. If a copy of the MPL was not + distributed with this file, You can + obtain one at + http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, +then You may include the notice in a location (such as a LICENSE file in a +relevant directory) where a recipient would be likely to look for such a +notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice + + This Source Code Form is "Incompatible + With Secondary Licenses", as defined by + the Mozilla Public License, v. 2.0. + + +A copy of the MPL is also available at http://mozilla.org/MPL/2.0/. diff --git a/node_modules/@bem/sdk.naming.presets/README.md b/node_modules/@bem/sdk.naming.presets/README.md new file mode 100644 index 0000000..8c5efb0 --- /dev/null +++ b/node_modules/@bem/sdk.naming.presets/README.md @@ -0,0 +1,468 @@ +# presets + +The package contains the default naming convention presets and the tool to create a custom naming conventions. + +[![NPM Status][npm-img]][npm] + +[npm]: https://www.npmjs.org/package/@bem/sdk.naming.presets +[npm-img]: https://img.shields.io/npm/v/@bem/sdk.naming.presets.svg + +* [Introduction](#introduction) +* [Try presets](#try-presets) +* [Quick start](#quick-start) +* [API Reference](#api-reference) +* [Parameter tuning](#parameter-tuning) + * [Get the default preset](#get-the-default-preset) + * [Use another preset as default](#use-another-preset-as-default) + * [Pass an object with default options](#pass-an-object-with-default-options) +* [Naming conventions](#naming-conventions) + +## Introduction + +You can use this package to: + +* Import an existing preset with a [naming convention](https://bem.info/methodology/naming-convention/). +* Create a preset with a custom naming convention. + +This package is useful when you want to create a new preset based on another preset, for example, to change only the modifier delimiter and keep other options unchanged. + +> **Note.** If you don't have any BEM projects available to try out the `@bem/sdk.naming.presets` package, the quickest way to create one is to use [bem-express](https://github.com/bem/bem-express). + +## Try presets + +An example is available in the [RunKit editor](https://runkit.com/migs911/how-bem-sdk-naming-presets-works). + +## Quick start + +> **Attention.** To use `@bem/sdk.naming.presets`, you must install [Node.js 8.0+](https://nodejs.org/en/download/). + +In this quick start you will learn how to import a preset with a naming convention and create a preset with a custom naming convention. + +To run the `@bem/sdk.naming.presets` package: +1. [Install the `@bem/sdk.naming.presets` package](#installing-the-bemsdknamingpresets-package). +2. [Import a preset with a naming convention](#importing-a-preset-with-a-naming-convention). +3. [Create a preset with a custom naming convention](#creating-a-preset-with-a-custom-naming-convention). + +### Installing the `@bem/sdk.naming.presets` package + +To install the `@bem/sdk.naming.presets` package, run the following command: + +``` +$ npm install --save @bem/sdk.naming.presets +``` + +### Importing a preset with a naming convention + +To import a preset with a default naming convention, create a JavaScript file with any name (for example, **app.js**) and insert the following: + +```js +const originNaming = require('@bem/sdk.naming.presets/origin'); +``` + +This code imports the preset with the origin naming convention. To import another preset, change `origin` to the preset name. + +**Examples:** + +```js +const legacyNaming = require('@bem/sdk.naming.presets/legacy'); +const originReactNaming = require('@bem/sdk.naming.presets/origin-react'); +const reactNaming = require('@bem/sdk.naming.presets/react'); +const twoDashesNaming = require('@bem/sdk.naming.presets/two-dashes'); +``` + +[RunKit live example](https://runkit.com/migs911/different-presets-from-bem-sdk-naming-presets-package). + +After you've imported the preset, you can use it for your own purposes, such as to create a `parse()` function from the [@bem/sdk.naming.entity.parse](https://github.com/bem/bem-sdk/tree/master/packages/naming.entity.parse) package. + +**Example:** + +```js +const originNaming = require('@bem/sdk.naming.presets/origin'); +const parse = require('@bem/sdk.naming.entity.parse')(originNaming); + +// Parse a block name. +parse('my-block'); + +// Parse an element name. +parse('my-block__my-element'); + +// Parse a block modifier name. +parse('my-block_my-modifier'); + +// Parse a block modifier name with a value. +parse('my-block_my-modifier_some-value'); + +// Parse an element modifier name. +parse('my-block__my-element_my-modifier'); + +// Parse an element modifier name with a value. +parse('my-block__my-element_my-modifier_some-value'); +``` + +[RunKit live example](https://runkit.com/migs911/parse-a-string-using-origin-naming-convention). + +### Creating a preset with a custom naming convention + +To create a preset with a custom naming convention, use the [create](#create) function. In the arguments, pass options that you want to overwrite in the default naming convention. For example, you can define that the values of modifiers are delimited with the equal sign (`=`). + +**Example:** + +```js +const myNamingOptions = { + delims: { + mod: { val: '=' } + } +}; +const myNaming = require('@bem/sdk.naming.presets/create')(myNamingOptions); + +// Parse a BEM entity name to test the created preset. +const parse = require('@bem/sdk.naming.entity.parse')(myNaming); +parse('my-block_my-modifier=some-value'); +/** + * => BemEntityName { + * block: 'my-block', + * mod: { name: 'my-modifier', val: 'some-value' } } + */ +``` + +[RunKit live example](https://runkit.com/migs911/create-preset-with-a-custom-naming-convention). + +## API Reference + +#### create() + +Creates a preset with the specified naming convention. + +This function will get all options from the default preset, overwrite them with the passed options and return the result. Options are overwritten in the following order: + +1. Options from the default preset. +2. Options from the `userDefaults` parameter. +3. Options from the `options` parameter. + +```js +/** + * @typedef INamingConventionDelims + * @property {string} elem — Separates an element name from block. + * @property {string|Object} mod — Separates a modifier name and the value of a modifier. + * @property {string} mod.name — Separates a modifier name from a block or an element. + * @property {string|boolean} mod.val — Separates the value of a modifier from the modifier name. + */ + +/** + * Returns created preset with the specified naming convention. + * + * @param {(Object|string)} [options] — User options or the name of the preset to return. + * If not specified, the default preset will be returned. + * @param {string} [options.preset] — Preset name that should be used as the default preset. + * @param {Object} [options.delims] — Strings to separate names of bem entities. + * This object has the same structure as `INamingConventionDelims`, + * but all properties inside are optional. + * @param {Object} [options.fs] — User options to separate names of files with bem entities. + * @param {Object} [options.fs.delims] — Strings to separate names of files in a BEM project. + * This object has the same structure as `INamingConventionDelims`, + * but all properties inside are optional. + * @param {string} [options.fs.pattern] — Pattern that describes the file structure of a BEM project.s + * @param {string} [options.fs.scheme] — Schema name that describes the file structure of one BEM entity. + * @param {string} [options.wordPattern] — A regular expression that will be used to match an entity name. + * @param {(Object|string)} [userDefaults] — User default options or the name of the preset to use. + * If the name of the preset is incorrect, the `origin` preset will be used. + * @returns {INamingConvention} — An object with `delims`, `fs` and `wordPattern` properties + * that describes the naming convention. + */ +create(options, userDefaults); +``` + +## Parameter tuning + +### Get the default preset + +You can use the `create()` function to get the default preset from this package. Call the `create()` function without parameters. + +```js +const defaultPreset = require('@bem/sdk.naming.presets/create')(); + +// Check that the origin preset is default. +const originPreset = require('@bem/sdk.naming.presets/origin'); +if (defaultPreset === originPreset) { + console.log('Origin is the default preset now.'); +} +``` + +[RunKit live example](https://runkit.com/migs911/get-the-default-preset). + +### Use another preset as default + +The default preset is `origin`, but you can set another preset as default in the `options.preset` parameter. + +**Example:** + +```js +const myNamingOptions = { + preset: 'two-dashes', + delims: { + mod: { val: '=' } + } +}; +const myNaming = require('@bem/sdk.naming.presets/create')(myNamingOptions); + +// Parse a BEM entity name to test the created preset. +const parse = require('@bem/sdk.naming.entity.parse')(myNaming); +parse('my-block--my-modifier=some-value'); +/** + * => BemEntityName { + * block: 'my-block', + * mod: { name: 'my-modifier', val: 'some-value' } } + */ +``` + +[RunKit live example](https://runkit.com/migs911/use-another-preset-as-default-via-presets-option). + +You can set the default preset in the `userDefaults` parameter. To use this method, pass the name of the preset in the second argument. + +**Example:** + +```js +const myNamingOptions = { + delims: { + mod: { val: '=' } + } +}; +const myNaming = require('@bem/sdk.naming.presets/create')(myNamingOptions, 'two-dashes'); + +// Parse a BEM entity name to test the created preset. +const parse = require('@bem/sdk.naming.entity.parse')(myNaming); +parse('my-block--my-modifier=some-value'); +/** + * => BemEntityName { + * block: 'my-block', + * mod: { name: 'my-modifier', val: 'some-value' } } + */ +``` + +[RunKit live example](https://runkit.com/migs911/use-another-preset-as-default-via-userdefaults-option). + +If you pass a preset name in the `userDefaults` parameter, it will completely overwrite the default preset. For example, all these lines return the `two-dashes` preset: + +```js +const createPreset = require('@bem/sdk.naming.presets/create'); +const twoDashesPreset1 = createPreset({ preset:'legacy' }, 'two-dashes'); +const twoDashesPreset2 = createPreset({}, 'two-dashes'); +const twoDashesPreset3 = require('@bem/sdk.naming.presets/two-dashes'); +``` + +### Pass an object with default options + +You can pass an object with default options to use it on the `userDefaults` level. Pass this object in the second argument of the `create()` function. + +**Example:** + +```js +const userDefaults = { + fs: { + delims: { + elem: '__', + mod: '_' + }, + scheme: 'flat' + } +} + +// Use well-known presets with the flat scheme. +const reactFlatPreset = require('@bem/sdk.naming.presets/create')({ preset: 'react' }, userDefaults); +const twoDashesFlatPreset = require('@bem/sdk.naming.presets/create')({ preset: 'two-dashes' }, userDefaults); + +// Create a custom preset with the flat scheme. +const customPreset = require('@bem/sdk.naming.presets/create')({ wordPattern: '[a-z]+' }, userDefaults); + +// Create preset with overwritten delimiters. +const presetOptions = { + delims: { + mod: { val: '='} + }, + fs: { + delims: { + mod: { val: '='} + } + } +} +const anotherPreset = require('@bem/sdk.naming.presets/create')(presetOptions, userDefaults); +``` + +[RunKit live example](https://runkit.com/migs911/use-an-object-with-default-options-to-create-preset-with). + + +## Naming conventions + +The main idea of the naming convention is to make names of [BEM entities](https://en.bem.info/methodology/key-concepts/#bem-entity) as informative and clear as possible. + +This package contains the following presets with naming conventions: + +* [origin](#origin) — Default naming convention. +* [legacy](#legacy) — Similar to the origin naming convention, but with a different file structure organization. +* [origin-react](#origin-react) — Mix of origin and react naming conventions. +* [react](#react) — Naming convention in React style. +* [two-dashes](#two-dashes) — According to this naming convention, modifiers are delimited by two hyphens (`--`). + +In addition, you can invent your own naming convention. To learn how to do this, see [Custom naming convention](#custom-naming-convention). + +### origin + +The BEM methodology provides an idea for creating naming rules and implements that idea in its canonical naming convention: [origin naming convention](#origin-naming-convention). + +**Word pattern:** + +Every name must match the regular expression: `[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*`. + +**Examples:** `my-element`, `myElement`, `element1`, `2element`. + +**Delimiters:** + +Elements are delimited with two underscores (`__`), while modifiers and values of modifiers are delimited by one underscore (`_`). + +Example: `my-block__my-element_my-modifier_some-value`. + +**File structure:** + +* BEM entities structure scheme: `nested`. +* Project structure pattern: `${layer?${layer}.}blocks/${entity}.${tech}`. + +**Examples:** + +``` +blocks/my-block.js +blocks/my-block/_my-modifier.js +blocks/my-block/__my-element.js +blocks/my-block/__my-element/_my-modifier_some-value.css +layer.blocks/my-block/__my-element/_my-modifier_some-value.css +``` + +### legacy + +This preset based on the [origin](#origin) preset but provides another project structure pattern. + +**Word pattern:** + +Every name must match the regular expression: `[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*`. + +**Examples:** `my-element`, `myElement`, `element1`, `2element`. + +**Delimiters:** + +Elements are delimited with two underscores (`__`), while modifiers and values of modifiers are delimited by one underscore (`_`). + +Example: `my-block__my-element_my-modifier_some-value`. + +**File structure:** + +* BEM entities structure scheme: `nested`. +* Project structure pattern: `${entity}${layer?@${layer}}.${tech}`. + +**Examples:** + +``` +my-block@layer.js +my-block/_my-modifier.js +my-block/__my-element@layer.js +my-block/__my-element/_my-modifier_some-value.css +my-block/__my-element/_my-modifier_some-value@layer.css +``` + +### origin-react + +The `origin-react` preset is an implementation of the [React style](https://en.bem.info/methodology/naming-convention/#react-style) naming convention. + +This preset is based on the [origin](#origin) preset but provides a different word pattern and element delimiters. + +**Word pattern:** + +Every name must match the regular expression: `[a-zA-Z0-9]+`. + +**Examples:** `MyElement`, `myModifier`, `modValue1`. + +**Delimiters:** + +Elements are delimited by one hyphen (`-`), while modifiers and values of modifiers are delimited by one underscore (`_`). + +Example: `MyBlock-MyElement_myModifier_modValue`. + +**File structure:** + +* Element names in the file structure don't have any delimiters. +* BEM entities structure scheme: `nested`. +* Project structure pattern: `${layer?${layer}.}blocks/${entity}.${tech}`. + +**Examples:** + +``` +blocks/MyBlock.js +blocks/MyBlock/_myModifier.js +blocks/MyBlock/MyElement.js +blocks/MyBlock/MyElement/_myModifier_modValue.css +layer.blocks/MyBlock/MyElement/_myModifier_modValue.css +``` + +### react + +The `react` preset is an implementation of the [React style](https://en.bem.info/methodology/naming-convention/#react-style) naming convention. + +This preset is based on the [origin-react](#origin-react) preset but provides another project structure pattern like in the [legacy](#legacy) preset. + +**Word pattern:** + +Every name must match the regular expression: `[a-zA-Z0-9]+`. + +**Examples:** `MyElement`, `myModifier`, `modValue1`. + +**Delimiters:** + +Elements are delimited by one hyphen (`-`), while modifiers and values of modifiers are delimited by one underscore (`_`). + +Example: `MyBlock-MyElement_myModifier_modValue`. + +**File structure:** + +* Element names in the file structure don't have any delimiters. +* BEM entities structure scheme: `nested`. +* Project structure pattern: `${entity}${layer?@${layer}}.${tech}`. + +**Examples:** + +``` +MyBlock.js +MyBlock@layer.js +MyBlock/_myModifier.js +MyBlock/_myModifier@layer.js +MyBlock/MyElement/_myModifier_modValue.css +MyBlock/MyElement/_myModifier_modValue@layer.css +``` + +### two-dashes + +The `two-dashes` preset is an implementation of the [Two Dashes style](https://en.bem.info/methodology/naming-convention/#two-dashes-style) naming convention. + +This preset is based on the [origin](#origin) preset but modifiers are delimited by two hyphens (`--`). + +**Word pattern:** + +Every name must match the regular expression: `[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*`. + +**Examples:** `my-element`, `myElement`, `element1`, `2element`. + +**Delimiters:** + +Elements are delimited with two underscores (`__`), while modifiers are delimited by two hyphens (`--`), and values of modifiers are delimited by one underscore (`_`). + +Example: `my-block__my-element--my-modifier_some-value`. + +**File structure:** + +* BEM entities structure scheme: `nested`. +* Project structure pattern: `${layer?${layer}.}blocks/${entity}.${tech}`. + +**Examples:** + +``` +blocks/my-block/--my-modifier.js +blocks/my-block/__my-element/--my-modifier_some-value.css +my-layer.blocks/my-block/__my-element/--my-modifier_some-value.css +``` diff --git a/node_modules/@bem/sdk.naming.presets/create.js b/node_modules/@bem/sdk.naming.presets/create.js new file mode 100644 index 0000000..5d5fdbe --- /dev/null +++ b/node_modules/@bem/sdk.naming.presets/create.js @@ -0,0 +1,74 @@ +'use strict'; + +var presets = require('.'); + +var DEFAULT_PRESET = 'origin'; + +module.exports = init; + +/** + * Returns an object with `delims`, `fs` and `wordPattern` properties + * that describes the naming convention. + * + * @param {(Object|string)} [options] — user options or preset name. + * If not specified, default preset will be returned. + * @param {string} [options.preset] — preset name that should be used as default preset. + * @param {Object} [options.delims] — strings to separate names of bem entities. + * This object has the same structure with `INamingConventionDelims`, + * but all properties inside are optional. + * @param {Object} [options.fs] — user options to separate names of files with bem entities. + * @param {Object} [options.fs.delims] — strings to separate names of files in a BEM project. + * This object has the same structure with `INamingConventionDelims`, + * but all properties inside are optional. + * @param {string} [options.fs.pattern] — pattern that describes the file structure of a BEM project.s + * @param {string} [options.fs.scheme] — schema name that describes the file structure of one BEM entity. + * @param {string} [options.wordPattern] — a regular expression that will be used to match an entity name. + * @param {(Object|string)} [userDefaults] — default options that will override the options from default preset. + * @returns {INamingConvention} + */ +function init(options, userDefaults) { + if (!options) { + return presets[DEFAULT_PRESET]; + } + + if (typeof options === 'string') { + var preset = presets[options]; + + if (!preset) { + throw new Error('The `' + options + '` naming is unknown.'); + } + + return preset; + } + + var defaultPreset = options.preset || DEFAULT_PRESET; + + // TODO: Warn about incorrect preset + if (typeof userDefaults === 'string') { + userDefaults = presets[userDefaults] || presets[DEFAULT_PRESET]; + } else if (!userDefaults) { + userDefaults = {}; + } + + var defaults = presets[defaultPreset]; + var defaultDelims = userDefaults.delims || defaults.delims; + var defaultModDelims = userDefaults.mod || defaultDelims.mod; + var optionsDelims = options.delims || {}; + var mod = optionsDelims.mod || defaultModDelims; + + const res = { + delims: { + elem: optionsDelims.elem || userDefaults.elem || defaultDelims.elem, + mod: typeof mod === 'string' + ? { name: mod, val: mod } + : { + name: mod.name || defaultModDelims.name, + val: mod.val || defaultModDelims.val + } + }, + fs: Object.assign({}, defaults.fs, userDefaults.fs, options.fs), + wordPattern: options.wordPattern || userDefaults.wordPattern || defaults.wordPattern + }; + + return res; +} diff --git a/node_modules/@bem/sdk.naming.presets/index.d.ts b/node_modules/@bem/sdk.naming.presets/index.d.ts new file mode 100644 index 0000000..014e73a --- /dev/null +++ b/node_modules/@bem/sdk.naming.presets/index.d.ts @@ -0,0 +1,23 @@ +declare module '@bem/sdk.naming.presets' { + interface INamingConventionDelims { + elem: string; + mod: string | { + name: string; + val: string; + }; + } + + export interface INamingConvention { + delims: INamingConventionDelims; + fs: { + pattern: string; + scheme: string; + delims: INamingConventionDelims; + }; + wordPattern: string; + } + + // TODO: Add export for two-dashes (https://github.com/bem/bem-sdk/issues/315) + export const react: INamingConvention; + export const origin: INamingConvention; +} diff --git a/node_modules/@bem/sdk.naming.presets/index.js b/node_modules/@bem/sdk.naming.presets/index.js new file mode 100644 index 0000000..4a06d14 --- /dev/null +++ b/node_modules/@bem/sdk.naming.presets/index.js @@ -0,0 +1,9 @@ +'use strict'; + +exports.default = require('./legacy'); + +exports.legacy = require('./legacy'); +exports.origin = require('./origin'); +exports.react = require('./react'); +exports['origin-react'] = require('./origin-react'); +exports['two-dashes'] = require('./two-dashes'); diff --git a/node_modules/@bem/sdk.naming.presets/legacy.js b/node_modules/@bem/sdk.naming.presets/legacy.js new file mode 100644 index 0000000..d65119d --- /dev/null +++ b/node_modules/@bem/sdk.naming.presets/legacy.js @@ -0,0 +1,9 @@ +'use strict'; + +const origin = require('./origin'); + +module.exports = Object.assign({}, origin, { + fs: Object.assign({}, origin.fs, { + pattern: '${entity}${layer?@${layer}}.${tech}', + }) +}); diff --git a/node_modules/@bem/sdk.naming.presets/origin-react.js b/node_modules/@bem/sdk.naming.presets/origin-react.js new file mode 100644 index 0000000..761ff2c --- /dev/null +++ b/node_modules/@bem/sdk.naming.presets/origin-react.js @@ -0,0 +1,13 @@ +'use strict'; + +const origin = require('./origin'); + +module.exports = Object.assign({}, origin, { + delims: Object.assign({}, origin.delims, { + elem: '-' + }), + fs: Object.assign({}, origin.fs, { + delims: { elem: '' } + }), + wordPattern: '[a-zA-Z0-9]+' +}); diff --git a/node_modules/@bem/sdk.naming.presets/origin.js b/node_modules/@bem/sdk.naming.presets/origin.js new file mode 100644 index 0000000..bbbf295 --- /dev/null +++ b/node_modules/@bem/sdk.naming.presets/origin.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = { + delims: { + elem: '__', + mod: { name: '_', val: '_' } + }, + fs: { + // delims: { elem: '__', mod: '_' }, // redundand because of defaults + pattern: '${layer?${layer}.}blocks/${entity}.${tech}', + scheme: 'nested' + }, + wordPattern: '[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*' +}; diff --git a/node_modules/@bem/sdk.naming.presets/package.json b/node_modules/@bem/sdk.naming.presets/package.json new file mode 100644 index 0000000..45f5e47 --- /dev/null +++ b/node_modules/@bem/sdk.naming.presets/package.json @@ -0,0 +1,125 @@ +{ + "_args": [ + [ + "@bem/sdk.naming.presets@^0.2.3", + "/mnt/c/users/1/Documents/Frontend/task2/node_modules/@bem/sdk.naming.entity" + ] + ], + "_from": "@bem/sdk.naming.presets@>=0.2.3 <0.3.0", + "_hasShrinkwrap": false, + "_id": "@bem/sdk.naming.presets@0.2.3", + "_inCache": true, + "_installable": true, + "_location": "/@bem/sdk.naming.presets", + "_nodeVersion": "8.6.0", + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/sdk.naming.presets_0.2.3_1549205361621_0.5075756520814805" + }, + "_npmUser": { + "email": "zxqfox@gmail.com", + "name": "qfox" + }, + "_npmVersion": "lerna/3.10.5/node@v8.6.0+x64 (darwin)", + "_phantomChildren": {}, + "_requested": { + "name": "@bem/sdk.naming.presets", + "raw": "@bem/sdk.naming.presets@^0.2.3", + "rawSpec": "^0.2.3", + "scope": "@bem", + "spec": ">=0.2.3 <0.3.0", + "type": "range" + }, + "_requiredBy": [ + "/@bem/sdk.naming.entity" + ], + "_resolved": "https://registry.npmjs.org/@bem/sdk.naming.presets/-/sdk.naming.presets-0.2.3.tgz", + "_shasum": "d0c1141b5adb1412e5fcf9f903c9572181cc7400", + "_shrinkwrap": null, + "_spec": "@bem/sdk.naming.presets@^0.2.3", + "_where": "/mnt/c/users/1/Documents/Frontend/task2/node_modules/@bem/sdk.naming.entity", + "author": { + "email": "zxqfox@gmail.com", + "name": "Alexej Yaroshevich", + "url": "http://github.com/zxqfox" + }, + "bugs": { + "url": "https://github.com/bem/bem-sdk/issues?q=label%3Apkg%3Anaming.presets" + }, + "dependencies": {}, + "description": "Presets for naming", + "devDependencies": { + "@bem/sdk.cell": "^0.2.9", + "@bem/sdk.entity-name": "^0.2.11", + "@bem/sdk.naming.cell.stringify": "^0.0.13", + "@bem/sdk.naming.entity": "^0.2.11" + }, + "directories": {}, + "dist": { + "fileCount": 12, + "integrity": "sha512-nJTRRoD1xqrPwthPZdty/AEVVZckfC7EUld35r9qmNt18JQE8LKT9bjexjGZDB+mT5MJN5ogWa7mDOCGaZfP+g==", + "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVv9yCRA9TVsSAnZWagAATSEP/16czhIBPgG+QOetm0QH\nkM8CcHnQNMt2baR61EJz4No8dQusNEmdddvEY+tqVODCD6sWwvkmZIPvRu8U\nHMzZ0pXAL4XH3QwJ2rEPOPCi7xRk8GwpmZPDKvmSVKLV0Du8x0EuqEvlRMZL\ncA52mEQCa+N5J7IoehZM33nPTel2z1aUpVaehnaYrjlfuCXGMZyc+TmXWgcj\n3ydI+moQnvYxjb8hXMkfY1jUcmkXbKEfBCKWWcw8wh32/C3Rp9tm2mCPaw/7\n3NgxqFl12d7qTfigvr9lbaCB0HKMf0Ifzoej2hfKLv0WenqUWlDOSlpg3FaI\nMdPXfva57pcFIKbamwUDvSkVmJErL2SXDbWmZcwoeNjOh+1s08HstP1nztqK\nhip0Rxtqr07vLh0BNgDOOXNCKcGP60PBeZ66Gf+gjMOXK1HmJEJnFe8dPJs5\n6SupfUq6bHKPMkZOg+H0/awm/IRkyzCkpDxAiEAsL9idIPO5PXcquV2R13bi\ndjtFyCc0LnXcaabqsZ0HN3G/htTjj+zWg7wbaHH4t26cR1Kxj3SwuJZ/AbBo\nU+GpcH/t8n9ygZlxQq1Wap4le2RPJaqTg82/7PSohqmr6Z2n/4+QaZI4VGiW\nW2y5vICrAGhInFgJGEBiCxXwj+TDC+X2YKwiVLXnaXDGcY3JhEQBnlPI+P3n\neMs+\r\n=GfZl\r\n-----END PGP SIGNATURE-----\r\n", + "shasum": "d0c1141b5adb1412e5fcf9f903c9572181cc7400", + "tarball": "https://registry.npmjs.org/@bem/sdk.naming.presets/-/sdk.naming.presets-0.2.3.tgz", + "unpackedSize": 42053 + }, + "engines": { + "node": ">= 8.0" + }, + "gitHead": "1ec9066d241303e5dc2abc01171f111effffff3a", + "homepage": "https://github.com/bem/bem-sdk/tree/master/packages/naming.presets#readme", + "keywords": [ + "bem", + "cell", + "conventions", + "entity", + "name", + "naming", + "origin", + "react", + "two-dashes" + ], + "license": "MPL-2.0", + "main": "index.js", + "maintainers": [ + { + "name": "blond", + "email": "mail@blond.im" + }, + { + "name": "qfox", + "email": "zxqfox@gmail.com" + }, + { + "name": "tadatuta", + "email": "i@tadatuta.com" + }, + { + "name": "veged", + "email": "veged@ya.ru" + }, + { + "name": "vithar", + "email": "vitaly@harisov.name" + }, + { + "name": "yeti-or", + "email": "yeti.or@gmail.com" + } + ], + "name": "@bem/sdk.naming.presets", + "optionalDependencies": {}, + "publishConfig": { + "access": "public" + }, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/bem/bem-sdk.git" + }, + "scripts": { + "test": "nyc mocha" + }, + "typings": "index.d.ts", + "version": "0.2.3" +} diff --git a/node_modules/@bem/sdk.naming.presets/react.js b/node_modules/@bem/sdk.naming.presets/react.js new file mode 100644 index 0000000..11e9cf7 --- /dev/null +++ b/node_modules/@bem/sdk.naming.presets/react.js @@ -0,0 +1,9 @@ +'use strict'; + +const base = require('./origin-react'); + +module.exports = Object.assign({}, base, { + fs: Object.assign(base.fs, { + pattern: '${entity}${layer?@${layer}}.${tech}' + }) +}); diff --git a/node_modules/@bem/sdk.naming.presets/two-dashes.js b/node_modules/@bem/sdk.naming.presets/two-dashes.js new file mode 100644 index 0000000..b45174c --- /dev/null +++ b/node_modules/@bem/sdk.naming.presets/two-dashes.js @@ -0,0 +1,10 @@ +'use strict'; + +const origin = require('./origin'); + +module.exports = Object.assign({}, origin, { + delims: { + elem: '__', + mod: { name: '--', val: '_' } + } +}); diff --git a/node_modules/depd/History.md b/node_modules/depd/History.md new file mode 100644 index 0000000..ace1171 --- /dev/null +++ b/node_modules/depd/History.md @@ -0,0 +1,84 @@ +1.1.0 / 2015-09-14 +================== + + * Enable strict mode in more places + * Support io.js 3.x + * Support io.js 2.x + * Support web browser loading + - Requires bundler like Browserify or webpack + +1.0.1 / 2015-04-07 +================== + + * Fix `TypeError`s when under `'use strict'` code + * Fix useless type name on auto-generated messages + * Support io.js 1.x + * Support Node.js 0.12 + +1.0.0 / 2014-09-17 +================== + + * No changes + +0.4.5 / 2014-09-09 +================== + + * Improve call speed to functions using the function wrapper + * Support Node.js 0.6 + +0.4.4 / 2014-07-27 +================== + + * Work-around v8 generating empty stack traces + +0.4.3 / 2014-07-26 +================== + + * Fix exception when global `Error.stackTraceLimit` is too low + +0.4.2 / 2014-07-19 +================== + + * Correct call site for wrapped functions and properties + +0.4.1 / 2014-07-19 +================== + + * Improve automatic message generation for function properties + +0.4.0 / 2014-07-19 +================== + + * Add `TRACE_DEPRECATION` environment variable + * Remove non-standard grey color from color output + * Support `--no-deprecation` argument + * Support `--trace-deprecation` argument + * Support `deprecate.property(fn, prop, message)` + +0.3.0 / 2014-06-16 +================== + + * Add `NO_DEPRECATION` environment variable + +0.2.0 / 2014-06-15 +================== + + * Add `deprecate.property(obj, prop, message)` + * Remove `supports-color` dependency for node.js 0.8 + +0.1.0 / 2014-06-15 +================== + + * Add `deprecate.function(fn, message)` + * Add `process.on('deprecation', fn)` emitter + * Automatically generate message when omitted from `deprecate()` + +0.0.1 / 2014-06-15 +================== + + * Fix warning for dynamic calls at singe call site + +0.0.0 / 2014-06-15 +================== + + * Initial implementation diff --git a/node_modules/depd/LICENSE b/node_modules/depd/LICENSE new file mode 100644 index 0000000..142ede3 --- /dev/null +++ b/node_modules/depd/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/depd/Readme.md b/node_modules/depd/Readme.md new file mode 100644 index 0000000..09bb979 --- /dev/null +++ b/node_modules/depd/Readme.md @@ -0,0 +1,281 @@ +# depd + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Linux Build][travis-image]][travis-url] +[![Windows Build][appveyor-image]][appveyor-url] +[![Coverage Status][coveralls-image]][coveralls-url] +[![Gratipay][gratipay-image]][gratipay-url] + +Deprecate all the things + +> With great modules comes great responsibility; mark things deprecated! + +## Install + +This module is installed directly using `npm`: + +```sh +$ npm install depd +``` + +This module can also be bundled with systems like +[Browserify](http://browserify.org/) or [webpack](https://webpack.github.io/), +though by default this module will alter it's API to no longer display or +track deprecations. + +## API + +```js +var deprecate = require('depd')('my-module') +``` + +This library allows you to display deprecation messages to your users. +This library goes above and beyond with deprecation warnings by +introspection of the call stack (but only the bits that it is interested +in). + +Instead of just warning on the first invocation of a deprecated +function and never again, this module will warn on the first invocation +of a deprecated function per unique call site, making it ideal to alert +users of all deprecated uses across the code base, rather than just +whatever happens to execute first. + +The deprecation warnings from this module also include the file and line +information for the call into the module that the deprecated function was +in. + +**NOTE** this library has a similar interface to the `debug` module, and +this module uses the calling file to get the boundary for the call stacks, +so you should always create a new `deprecate` object in each file and not +within some central file. + +### depd(namespace) + +Create a new deprecate function that uses the given namespace name in the +messages and will display the call site prior to the stack entering the +file this function was called from. It is highly suggested you use the +name of your module as the namespace. + +### deprecate(message) + +Call this function from deprecated code to display a deprecation message. +This message will appear once per unique caller site. Caller site is the +first call site in the stack in a different file from the caller of this +function. + +If the message is omitted, a message is generated for you based on the site +of the `deprecate()` call and will display the name of the function called, +similar to the name displayed in a stack trace. + +### deprecate.function(fn, message) + +Call this function to wrap a given function in a deprecation message on any +call to the function. An optional message can be supplied to provide a custom +message. + +### deprecate.property(obj, prop, message) + +Call this function to wrap a given property on object in a deprecation message +on any accessing or setting of the property. An optional message can be supplied +to provide a custom message. + +The method must be called on the object where the property belongs (not +inherited from the prototype). + +If the property is a data descriptor, it will be converted to an accessor +descriptor in order to display the deprecation message. + +### process.on('deprecation', fn) + +This module will allow easy capturing of deprecation errors by emitting the +errors as the type "deprecation" on the global `process`. If there are no +listeners for this type, the errors are written to STDERR as normal, but if +there are any listeners, nothing will be written to STDERR and instead only +emitted. From there, you can write the errors in a different format or to a +logging source. + +The error represents the deprecation and is emitted only once with the same +rules as writing to STDERR. The error has the following properties: + + - `message` - This is the message given by the library + - `name` - This is always `'DeprecationError'` + - `namespace` - This is the namespace the deprecation came from + - `stack` - This is the stack of the call to the deprecated thing + +Example `error.stack` output: + +``` +DeprecationError: my-cool-module deprecated oldfunction + at Object. ([eval]-wrapper:6:22) + at Module._compile (module.js:456:26) + at evalScript (node.js:532:25) + at startup (node.js:80:7) + at node.js:902:3 +``` + +### process.env.NO_DEPRECATION + +As a user of modules that are deprecated, the environment variable `NO_DEPRECATION` +is provided as a quick solution to silencing deprecation warnings from being +output. The format of this is similar to that of `DEBUG`: + +```sh +$ NO_DEPRECATION=my-module,othermod node app.js +``` + +This will suppress deprecations from being output for "my-module" and "othermod". +The value is a list of comma-separated namespaces. To suppress every warning +across all namespaces, use the value `*` for a namespace. + +Providing the argument `--no-deprecation` to the `node` executable will suppress +all deprecations (only available in Node.js 0.8 or higher). + +**NOTE** This will not suppress the deperecations given to any "deprecation" +event listeners, just the output to STDERR. + +### process.env.TRACE_DEPRECATION + +As a user of modules that are deprecated, the environment variable `TRACE_DEPRECATION` +is provided as a solution to getting more detailed location information in deprecation +warnings by including the entire stack trace. The format of this is the same as +`NO_DEPRECATION`: + +```sh +$ TRACE_DEPRECATION=my-module,othermod node app.js +``` + +This will include stack traces for deprecations being output for "my-module" and +"othermod". The value is a list of comma-separated namespaces. To trace every +warning across all namespaces, use the value `*` for a namespace. + +Providing the argument `--trace-deprecation` to the `node` executable will trace +all deprecations (only available in Node.js 0.8 or higher). + +**NOTE** This will not trace the deperecations silenced by `NO_DEPRECATION`. + +## Display + +![message](files/message.png) + +When a user calls a function in your library that you mark deprecated, they +will see the following written to STDERR (in the given colors, similar colors +and layout to the `debug` module): + +``` +bright cyan bright yellow +| | reset cyan +| | | | +▼ ▼ ▼ ▼ +my-cool-module deprecated oldfunction [eval]-wrapper:6:22 +▲ ▲ ▲ ▲ +| | | | +namespace | | location of mycoolmod.oldfunction() call + | deprecation message + the word "deprecated" +``` + +If the user redirects their STDERR to a file or somewhere that does not support +colors, they see (similar layout to the `debug` module): + +``` +Sun, 15 Jun 2014 05:21:37 GMT my-cool-module deprecated oldfunction at [eval]-wrapper:6:22 +▲ ▲ ▲ ▲ ▲ +| | | | | +timestamp of message namespace | | location of mycoolmod.oldfunction() call + | deprecation message + the word "deprecated" +``` + +## Examples + +### Deprecating all calls to a function + +This will display a deprecated message about "oldfunction" being deprecated +from "my-module" on STDERR. + +```js +var deprecate = require('depd')('my-cool-module') + +// message automatically derived from function name +// Object.oldfunction +exports.oldfunction = deprecate.function(function oldfunction() { + // all calls to function are deprecated +}) + +// specific message +exports.oldfunction = deprecate.function(function () { + // all calls to function are deprecated +}, 'oldfunction') +``` + +### Conditionally deprecating a function call + +This will display a deprecated message about "weirdfunction" being deprecated +from "my-module" on STDERR when called with less than 2 arguments. + +```js +var deprecate = require('depd')('my-cool-module') + +exports.weirdfunction = function () { + if (arguments.length < 2) { + // calls with 0 or 1 args are deprecated + deprecate('weirdfunction args < 2') + } +} +``` + +When calling `deprecate` as a function, the warning is counted per call site +within your own module, so you can display different deprecations depending +on different situations and the users will still get all the warnings: + +```js +var deprecate = require('depd')('my-cool-module') + +exports.weirdfunction = function () { + if (arguments.length < 2) { + // calls with 0 or 1 args are deprecated + deprecate('weirdfunction args < 2') + } else if (typeof arguments[0] !== 'string') { + // calls with non-string first argument are deprecated + deprecate('weirdfunction non-string first arg') + } +} +``` + +### Deprecating property access + +This will display a deprecated message about "oldprop" being deprecated +from "my-module" on STDERR when accessed. A deprecation will be displayed +when setting the value and when getting the value. + +```js +var deprecate = require('depd')('my-cool-module') + +exports.oldprop = 'something' + +// message automatically derives from property name +deprecate.property(exports, 'oldprop') + +// explicit message +deprecate.property(exports, 'oldprop', 'oldprop >= 0.10') +``` + +## License + +[MIT](LICENSE) + +[npm-version-image]: https://img.shields.io/npm/v/depd.svg +[npm-downloads-image]: https://img.shields.io/npm/dm/depd.svg +[npm-url]: https://npmjs.org/package/depd +[travis-image]: https://img.shields.io/travis/dougwilson/nodejs-depd/master.svg?label=linux +[travis-url]: https://travis-ci.org/dougwilson/nodejs-depd +[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/nodejs-depd/master.svg?label=windows +[appveyor-url]: https://ci.appveyor.com/project/dougwilson/nodejs-depd +[coveralls-image]: https://img.shields.io/coveralls/dougwilson/nodejs-depd/master.svg +[coveralls-url]: https://coveralls.io/r/dougwilson/nodejs-depd?branch=master +[node-image]: https://img.shields.io/node/v/depd.svg +[node-url]: http://nodejs.org/download/ +[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg +[gratipay-url]: https://www.gratipay.com/dougwilson/ diff --git a/node_modules/depd/index.js b/node_modules/depd/index.js new file mode 100644 index 0000000..fddcae8 --- /dev/null +++ b/node_modules/depd/index.js @@ -0,0 +1,521 @@ +/*! + * depd + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var callSiteToString = require('./lib/compat').callSiteToString +var eventListenerCount = require('./lib/compat').eventListenerCount +var relative = require('path').relative + +/** + * Module exports. + */ + +module.exports = depd + +/** + * Get the path to base files on. + */ + +var basePath = process.cwd() + +/** + * Determine if namespace is contained in the string. + */ + +function containsNamespace(str, namespace) { + var val = str.split(/[ ,]+/) + + namespace = String(namespace).toLowerCase() + + for (var i = 0 ; i < val.length; i++) { + if (!(str = val[i])) continue; + + // namespace contained + if (str === '*' || str.toLowerCase() === namespace) { + return true + } + } + + return false +} + +/** + * Convert a data descriptor to accessor descriptor. + */ + +function convertDataDescriptorToAccessor(obj, prop, message) { + var descriptor = Object.getOwnPropertyDescriptor(obj, prop) + var value = descriptor.value + + descriptor.get = function getter() { return value } + + if (descriptor.writable) { + descriptor.set = function setter(val) { return value = val } + } + + delete descriptor.value + delete descriptor.writable + + Object.defineProperty(obj, prop, descriptor) + + return descriptor +} + +/** + * Create arguments string to keep arity. + */ + +function createArgumentsString(arity) { + var str = '' + + for (var i = 0; i < arity; i++) { + str += ', arg' + i + } + + return str.substr(2) +} + +/** + * Create stack string from stack. + */ + +function createStackString(stack) { + var str = this.name + ': ' + this.namespace + + if (this.message) { + str += ' deprecated ' + this.message + } + + for (var i = 0; i < stack.length; i++) { + str += '\n at ' + callSiteToString(stack[i]) + } + + return str +} + +/** + * Create deprecate for namespace in caller. + */ + +function depd(namespace) { + if (!namespace) { + throw new TypeError('argument namespace is required') + } + + var stack = getStack() + var site = callSiteLocation(stack[1]) + var file = site[0] + + function deprecate(message) { + // call to self as log + log.call(deprecate, message) + } + + deprecate._file = file + deprecate._ignored = isignored(namespace) + deprecate._namespace = namespace + deprecate._traced = istraced(namespace) + deprecate._warned = Object.create(null) + + deprecate.function = wrapfunction + deprecate.property = wrapproperty + + return deprecate +} + +/** + * Determine if namespace is ignored. + */ + +function isignored(namespace) { + /* istanbul ignore next: tested in a child processs */ + if (process.noDeprecation) { + // --no-deprecation support + return true + } + + var str = process.env.NO_DEPRECATION || '' + + // namespace ignored + return containsNamespace(str, namespace) +} + +/** + * Determine if namespace is traced. + */ + +function istraced(namespace) { + /* istanbul ignore next: tested in a child processs */ + if (process.traceDeprecation) { + // --trace-deprecation support + return true + } + + var str = process.env.TRACE_DEPRECATION || '' + + // namespace traced + return containsNamespace(str, namespace) +} + +/** + * Display deprecation message. + */ + +function log(message, site) { + var haslisteners = eventListenerCount(process, 'deprecation') !== 0 + + // abort early if no destination + if (!haslisteners && this._ignored) { + return + } + + var caller + var callFile + var callSite + var i = 0 + var seen = false + var stack = getStack() + var file = this._file + + if (site) { + // provided site + callSite = callSiteLocation(stack[1]) + callSite.name = site.name + file = callSite[0] + } else { + // get call site + i = 2 + site = callSiteLocation(stack[i]) + callSite = site + } + + // get caller of deprecated thing in relation to file + for (; i < stack.length; i++) { + caller = callSiteLocation(stack[i]) + callFile = caller[0] + + if (callFile === file) { + seen = true + } else if (callFile === this._file) { + file = this._file + } else if (seen) { + break + } + } + + var key = caller + ? site.join(':') + '__' + caller.join(':') + : undefined + + if (key !== undefined && key in this._warned) { + // already warned + return + } + + this._warned[key] = true + + // generate automatic message from call site + if (!message) { + message = callSite === site || !callSite.name + ? defaultMessage(site) + : defaultMessage(callSite) + } + + // emit deprecation if listeners exist + if (haslisteners) { + var err = DeprecationError(this._namespace, message, stack.slice(i)) + process.emit('deprecation', err) + return + } + + // format and write message + var format = process.stderr.isTTY + ? formatColor + : formatPlain + var msg = format.call(this, message, caller, stack.slice(i)) + process.stderr.write(msg + '\n', 'utf8') + + return +} + +/** + * Get call site location as array. + */ + +function callSiteLocation(callSite) { + var file = callSite.getFileName() || '' + var line = callSite.getLineNumber() + var colm = callSite.getColumnNumber() + + if (callSite.isEval()) { + file = callSite.getEvalOrigin() + ', ' + file + } + + var site = [file, line, colm] + + site.callSite = callSite + site.name = callSite.getFunctionName() + + return site +} + +/** + * Generate a default message from the site. + */ + +function defaultMessage(site) { + var callSite = site.callSite + var funcName = site.name + + // make useful anonymous name + if (!funcName) { + funcName = '' + } + + var context = callSite.getThis() + var typeName = context && callSite.getTypeName() + + // ignore useless type name + if (typeName === 'Object') { + typeName = undefined + } + + // make useful type name + if (typeName === 'Function') { + typeName = context.name || typeName + } + + return typeName && callSite.getMethodName() + ? typeName + '.' + funcName + : funcName +} + +/** + * Format deprecation message without color. + */ + +function formatPlain(msg, caller, stack) { + var timestamp = new Date().toUTCString() + + var formatted = timestamp + + ' ' + this._namespace + + ' deprecated ' + msg + + // add stack trace + if (this._traced) { + for (var i = 0; i < stack.length; i++) { + formatted += '\n at ' + callSiteToString(stack[i]) + } + + return formatted + } + + if (caller) { + formatted += ' at ' + formatLocation(caller) + } + + return formatted +} + +/** + * Format deprecation message with color. + */ + +function formatColor(msg, caller, stack) { + var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' // bold cyan + + ' \x1b[33;1mdeprecated\x1b[22;39m' // bold yellow + + ' \x1b[0m' + msg + '\x1b[39m' // reset + + // add stack trace + if (this._traced) { + for (var i = 0; i < stack.length; i++) { + formatted += '\n \x1b[36mat ' + callSiteToString(stack[i]) + '\x1b[39m' // cyan + } + + return formatted + } + + if (caller) { + formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m' // cyan + } + + return formatted +} + +/** + * Format call site location. + */ + +function formatLocation(callSite) { + return relative(basePath, callSite[0]) + + ':' + callSite[1] + + ':' + callSite[2] +} + +/** + * Get the stack as array of call sites. + */ + +function getStack() { + var limit = Error.stackTraceLimit + var obj = {} + var prep = Error.prepareStackTrace + + Error.prepareStackTrace = prepareObjectStackTrace + Error.stackTraceLimit = Math.max(10, limit) + + // capture the stack + Error.captureStackTrace(obj) + + // slice this function off the top + var stack = obj.stack.slice(1) + + Error.prepareStackTrace = prep + Error.stackTraceLimit = limit + + return stack +} + +/** + * Capture call site stack from v8. + */ + +function prepareObjectStackTrace(obj, stack) { + return stack +} + +/** + * Return a wrapped function in a deprecation message. + */ + +function wrapfunction(fn, message) { + if (typeof fn !== 'function') { + throw new TypeError('argument fn must be a function') + } + + var args = createArgumentsString(fn.length) + var deprecate = this + var stack = getStack() + var site = callSiteLocation(stack[1]) + + site.name = fn.name + + var deprecatedfn = eval('(function (' + args + ') {\n' + + '"use strict"\n' + + 'log.call(deprecate, message, site)\n' + + 'return fn.apply(this, arguments)\n' + + '})') + + return deprecatedfn +} + +/** + * Wrap property in a deprecation message. + */ + +function wrapproperty(obj, prop, message) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new TypeError('argument obj must be object') + } + + var descriptor = Object.getOwnPropertyDescriptor(obj, prop) + + if (!descriptor) { + throw new TypeError('must call property on owner object') + } + + if (!descriptor.configurable) { + throw new TypeError('property must be configurable') + } + + var deprecate = this + var stack = getStack() + var site = callSiteLocation(stack[1]) + + // set site name + site.name = prop + + // convert data descriptor + if ('value' in descriptor) { + descriptor = convertDataDescriptorToAccessor(obj, prop, message) + } + + var get = descriptor.get + var set = descriptor.set + + // wrap getter + if (typeof get === 'function') { + descriptor.get = function getter() { + log.call(deprecate, message, site) + return get.apply(this, arguments) + } + } + + // wrap setter + if (typeof set === 'function') { + descriptor.set = function setter() { + log.call(deprecate, message, site) + return set.apply(this, arguments) + } + } + + Object.defineProperty(obj, prop, descriptor) +} + +/** + * Create DeprecationError for deprecation + */ + +function DeprecationError(namespace, message, stack) { + var error = new Error() + var stackString + + Object.defineProperty(error, 'constructor', { + value: DeprecationError + }) + + Object.defineProperty(error, 'message', { + configurable: true, + enumerable: false, + value: message, + writable: true + }) + + Object.defineProperty(error, 'name', { + enumerable: false, + configurable: true, + value: 'DeprecationError', + writable: true + }) + + Object.defineProperty(error, 'namespace', { + configurable: true, + enumerable: false, + value: namespace, + writable: true + }) + + Object.defineProperty(error, 'stack', { + configurable: true, + enumerable: false, + get: function () { + if (stackString !== undefined) { + return stackString + } + + // prepare stack trace + return stackString = createStackString.call(this, stack) + }, + set: function setter(val) { + stackString = val + } + }) + + return error +} diff --git a/node_modules/depd/lib/browser/index.js b/node_modules/depd/lib/browser/index.js new file mode 100644 index 0000000..f464e05 --- /dev/null +++ b/node_modules/depd/lib/browser/index.js @@ -0,0 +1,79 @@ +/*! + * depd + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = depd + +/** + * Create deprecate for namespace in caller. + */ + +function depd(namespace) { + if (!namespace) { + throw new TypeError('argument namespace is required') + } + + function deprecate(message) { + // no-op in browser + } + + deprecate._file = undefined + deprecate._ignored = true + deprecate._namespace = namespace + deprecate._traced = false + deprecate._warned = Object.create(null) + + deprecate.function = wrapfunction + deprecate.property = wrapproperty + + return deprecate +} + +/** + * Return a wrapped function in a deprecation message. + * + * This is a no-op version of the wrapper, which does nothing but call + * validation. + */ + +function wrapfunction(fn, message) { + if (typeof fn !== 'function') { + throw new TypeError('argument fn must be a function') + } + + return fn +} + +/** + * Wrap property in a deprecation message. + * + * This is a no-op version of the wrapper, which does nothing but call + * validation. + */ + +function wrapproperty(obj, prop, message) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new TypeError('argument obj must be object') + } + + var descriptor = Object.getOwnPropertyDescriptor(obj, prop) + + if (!descriptor) { + throw new TypeError('must call property on owner object') + } + + if (!descriptor.configurable) { + throw new TypeError('property must be configurable') + } + + return +} diff --git a/node_modules/depd/lib/compat/buffer-concat.js b/node_modules/depd/lib/compat/buffer-concat.js new file mode 100644 index 0000000..4b73381 --- /dev/null +++ b/node_modules/depd/lib/compat/buffer-concat.js @@ -0,0 +1,35 @@ +/*! + * depd + * Copyright(c) 2014 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + */ + +module.exports = bufferConcat + +/** + * Concatenate an array of Buffers. + */ + +function bufferConcat(bufs) { + var length = 0 + + for (var i = 0, len = bufs.length; i < len; i++) { + length += bufs[i].length + } + + var buf = new Buffer(length) + var pos = 0 + + for (var i = 0, len = bufs.length; i < len; i++) { + bufs[i].copy(buf, pos) + pos += bufs[i].length + } + + return buf +} diff --git a/node_modules/depd/lib/compat/callsite-tostring.js b/node_modules/depd/lib/compat/callsite-tostring.js new file mode 100644 index 0000000..9ecef34 --- /dev/null +++ b/node_modules/depd/lib/compat/callsite-tostring.js @@ -0,0 +1,103 @@ +/*! + * depd + * Copyright(c) 2014 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + */ + +module.exports = callSiteToString + +/** + * Format a CallSite file location to a string. + */ + +function callSiteFileLocation(callSite) { + var fileName + var fileLocation = '' + + if (callSite.isNative()) { + fileLocation = 'native' + } else if (callSite.isEval()) { + fileName = callSite.getScriptNameOrSourceURL() + if (!fileName) { + fileLocation = callSite.getEvalOrigin() + } + } else { + fileName = callSite.getFileName() + } + + if (fileName) { + fileLocation += fileName + + var lineNumber = callSite.getLineNumber() + if (lineNumber != null) { + fileLocation += ':' + lineNumber + + var columnNumber = callSite.getColumnNumber() + if (columnNumber) { + fileLocation += ':' + columnNumber + } + } + } + + return fileLocation || 'unknown source' +} + +/** + * Format a CallSite to a string. + */ + +function callSiteToString(callSite) { + var addSuffix = true + var fileLocation = callSiteFileLocation(callSite) + var functionName = callSite.getFunctionName() + var isConstructor = callSite.isConstructor() + var isMethodCall = !(callSite.isToplevel() || isConstructor) + var line = '' + + if (isMethodCall) { + var methodName = callSite.getMethodName() + var typeName = getConstructorName(callSite) + + if (functionName) { + if (typeName && functionName.indexOf(typeName) !== 0) { + line += typeName + '.' + } + + line += functionName + + if (methodName && functionName.lastIndexOf('.' + methodName) !== functionName.length - methodName.length - 1) { + line += ' [as ' + methodName + ']' + } + } else { + line += typeName + '.' + (methodName || '') + } + } else if (isConstructor) { + line += 'new ' + (functionName || '') + } else if (functionName) { + line += functionName + } else { + addSuffix = false + line += fileLocation + } + + if (addSuffix) { + line += ' (' + fileLocation + ')' + } + + return line +} + +/** + * Get constructor name of reviver. + */ + +function getConstructorName(obj) { + var receiver = obj.receiver + return (receiver.constructor && receiver.constructor.name) || null +} diff --git a/node_modules/depd/lib/compat/event-listener-count.js b/node_modules/depd/lib/compat/event-listener-count.js new file mode 100644 index 0000000..a05fceb --- /dev/null +++ b/node_modules/depd/lib/compat/event-listener-count.js @@ -0,0 +1,22 @@ +/*! + * depd + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = eventListenerCount + +/** + * Get the count of listeners on an event emitter of a specific type. + */ + +function eventListenerCount(emitter, type) { + return emitter.listeners(type).length +} diff --git a/node_modules/depd/lib/compat/index.js b/node_modules/depd/lib/compat/index.js new file mode 100644 index 0000000..aa3c1de --- /dev/null +++ b/node_modules/depd/lib/compat/index.js @@ -0,0 +1,84 @@ +/*! + * depd + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var Buffer = require('buffer') +var EventEmitter = require('events').EventEmitter + +/** + * Module exports. + * @public + */ + +lazyProperty(module.exports, 'bufferConcat', function bufferConcat() { + return Buffer.concat || require('./buffer-concat') +}) + +lazyProperty(module.exports, 'callSiteToString', function callSiteToString() { + var limit = Error.stackTraceLimit + var obj = {} + var prep = Error.prepareStackTrace + + function prepareObjectStackTrace(obj, stack) { + return stack + } + + Error.prepareStackTrace = prepareObjectStackTrace + Error.stackTraceLimit = 2 + + // capture the stack + Error.captureStackTrace(obj) + + // slice the stack + var stack = obj.stack.slice() + + Error.prepareStackTrace = prep + Error.stackTraceLimit = limit + + return stack[0].toString ? toString : require('./callsite-tostring') +}) + +lazyProperty(module.exports, 'eventListenerCount', function eventListenerCount() { + return EventEmitter.listenerCount || require('./event-listener-count') +}) + +/** + * Define a lazy property. + */ + +function lazyProperty(obj, prop, getter) { + function get() { + var val = getter() + + Object.defineProperty(obj, prop, { + configurable: true, + enumerable: true, + value: val + }) + + return val + } + + Object.defineProperty(obj, prop, { + configurable: true, + enumerable: true, + get: get + }) +} + +/** + * Call toString() on the obj + */ + +function toString(obj) { + return obj.toString() +} diff --git a/node_modules/depd/package.json b/node_modules/depd/package.json new file mode 100644 index 0000000..100b1aa --- /dev/null +++ b/node_modules/depd/package.json @@ -0,0 +1,93 @@ +{ + "_args": [ + [ + "depd@1.1.0", + "/mnt/c/users/1/Documents/Frontend/task2/node_modules/@bem/sdk.entity-name" + ] + ], + "_from": "depd@1.1.0", + "_id": "depd@1.1.0", + "_inCache": true, + "_installable": true, + "_location": "/depd", + "_npmUser": { + "email": "doug@somethingdoug.com", + "name": "dougwilson" + }, + "_npmVersion": "1.4.28", + "_phantomChildren": {}, + "_requested": { + "name": "depd", + "raw": "depd@1.1.0", + "rawSpec": "1.1.0", + "scope": null, + "spec": "1.1.0", + "type": "version" + }, + "_requiredBy": [ + "/@bem/sdk.entity-name" + ], + "_resolved": "https://registry.npmjs.org/depd/-/depd-1.1.0.tgz", + "_shasum": "e1bd82c6aab6ced965b97b88b17ed3e528ca18c3", + "_shrinkwrap": null, + "_spec": "depd@1.1.0", + "_where": "/mnt/c/users/1/Documents/Frontend/task2/node_modules/@bem/sdk.entity-name", + "author": { + "email": "doug@somethingdoug.com", + "name": "Douglas Christopher Wilson" + }, + "browser": "lib/browser/index.js", + "bugs": { + "url": "https://github.com/dougwilson/nodejs-depd/issues" + }, + "dependencies": {}, + "description": "Deprecate all the things", + "devDependencies": { + "beautify-benchmark": "0.2.4", + "benchmark": "1.0.0", + "istanbul": "0.3.5", + "mocha": "~1.21.5" + }, + "directories": {}, + "dist": { + "shasum": "e1bd82c6aab6ced965b97b88b17ed3e528ca18c3", + "tarball": "https://registry.npmjs.org/depd/-/depd-1.1.0.tgz" + }, + "engines": { + "node": ">= 0.6" + }, + "files": [ + "History.md", + "LICENSE", + "Readme.md", + "index.js", + "lib/" + ], + "gitHead": "78c659de20283e3a6bee92bda455e6daff01686a", + "homepage": "https://github.com/dougwilson/nodejs-depd", + "keywords": [ + "deprecate", + "deprecated" + ], + "license": "MIT", + "maintainers": [ + { + "name": "dougwilson", + "email": "doug@somethingdoug.com" + } + ], + "name": "depd", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/dougwilson/nodejs-depd.git" + }, + "scripts": { + "bench": "node benchmark/index.js", + "test": "mocha --reporter spec --bail test/", + "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --no-exit test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/" + }, + "version": "1.1.0" +} diff --git a/node_modules/es6-error/.editorconfig b/node_modules/es6-error/.editorconfig new file mode 100644 index 0000000..2218836 --- /dev/null +++ b/node_modules/es6-error/.editorconfig @@ -0,0 +1,7 @@ +[*] +insert_final_newline = true +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/node_modules/es6-error/.npmignore b/node_modules/es6-error/.npmignore new file mode 100644 index 0000000..166f3fa --- /dev/null +++ b/node_modules/es6-error/.npmignore @@ -0,0 +1 @@ +.babelrc diff --git a/node_modules/es6-error/.travis.yml b/node_modules/es6-error/.travis.yml new file mode 100644 index 0000000..7994faf --- /dev/null +++ b/node_modules/es6-error/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "stable" + - "4.1" + - "4.0" + - "0.10" + diff --git a/node_modules/es6-error/CHANGELOG.md b/node_modules/es6-error/CHANGELOG.md new file mode 100644 index 0000000..9e82c81 --- /dev/null +++ b/node_modules/es6-error/CHANGELOG.md @@ -0,0 +1,26 @@ +# Change Log + +## [v4.0.1] - 2017-01-04 +### Fixed + - jsnext build uses `babel-plugin-transform-builtin-extend` (#27) + +## [v4.0.0] - 2016-10-03 +### Added + - jsnext build (#26) + +## [v3.2.0] - 2016-09-29 +### Added + - TypeScript definitions (#24) + +## [v3.1.0] - 2016-09-08 +### Changed + - Point jsnext build to transpiled code (#23) + +## [v3.0.1] - 2016-07-14 +### Changed + - Move Babel config to `.babelrc` (#20) + +## [v3.0.0] - 2016-05-18 +### Changed + - Upgrade to Babel 6 (#16) + - Make `message`, `name`, and `stack` properties configurable (to match built-in `Error`) (#17) diff --git a/node_modules/es6-error/LICENSE.md b/node_modules/es6-error/LICENSE.md new file mode 100644 index 0000000..4737fd1 --- /dev/null +++ b/node_modules/es6-error/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Ben Youngblood + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/es6-error/README.md b/node_modules/es6-error/README.md new file mode 100644 index 0000000..30c95db --- /dev/null +++ b/node_modules/es6-error/README.md @@ -0,0 +1,55 @@ +# es6-error + +[![npm version](https://badge.fury.io/js/es6-error.svg)](https://www.npmjs.com/package/es6-error) +[![Build Status](https://travis-ci.org/bjyoungblood/es6-error.svg?branch=master)](https://travis-ci.org/bjyoungblood/es6-error) + +An easily-extendable error class for use with ES6 classes (or ES5, if you so +choose). + +Tested in Node 4.0, Chrome, and Firefox. + +## Why? + +I made this because I wanted to be able to extend Error for inheritance and type +checking, but can never remember to add +`Error.captureStackTrace(this, this.constructor.name)` to the constructor or how +to get the proper name to print from `console.log`. + +## ES6 Usage + +```javascript + +import ExtendableError from 'es6-error'; + +class MyError extends ExtendableError { + // constructor is optional; you should omit it if you just want a custom error + // type for inheritance and type checking + constructor(message = 'Default message') { + super(message); + } +} + +export default MyError; +``` + +## ES5 Usage + +```javascript + +var util = require('util'); +var ExtendableError = require('es6-error'); + +function MyError(message) { + message = message || 'Default message'; + ExtendableError.call(this, message); +} + +util.inherits(MyError, ExtendableError); + +module.exports = MyError; +``` + +#### Todo + +- Better browser compatibility +- Browser tests diff --git a/node_modules/es6-error/babel-config.js b/node_modules/es6-error/babel-config.js new file mode 100644 index 0000000..a932d5d --- /dev/null +++ b/node_modules/es6-error/babel-config.js @@ -0,0 +1,31 @@ +'use strict'; + +var plugins = [ + [ + "babel-plugin-transform-builtin-extend", + { + "globals": ["Error"], + "approximate": true + } + ] +]; + +var env = process.env.BABEL_ENV || process.env.NODE_ENV; + +var modules; + +if (env === 'es') { + modules = false; +} else if (env === 'ts') { + modules = 'commonjs'; +} else { + modules = 'commonjs'; + plugins.push('add-module-exports'); +} + +module.exports = { + "presets": [ + ["es2015", { modules: modules }] + ], + "plugins": plugins +}; diff --git a/node_modules/es6-error/bower.json b/node_modules/es6-error/bower.json new file mode 100644 index 0000000..9a6f0fa --- /dev/null +++ b/node_modules/es6-error/bower.json @@ -0,0 +1,22 @@ +{ + "name": "es6-error", + "description": "Easily-extendable error for use with ES6 classes", + "main": "dist/index.js", + "authors": [ + "Ben Youngblood" + ], + "license": "MIT", + "keywords": [ + "es6", + "error", + "babel" + ], + "homepage": "https://github.com/bjyoungblood/es6-error", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/node_modules/es6-error/lib/index.d.ts b/node_modules/es6-error/lib/index.d.ts new file mode 100644 index 0000000..c1b1f12 --- /dev/null +++ b/node_modules/es6-error/lib/index.d.ts @@ -0,0 +1 @@ +export default class ExtendableError extends Error { } diff --git a/node_modules/es6-error/lib/index.js b/node_modules/es6-error/lib/index.js new file mode 100644 index 0000000..617bef7 --- /dev/null +++ b/node_modules/es6-error/lib/index.js @@ -0,0 +1,79 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +function _extendableBuiltin(cls) { + function ExtendableBuiltin() { + cls.apply(this, arguments); + } + + ExtendableBuiltin.prototype = Object.create(cls.prototype, { + constructor: { + value: cls, + enumerable: false, + writable: true, + configurable: true + } + }); + + if (Object.setPrototypeOf) { + Object.setPrototypeOf(ExtendableBuiltin, cls); + } else { + ExtendableBuiltin.__proto__ = cls; + } + + return ExtendableBuiltin; +} + +var ExtendableError = function (_extendableBuiltin2) { + _inherits(ExtendableError, _extendableBuiltin2); + + function ExtendableError() { + var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + _classCallCheck(this, ExtendableError); + + // extending Error is weird and does not propagate `message` + var _this = _possibleConstructorReturn(this, (ExtendableError.__proto__ || Object.getPrototypeOf(ExtendableError)).call(this, message)); + + Object.defineProperty(_this, 'message', { + configurable: true, + enumerable: false, + value: message, + writable: true + }); + + Object.defineProperty(_this, 'name', { + configurable: true, + enumerable: false, + value: _this.constructor.name, + writable: true + }); + + if (Error.hasOwnProperty('captureStackTrace')) { + Error.captureStackTrace(_this, _this.constructor); + return _possibleConstructorReturn(_this); + } + + Object.defineProperty(_this, 'stack', { + configurable: true, + enumerable: false, + value: new Error(message).stack, + writable: true + }); + return _this; + } + + return ExtendableError; +}(_extendableBuiltin(Error)); + +exports.default = ExtendableError; +module.exports = exports['default']; diff --git a/node_modules/es6-error/lib/index.jsnext.js b/node_modules/es6-error/lib/index.jsnext.js new file mode 100644 index 0000000..70fbfbc --- /dev/null +++ b/node_modules/es6-error/lib/index.jsnext.js @@ -0,0 +1,72 @@ +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +function _extendableBuiltin(cls) { + function ExtendableBuiltin() { + cls.apply(this, arguments); + } + + ExtendableBuiltin.prototype = Object.create(cls.prototype, { + constructor: { + value: cls, + enumerable: false, + writable: true, + configurable: true + } + }); + + if (Object.setPrototypeOf) { + Object.setPrototypeOf(ExtendableBuiltin, cls); + } else { + ExtendableBuiltin.__proto__ = cls; + } + + return ExtendableBuiltin; +} + +var ExtendableError = function (_extendableBuiltin2) { + _inherits(ExtendableError, _extendableBuiltin2); + + function ExtendableError() { + var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + _classCallCheck(this, ExtendableError); + + // extending Error is weird and does not propagate `message` + var _this = _possibleConstructorReturn(this, (ExtendableError.__proto__ || Object.getPrototypeOf(ExtendableError)).call(this, message)); + + Object.defineProperty(_this, 'message', { + configurable: true, + enumerable: false, + value: message, + writable: true + }); + + Object.defineProperty(_this, 'name', { + configurable: true, + enumerable: false, + value: _this.constructor.name, + writable: true + }); + + if (Error.hasOwnProperty('captureStackTrace')) { + Error.captureStackTrace(_this, _this.constructor); + return _possibleConstructorReturn(_this); + } + + Object.defineProperty(_this, 'stack', { + configurable: true, + enumerable: false, + value: new Error(message).stack, + writable: true + }); + return _this; + } + + return ExtendableError; +}(_extendableBuiltin(Error)); + +export default ExtendableError; diff --git a/node_modules/es6-error/lib/index.ts.js b/node_modules/es6-error/lib/index.ts.js new file mode 100644 index 0000000..ad1920c --- /dev/null +++ b/node_modules/es6-error/lib/index.ts.js @@ -0,0 +1,78 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +function _extendableBuiltin(cls) { + function ExtendableBuiltin() { + cls.apply(this, arguments); + } + + ExtendableBuiltin.prototype = Object.create(cls.prototype, { + constructor: { + value: cls, + enumerable: false, + writable: true, + configurable: true + } + }); + + if (Object.setPrototypeOf) { + Object.setPrototypeOf(ExtendableBuiltin, cls); + } else { + ExtendableBuiltin.__proto__ = cls; + } + + return ExtendableBuiltin; +} + +var ExtendableError = function (_extendableBuiltin2) { + _inherits(ExtendableError, _extendableBuiltin2); + + function ExtendableError() { + var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + _classCallCheck(this, ExtendableError); + + // extending Error is weird and does not propagate `message` + var _this = _possibleConstructorReturn(this, (ExtendableError.__proto__ || Object.getPrototypeOf(ExtendableError)).call(this, message)); + + Object.defineProperty(_this, 'message', { + configurable: true, + enumerable: false, + value: message, + writable: true + }); + + Object.defineProperty(_this, 'name', { + configurable: true, + enumerable: false, + value: _this.constructor.name, + writable: true + }); + + if (Error.hasOwnProperty('captureStackTrace')) { + Error.captureStackTrace(_this, _this.constructor); + return _possibleConstructorReturn(_this); + } + + Object.defineProperty(_this, 'stack', { + configurable: true, + enumerable: false, + value: new Error(message).stack, + writable: true + }); + return _this; + } + + return ExtendableError; +}(_extendableBuiltin(Error)); + +exports.default = ExtendableError; diff --git a/node_modules/es6-error/package.json b/node_modules/es6-error/package.json new file mode 100644 index 0000000..2448c11 --- /dev/null +++ b/node_modules/es6-error/package.json @@ -0,0 +1,96 @@ +{ + "_args": [ + [ + "es6-error@4.0.2", + "/mnt/c/users/1/Documents/Frontend/task2/node_modules/@bem/sdk.entity-name" + ] + ], + "_from": "es6-error@4.0.2", + "_id": "es6-error@4.0.2", + "_inCache": true, + "_installable": true, + "_location": "/es6-error", + "_nodeVersion": "7.4.0", + "_npmOperationalInternal": { + "host": "packages-18-east.internal.npmjs.com", + "tmp": "tmp/es6-error-4.0.2.tgz_1486520463295_0.6463170524220914" + }, + "_npmUser": { + "email": "bx.youngblood@gmail.com", + "name": "bjy" + }, + "_npmVersion": "4.0.5", + "_phantomChildren": {}, + "_requested": { + "name": "es6-error", + "raw": "es6-error@4.0.2", + "rawSpec": "4.0.2", + "scope": null, + "spec": "4.0.2", + "type": "version" + }, + "_requiredBy": [ + "/@bem/sdk.entity-name" + ], + "_resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.0.2.tgz", + "_shasum": "eec5c726eacef51b7f6b73c20db6e1b13b069c98", + "_shrinkwrap": null, + "_spec": "es6-error@4.0.2", + "_where": "/mnt/c/users/1/Documents/Frontend/task2/node_modules/@bem/sdk.entity-name", + "author": { + "name": "Ben Youngblood" + }, + "bugs": { + "url": "https://github.com/bjyoungblood/es6-error/issues" + }, + "dependencies": {}, + "description": "Easily-extendable error for use with ES6 classes", + "devDependencies": { + "babel-cli": "^6.8.0", + "babel-core": "^6.8.0", + "babel-plugin-add-module-exports": "^0.1.4", + "babel-plugin-transform-builtin-extend": "^1.1.0", + "babel-preset-es2015": "^6.6.0", + "chai": "^3.2.0", + "cross-env": "^2.0.1", + "mocha": "^2.4.5" + }, + "directories": {}, + "dist": { + "shasum": "eec5c726eacef51b7f6b73c20db6e1b13b069c98", + "tarball": "https://registry.npmjs.org/es6-error/-/es6-error-4.0.2.tgz" + }, + "gitHead": "f892c656f38be592b2c3efe6e1be451516a46cee", + "homepage": "https://github.com/bjyoungblood/es6-error", + "jsnext:main": "./lib/index.jsnext.js", + "keywords": [ + "babel", + "error", + "es6" + ], + "license": "MIT", + "main": "./lib/index", + "maintainers": [ + { + "name": "bjy", + "email": "bx.youngblood@gmail.com" + } + ], + "name": "es6-error", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/bjyoungblood/es6-error.git" + }, + "scripts": { + "build": "npm run build:commonjs && npm run build:es && npm run build:ts", + "build:commonjs": "cross-env BABEL_ENV=commonjs babel src/index.js --out-file lib/index.js", + "build:es": "cross-env BABEL_ENV=es babel src/index.js --out-file lib/index.jsnext.js", + "build:ts": "cross-env BABEL_ENV=ts babel src/index.js --out-file lib/index.ts.js", + "prepublish": "npm run build && npm run test", + "test": "mocha --compilers js:babel-core/register --recursive" + }, + "typings": "./lib/index.d.ts", + "version": "4.0.2" +} diff --git a/node_modules/es6-error/src/index.js b/node_modules/es6-error/src/index.js new file mode 100644 index 0000000..e52b161 --- /dev/null +++ b/node_modules/es6-error/src/index.js @@ -0,0 +1,34 @@ +class ExtendableError extends Error { + constructor(message = '') { + super(message); + + // extending Error is weird and does not propagate `message` + Object.defineProperty(this, 'message', { + configurable: true, + enumerable : false, + value : message, + writable : true, + }); + + Object.defineProperty(this, 'name', { + configurable: true, + enumerable : false, + value : this.constructor.name, + writable : true, + }); + + if (Error.hasOwnProperty('captureStackTrace')) { + Error.captureStackTrace(this, this.constructor); + return; + } + + Object.defineProperty(this, 'stack', { + configurable: true, + enumerable : false, + value : (new Error(message)).stack, + writable : true, + }); + } +} + +export default ExtendableError; diff --git a/node_modules/es6-error/test/index.js b/node_modules/es6-error/test/index.js new file mode 100644 index 0000000..7e98e2d --- /dev/null +++ b/node_modules/es6-error/test/index.js @@ -0,0 +1,64 @@ +import { expect } from 'chai'; +import ExtendableError from '../src/index'; + +class TestError extends ExtendableError {} +class SubTestError extends TestError {} + +describe('ExtendableError', () => { + it('instance of', () => { + let err = new ExtendableError(); + expect(err).to.be.an.instanceof(Error); + expect(err).to.be.an.instanceof(ExtendableError); + + let err2 = new TestError(); + expect(err2).to.be.an.instanceof(Error); + expect(err2).to.be.an.instanceof(ExtendableError); + expect(err2).to.be.an.instanceof(TestError); + + let err3 = new SubTestError(); + expect(err3).to.be.an.instanceof(Error); + expect(err3).to.be.an.instanceof(ExtendableError); + expect(err3).to.be.an.instanceof(TestError); + expect(err3).to.be.an.instanceof(SubTestError); + }); + + it('.name', () => { + let err = new ExtendableError(); + expect(err.name).to.equal('ExtendableError'); + + let err2 = new TestError(); + expect(err2.name).to.equal('TestError'); + + let err3 = new SubTestError(); + expect(err3.name).to.equal('SubTestError'); + }); + + it('name is not enumerable', () => { + let err = new ExtendableError(); + expect(err.propertyIsEnumerable('name')).to.be.false; + }); + + it('.stack', () => { + let err = new ExtendableError(); + expect(err.stack).to.be.a('string'); + + let err2 = new TestError(); + expect(err2.stack).to.be.a('string'); + }); + + it('#toString', () => { + let err = new ExtendableError(); + expect(err.toString()).to.equal('ExtendableError'); + + let err2 = new TestError(); + expect(err2.toString()).to.equal('TestError'); + + let err3 = new SubTestError(); + expect(err3.toString()).to.equal('SubTestError'); + }); + + it('.message', () => { + let err = new ExtendableError('error occurred'); + expect(err.message).to.equal('error occurred'); + }) +}); diff --git a/script.js b/script.js new file mode 100644 index 0000000..430d40f --- /dev/null +++ b/script.js @@ -0,0 +1,227 @@ +function addLetter(letter) { + var letters = document.getElementsByClassName("letter"); + if (letters.length === 30) { + var hiddenletters = document.getElementsByClassName("letter_hidden"); + hiddenletters[0].parentElement.insertBefore(letters[29], hiddenletters[0]); + letters[29].style.block = none; + letters[29].className = "letter_hidden" + } + letters[0].parentElement.insertBefore(letter, letters[0]) +} + +const pairs = new Map([["END", new Map([["START", 1.0]])], + ["START", new Map([["шарлотта", 0.072], ["ее", 0.072], ["он", 0.072], ["для", 0.072], ["патрик", 0.072], ["там", 0.072], ["после", 0.072], ["детишки", 0.072], ["соседи", 0.072], ["семья", 0.072], ["фанатичный", 0.072], ["дело", 0.072], ["зная", 0.072], ["увидев", 0.072]])], + ["шарлотта", new Map([["бронте", 1.0]])], + ["бронте", new Map([["родилась", 0.2], ["ирландец", 0.2], ["изучил", 0.2], ["не", 0.2], ["бросил", 0.2]])], + ["родилась", new Map([["в", 1.0]])], + ["в", new Map([["1816 г", 0.2], ["семье", 0.2], ["йоркшире", 0.2], ["британии", 0.2], ["огонь", 0.2]])], + ["1816 г", new Map([["в", 1.0]])], + ["семье", new Map([["сельского", 1.0]])], + ["сельского", new Map([["священника", 1.0]])], + ["священника", new Map([["в", 1.0]])], + ["йоркшире", new Map([["END", 1.0]])], + ["ее", new Map([["отец", 1.0]])], + ["отец", new Map([["Патрик", 1.0]])], + ["патрик", new Map([["бронте", 1.0]])], + ["ирландец", new Map([["был", 1.0]])], + ["был", new Map([["смолоду", 0.5], ["один", 0.5]])], + ["смолоду", new Map([["простым", 1.0]])], + ["простым", new Map([["ткачом", 1.0]])], + ["ткачом", new Map([["END", 1.0]])], + ["он", new Map([["обладал", 0.5], ["отвергал", 0.5]])], + ["обладал", new Map([["редкими", 1.0]])], + ["редкими", new Map([["способностями", 1.0]])], + ["способностями", new Map([["и", 1.0]])], + ["и", new Map([["трудолюбием", 0.25], ["родились", 0.25], ["сын", 0.25], ["суровый", 0.25]])], + ["трудолюбием", new Map([["мечтал", 1.0]])], + ["мечтал", new Map([["учиться", 1.0]])], + ["учиться", new Map([["END", 1.0]])], + ["для", new Map([["простого", 1.0]])], + ["простого", new Map([["человека", 1.0]])], + ["человека", new Map([["решившего", 1.0]])], + ["решившего", new Map([["овладеть", 1.0]])], + ["овладеть", new Map([["знаниями", 1.0]])], + ["знаниями", new Map([["в", 1.0]])], + ["британии", new Map([["того", 1.0]])], + ["того", new Map([["времнени", 1.0]])], + ["времени", new Map([["был", 1.0]])], + ["один", new Map([["путь", 1.0]])], + ["путь", new Map([["стать", 1.0]])], + ["стать", new Map([["священником", 1.0]])], + ["священником", new Map([["END", 1.0]])], + ["изучил", new Map([["богословие", 1.0]])], + ["богословие", new Map([["женился", 1.0]])], + ["женился", new Map([["получил", 1.0]])], + ["получил", new Map([["церковный", 1.0]])], + ["приход", new Map([["на", 1.0]])], + ["на", new Map([["севере", 0.334], ["попечении", 0.334], ["милостыню", 0.334]])], + ["севере", new Map([["англии", 1.0]])], + ["англии", new Map([["возле", 1.0]])], + ["возле", new Map([["промышленного", 1.0]])], + ["промышленного", new Map([["города", 1.0]])], + ["города", new Map([["лидса", 1.0]])], + ["лидса", new Map([["END", 1.0]])], + ["там", new Map([["и", 1.0]])], + ["родились", new Map([["его", 1.0]])], + ["его", new Map([["дети", 1.0]])], + ["дети", new Map([["пять", 1.0]])], + ["пять", new Map([["дочерей", 1.0]])], + ["дочерей", new Map([["и", 1.0]])], + ["сын", new Map([["END", 1.0]])], + ["После", new Map([["рождения", 1.0]])], + ["рождения", new Map([["младшей", 1.0]])], + ["младшей", new Map([["анны", 1.0]])], + ["анны", new Map([["умерла", 1.0]])], + ["умерла", new Map([["мать", 1.0]])], + ["мать", new Map([["END", 1.0]])], + ["детишки", new Map([["остались", 1.0]])], + ["остались", new Map([["на", 1.0]])], + ["попечении", new Map([["старой", 1.0]])], + ["старой", new Map([["служанки", 1.0]])], + ["служанки", new Map([["END", 1.0]])], + ["соседи", new Map([["не", 0.5], ["купили", 0.5]])], + ["не", new Map([["могли", 0.5], ["принимал", 0.5]])], + ["могли", new Map([["без", 1.0]])], + ["без", new Map([["слез", 1.0]])], + ["смотреть", new Map([["как", 1.0]])], + ["как", new Map([["они", 1.0]])], + ["они", new Map([["гуляют", 1.0]])], + ["гуляют", new Map([["по", 1.0]])], + ["по", new Map([["окрестным", 1.0]])], + ["окрестным", new Map([["вересковым", 1.0]])], + ["вересковым", new Map([["полям", 1.0]])], + ["полям", new Map([["держась", 1.0]])], + ["держась", new Map([["за", 1.0]])], + ["за", new Map([["руки", 1.0]])], + ["руки", new Map([["попарно", 1.0]])], + ["попарно", new Map([["под", 1.0]])], + ["под", new Map([["присмотром", 1.0]])], + ["присмотром", new Map([["старшей", 1.0]])], + ["старшей", new Map([["десятилетней", 1.0]])], + ["десятилетней", new Map([["END", 1.0]])], + ["семья", new Map([["была", 1.0]])], + ["была", new Map([["очень", 1.0]])], + ["очень", new Map([["бедна", 1.0]])], + ["бедна", new Map([["но", 1.0]])], + ["но", new Map([["патрик", 1.0]])], + ["принимал", new Map([["ни", 1.0]])], + ["ни", new Map([["от", 1.0]])], + ["от", new Map([["кого", 1.0]])], + ["кого", new Map([["помощи", 1.0]])], + ["помощи", new Map([["END", 1.0]])], + ["фанатичный", new Map([["и", 1.0]])], + ["суровый", new Map([["он", 1.0]])], + ["отвергал", new Map([["подарки", 1.0]])], + ["подарки", new Map([["похожие", 1.0]])], + ["похожие", new Map([["на", 1.0]])], + ["милостыню", new Map([["END", 1.0]])], + ["дело", new Map([["доходило", 1.0]])], + ["доходило", new Map([["до", 1.0]])], + ["до", new Map([["курьезов", 1.0]])], + ["курьезов", new Map([["END", 1.0]])], + ["зная", new Map([["что", 1.0]])], + ["что", new Map([["у", 1.0]])], + ["у", new Map([["детей", 1.0]])], + ["детей", new Map([["нет", 1.0]])], + ["нет", new Map([["крепкой", 1.0]])], + ["крепкой", new Map([["обуви", 1.0]])], + ["обуви", new Map([["богатые", 1.0]])], + ["богатые", new Map([["соседи", 1.0]])], + ["купили", new Map([["им", 1.0]])], + ["им", new Map([["башмаки", 1.0]])], + ["башмаки", new Map([["END", 1.0]])], + ["увидев", new Map([["перед", 1.0]])], + ["перед", new Map([["камином", 1.0]])], + ["камином", new Map([["шесть", 1.0]])], + ["шесть", new Map([["пар", 1.0]])], + ["пар", new Map([["новых", 1.0]])], + ["новых", new Map([["башмачков", 1.0]])], + ["башмачков", new Map([["патрик", 1.0]])], + ["бросил", new Map([["их", 1.0]])], + ["их", new Map([["в", 1.0]])], + ["огонь", new Map([["END", 1.0]])]]); + +function generateText() { + let i = 0; + let s = ""; + let current = "START"; + while (i < 4) { + let k = Math.random(); + let pair = pairs.get(current); + let sum = 0; + let next = "END"; + for (let [key, value] of pair.entries()) { + if (k < value + sum) { + next = key; + break; + } + sum += value; + } + if (next === "END") { + s += ". "; + i++; + } else if (current === "START") { + s += next; + } else { + s += " " + next; + } + } + return s +} + +function getFirstSentence(text) { + let s = ""; + let i = 0; + while (text[i] !== '.') { + s += text[i]; + i++ + } + return s +} + +function generateLetter() { + let firstletter = document.getElementsByClassName("letters")[0].firstChild; + let letter = firstletter.cloneNode(true); + let text = letter.children[6]; + text.innerHTML = generateText(); + let theme = letter.children[4].firstChild; + theme.innerHTML = getFirstSentence(text.innerHTML); + return letter +} + +function deleteLetters() { + let letters = document.getElementsByClassName("letters"); + let letter = letters[0].children; + let i = 0; + while (i < letter.length) { + let check = letter[i].getElementsByTagName("input"); + if (check.length > 0) { + if (check[0].checked) { + letters[0].removeChild(letter[i]) + } else { + i++; + } + } else { + i++; + } + } +} + +let actions = document.getElementsByClassName("action"); +let remove; +for (let i = 0; i < actions.length; i++) { + let childr = actions[i].childNodes; + let has = false; + if (childr !== undefined) { + for (let j = 0; j < childr.length; j++) { + if (childr[j].classList.contains("action__remove")) { + has = true + } + } + } + if (has) { + remove = actions[i]; + break + } +} +remove.addEventListener("click", deleteLetters); \ No newline at end of file diff --git a/script3.js b/script3.js new file mode 100644 index 0000000..e1bf24d --- /dev/null +++ b/script3.js @@ -0,0 +1,35 @@ +function addLetter() { + let hiddenLetter = document.getElementsByClassName("letter_hidden")[0]; + let button_add = document.getElementsByClassName("menu__button_add")[0]; + button_add.addEventListener("click", () => { + let newLetter = hiddenLetter.cloneNode(true); + document.getElementsByClassName("letters")[0].insertBefore(newLetter, hiddenLetter); + newLetter.setAttribute("data-state", "showed"); + newLetter.addEventListener('animationend', () => { + newLetter.removeAttribute("data-state") + }); + newLetter.classList.remove("letter_hidden"); + }); +} +function deleteletter() { + let button_delete = document.getElementsByClassName('menu__button_delete')[0]; + button_delete.addEventListener("click", () => { + let letters = document.getElementsByClassName('letter'); + if (letters.length <= 2) { + window.alert("We have only undeletable letter"); + } + let deleteLetter = letters[1]; + if (deleteLetter.classList.contains("letter_hidden")) { + deleteLetter = letters[2]; + } + deleteLetter.setAttribute("data-state", "deleted"); + deleteLetter.addEventListener("animationend", () => { + deleteLetter.remove() + }); + }); +} + +function f() { + addLetter(); + deleteletter(); +} \ No newline at end of file diff --git a/script4.js b/script4.js new file mode 100644 index 0000000..6f405a8 --- /dev/null +++ b/script4.js @@ -0,0 +1,282 @@ +const pairs = new Map([["END", new Map([["START", 1.0]])], + ["START", new Map([["шарлотта", 0.072], ["ее", 0.072], ["он", 0.072], ["для", 0.072], ["патрик", 0.072], ["там", 0.072], ["после", 0.072], ["детишки", 0.072], ["соседи", 0.072], ["семья", 0.072], ["фанатичный", 0.072], ["дело", 0.072], ["зная", 0.072], ["увидев", 0.072]])], + ["шарлотта", new Map([["бронте", 1.0]])], + ["бронте", new Map([["родилась", 0.2], ["ирландец", 0.2], ["изучил", 0.2], ["не", 0.2], ["бросил", 0.2]])], + ["родилась", new Map([["в", 1.0]])], + ["в", new Map([["1816 г", 0.2], ["семье", 0.2], ["йоркшире", 0.2], ["британии", 0.2], ["огонь", 0.2]])], + ["1816 г", new Map([["в", 1.0]])], + ["семье", new Map([["сельского", 1.0]])], + ["сельского", new Map([["священника", 1.0]])], + ["священника", new Map([["в", 1.0]])], + ["йоркшире", new Map([["END", 1.0]])], + ["ее", new Map([["отец", 1.0]])], + ["отец", new Map([["Патрик", 1.0]])], + ["патрик", new Map([["бронте", 1.0]])], + ["ирландец", new Map([["был", 1.0]])], + ["был", new Map([["смолоду", 0.5], ["один", 0.5]])], + ["смолоду", new Map([["простым", 1.0]])], + ["простым", new Map([["ткачом", 1.0]])], + ["ткачом", new Map([["END", 1.0]])], + ["он", new Map([["обладал", 0.5], ["отвергал", 0.5]])], + ["обладал", new Map([["редкими", 1.0]])], + ["редкими", new Map([["способностями", 1.0]])], + ["способностями", new Map([["и", 1.0]])], + ["и", new Map([["трудолюбием", 0.25], ["родились", 0.25], ["сын", 0.25], ["суровый", 0.25]])], + ["трудолюбием", new Map([["мечтал", 1.0]])], + ["мечтал", new Map([["учиться", 1.0]])], + ["учиться", new Map([["END", 1.0]])], + ["для", new Map([["простого", 1.0]])], + ["простого", new Map([["человека", 1.0]])], + ["человека", new Map([["решившего", 1.0]])], + ["решившего", new Map([["овладеть", 1.0]])], + ["овладеть", new Map([["знаниями", 1.0]])], + ["знаниями", new Map([["в", 1.0]])], + ["британии", new Map([["того", 1.0]])], + ["того", new Map([["времнени", 1.0]])], + ["времени", new Map([["был", 1.0]])], + ["один", new Map([["путь", 1.0]])], + ["путь", new Map([["стать", 1.0]])], + ["стать", new Map([["священником", 1.0]])], + ["священником", new Map([["END", 1.0]])], + ["изучил", new Map([["богословие", 1.0]])], + ["богословие", new Map([["женился", 1.0]])], + ["женился", new Map([["получил", 1.0]])], + ["получил", new Map([["церковный", 1.0]])], + ["приход", new Map([["на", 1.0]])], + ["на", new Map([["севере", 0.334], ["попечении", 0.334], ["милостыню", 0.334]])], + ["севере", new Map([["англии", 1.0]])], + ["англии", new Map([["возле", 1.0]])], + ["возле", new Map([["промышленного", 1.0]])], + ["промышленного", new Map([["города", 1.0]])], + ["города", new Map([["лидса", 1.0]])], + ["лидса", new Map([["END", 1.0]])], + ["там", new Map([["и", 1.0]])], + ["родились", new Map([["его", 1.0]])], + ["его", new Map([["дети", 1.0]])], + ["дети", new Map([["пять", 1.0]])], + ["пять", new Map([["дочерей", 1.0]])], + ["дочерей", new Map([["и", 1.0]])], + ["сын", new Map([["END", 1.0]])], + ["После", new Map([["рождения", 1.0]])], + ["рождения", new Map([["младшей", 1.0]])], + ["младшей", new Map([["анны", 1.0]])], + ["анны", new Map([["умерла", 1.0]])], + ["умерла", new Map([["мать", 1.0]])], + ["мать", new Map([["END", 1.0]])], + ["детишки", new Map([["остались", 1.0]])], + ["остались", new Map([["на", 1.0]])], + ["попечении", new Map([["старой", 1.0]])], + ["старой", new Map([["служанки", 1.0]])], + ["служанки", new Map([["END", 1.0]])], + ["соседи", new Map([["не", 0.5], ["купили", 0.5]])], + ["не", new Map([["могли", 0.5], ["принимал", 0.5]])], + ["могли", new Map([["без", 1.0]])], + ["без", new Map([["слез", 1.0]])], + ["смотреть", new Map([["как", 1.0]])], + ["как", new Map([["они", 1.0]])], + ["они", new Map([["гуляют", 1.0]])], + ["гуляют", new Map([["по", 1.0]])], + ["по", new Map([["окрестным", 1.0]])], + ["окрестным", new Map([["вересковым", 1.0]])], + ["вересковым", new Map([["полям", 1.0]])], + ["полям", new Map([["держась", 1.0]])], + ["держась", new Map([["за", 1.0]])], + ["за", new Map([["руки", 1.0]])], + ["руки", new Map([["попарно", 1.0]])], + ["попарно", new Map([["под", 1.0]])], + ["под", new Map([["присмотром", 1.0]])], + ["присмотром", new Map([["старшей", 1.0]])], + ["старшей", new Map([["десятилетней", 1.0]])], + ["десятилетней", new Map([["END", 1.0]])], + ["семья", new Map([["была", 1.0]])], + ["была", new Map([["очень", 1.0]])], + ["очень", new Map([["бедна", 1.0]])], + ["бедна", new Map([["но", 1.0]])], + ["но", new Map([["патрик", 1.0]])], + ["принимал", new Map([["ни", 1.0]])], + ["ни", new Map([["от", 1.0]])], + ["от", new Map([["кого", 1.0]])], + ["кого", new Map([["помощи", 1.0]])], + ["помощи", new Map([["END", 1.0]])], + ["фанатичный", new Map([["и", 1.0]])], + ["суровый", new Map([["он", 1.0]])], + ["отвергал", new Map([["подарки", 1.0]])], + ["подарки", new Map([["похожие", 1.0]])], + ["похожие", new Map([["на", 1.0]])], + ["милостыню", new Map([["END", 1.0]])], + ["дело", new Map([["доходило", 1.0]])], + ["доходило", new Map([["до", 1.0]])], + ["до", new Map([["курьезов", 1.0]])], + ["курьезов", new Map([["END", 1.0]])], + ["зная", new Map([["что", 1.0]])], + ["что", new Map([["у", 1.0]])], + ["у", new Map([["детей", 1.0]])], + ["детей", new Map([["нет", 1.0]])], + ["нет", new Map([["крепкой", 1.0]])], + ["крепкой", new Map([["обуви", 1.0]])], + ["обуви", new Map([["богатые", 1.0]])], + ["богатые", new Map([["соседи", 1.0]])], + ["купили", new Map([["им", 1.0]])], + ["им", new Map([["башмаки", 1.0]])], + ["башмаки", new Map([["END", 1.0]])], + ["увидев", new Map([["перед", 1.0]])], + ["перед", new Map([["камином", 1.0]])], + ["камином", new Map([["шесть", 1.0]])], + ["шесть", new Map([["пар", 1.0]])], + ["пар", new Map([["новых", 1.0]])], + ["новых", new Map([["башмачков", 1.0]])], + ["башмачков", new Map([["патрик", 1.0]])], + ["бросил", new Map([["их", 1.0]])], + ["их", new Map([["в", 1.0]])], + ["огонь", new Map([["END", 1.0]])]]); + +function generateText() { + let i = 0; + let s = ""; + let current = "START"; + while (i < 4) { + let k = Math.random(); + let pair = pairs.get(current); + let sum = 0; + let next = "END"; + if (pair !== undefined) { + for (let [key, value] of pair.entries()) { + if (k < value + sum) { + next = key; + break; + } + sum += value; + } + } + if (next === "END") { + s += ". "; + i++; + } else { + if (current !== "START") { + s += " "; + } + if (next !== "START") { + s += next; + } + } + current = next; + } + return s +} + +function getFirstSentence(text) { + let s = ""; + let i = 0; + while (text[i] !== '.') { + s += text[i]; + i++ + } + return s +} + +function generateLetter() { + let firstletter = document.getElementsByClassName("letter_hidden")[0]; + let letter = firstletter.cloneNode(true); + let text = letter.children[6]; + text.innerHTML = generateText(); + let theme = letter.children[4].firstChild; + theme.innerHTML = getFirstSentence(text.innerHTML); + return letter; +} + +let beforeTime = 0; +let previousTime = 0; +let hiddenLetters = []; + +function addletter() { + let currentTime = new Date().getTime(); + let timeout = randomInt(Math.max(10, Math.min(currentTime - beforeTime, 300000)), 600000); + beforeTime = previousTime; + previousTime = currentTime + timeout; + let newLetter = generateLetter(); + let letters = document.getElementsByClassName("letters")[0]; + if (letters.length - hiddenLetters.length === 31) { + hiddenLetters.unshift(letters[29]); + letters[29].setAttribute("data-state", "hidden"); + } + letters.insertBefore(newLetter, letters.firstChild); + newLetter.setAttribute("data-state", "showed"); + newLetter.addEventListener('animationend', () => { + newLetter.removeAttribute("data-state") + }); + newLetter.classList.remove("letter_hidden"); + setTimeout(addletter, timeout); +} + +function randomInt(min, max) { + return Math.floor(Math.random() * (max - min) ) + min; +} + +function deleteLetters() { + let letters = document.getElementsByClassName("letters"); + let letter = letters[0].children; + let i = 0; + while (i < letter.length) { + let check = letter[i].getElementsByTagName("input"); + if (check.length > 0) { + if (check[0].checked) { + let deleteLetter = letter[i]; + letter[i].setAttribute("data-state", "deleted"); + letter[i].addEventListener("animationend", () => { + letters[0].removeChild(letter[i]); + }); + } + } + i++; + } + letters = document.getElementsByClassName("letter"); + if (hiddenLetters.length > 0) { + for (let i = 0; i < Math.min(hiddenLetters.length, 31 - (letters.length - hiddenLetters.length)); i++) { + hiddenLetters[0].setAttribute("data-state", "showed"); + hiddenLetters[0].addEventListener('animationend', () => { + hiddenLetters[0].removeAttribute("data-state") + }); + hiddenLetters.shift(); + } + } +} + +function showLetters() { + document.getElementsByClassName("letters")[0].innerHTML = content; +} + +let content = ''; + +function innerMail(letter) { + content = document.getElementsByClassName("letters")[0].innerHTML; + document.getElementsByClassName("letters")[0].innerHTML = letter.children[6].innerHTML; +} + +function f() { + let letters = document.getElementsByClassName("letter"); + for (let i = 0; i < letters.length; i++) { + letters[i].children[6].innerHTML = generateText(); + letters[i].addEventListener('click', () => {innerMail(letters[i])}); + } + content = document.getElementsByClassName("letters")[0].innerHTML; + let actions = document.getElementsByClassName("action"); + let remove; + for (let i = 0; i < actions.length; i++) { + let childr = actions[i].childNodes; + let has = false; + if (childr !== undefined) { + for (let j = 0; j < childr.length; j++) { + if (childr[j].classList.contains("action__remove")) { + has = true + } + } + } + if (has) { + remove = actions[i]; + break + } + } + remove.addEventListener("click", deleteLetters); + + setTimeout(addletter, randomInt(10, 600000)); +} \ No newline at end of file diff --git a/yandex_cyr_icon-icons.com_59870.svg b/yandex_cyr_icon-icons.com_59870.svg new file mode 100644 index 0000000..d5175dd --- /dev/null +++ b/yandex_cyr_icon-icons.com_59870.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git "a/\320\221\320\265\320\267\321\213\320\274\321\217\320\275\320\275\321\213\320\271.png" "b/\320\221\320\265\320\267\321\213\320\274\321\217\320\275\320\275\321\213\320\271.png" new file mode 100644 index 0000000..d3cc33b Binary files /dev/null and "b/\320\221\320\265\320\267\321\213\320\274\321\217\320\275\320\275\321\213\320\271.png" differ diff --git "a/\320\257\320\275\320\264\320\265\320\272\321\201.\320\237\320\276\321\207\321\202\320\260.png" "b/\320\257\320\275\320\264\320\265\320\272\321\201.\320\237\320\276\321\207\321\202\320\260.png" new file mode 100644 index 0000000..f932319 Binary files /dev/null and "b/\320\257\320\275\320\264\320\265\320\272\321\201.\320\237\320\276\321\207\321\202\320\260.png" differ