Skip to content

1.0.0-beta #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.idea/
node_modules/
yarn.lock
package-lock.json
.*
!.csscomb.json
!.gitignore
!.gitattributes
!.hound.yml
!.scss-lint.yml
!.stylelintrc.json
temp
196 changes: 196 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# angular-package

<a href='https://angular-package.dev' target='_blank'>
<img align="right" width="92" height="92" src="https://avatars.githubusercontent.com/u/31412194?s=400&u=c9929aa36826318ccac8f7b84516e1ce3af7e21c&v=4" />
</a>

The angular-package supports the development process of [angular](https://angular.io)-based applications in varied ways through the thoughtful, reusable, easy-to-use small pieces of code called packages.

<br>

<a href="https://angular-package.github.io/sass"><img src="https://sass-lang.com/assets/img/logos/logo.svg" width="92" height="92" /></a>

## Sass String

Sass String - Modified string Sass module.

[![Gitter][gitter-badge]][gitter-chat]
[![Discord][discord-badge]][discord-channel]
[![Twitter][twitter-badge]][twitter-follow]

<!-- npm badge -->
[![npm version][sass-string-npm-badge-svg]][sass-string-npm-badge]

<!-- GitHub badges -->
[![GitHub issues][sass-string-badge-issues]][sass-string-issues]
[![GitHub forks][sass-string-badge-forks]][sass-string-forks]
[![GitHub stars][sass-string-badge-stars]][sass-string-stars]
[![GitHub license][sass-string-badge-license]][sass-string-license]

<!-- Sponsors -->
[![GitHub Sponsors][github-badge-sponsor]][github-sponsor-link]
[![Patreon Sponsors][patreon-badge]][patreon-link]

Extended sass modules:

* The [`sass:string`](https://sass-lang.com/documentation/modules/string/) is extended by [`@angular-package/sass-string`](https://docs.angular-package.dev/v/sass/string/overview) - module makes it easy to combine, search, or split apart strings.

<br>

Sass extension is **free** to use. If you enjoy it, please consider donating via [fiat](https://docs.angular-package.dev/v/sass/donate/fiat), [Revolut platform](https://checkout.revolut.com/pay/048b10a3-0e10-42c8-a917-e3e9cb4c8e29) or [cryptocurrency](https://spectrecss.angular-package.dev/donate/thb-cryptocurrency) the [@angular-package](https://github.com/sponsors/angular-package) for further development. ♥

> Feel **free** to submit a pull request. Help is always appreciated.

<br>

## Table of contents

* [Skeleton](#skeleton)
* [Code scaffolding](#code-scaffolding)
* [Documentation](#documentation)
* [Changelog](#changelog)
* [Git](#git)
* [Commit](#commit)
* [Versioning](#versioning)
* [License](#license)

<br>

## Skeleton

This package was generated by the [skeleton workspace][skeleton] with [Angular CLI](https://github.com/angular/angular-cli) version `14.2.0`.

Copy this package to the `packages/sass-string` folder of the [skeleton workspace][skeleton] then run the commands below.

<br>

## Code scaffolding

Run `ng generate component component-name --project sass-string` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project sass-string`.
> Note: Don't forget to add `--project sass-string` or else it will be added to the default project in your `angular.json` file.

### Build

Run `ng build sass-string` to build the project. The build artifacts will be stored in the `dist/` directory.

### Publishing

After building your library with `ng build sass-string`, go to the dist folder `cd dist/sass-string` and run `npm publish`.

## Running unit tests

Run `ng test sass-string` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.

<br>

## Documentation

The documentation is in construction and it's available at [https://docs.angular-package.dev/v/sass-string](https://docs.angular-package.dev/v/sass-string/)

<br>

## Changelog

To read it, click on the [CHANGELOG.md][sass-string-github-changelog] link.

<br>

## GIT

### Commit

* [AngularJS Git Commit Message Conventions][git-commit-angular]
* [Karma Git Commit Msg][git-commit-karma]
* [Conventional Commits][git-commit-conventional]

### Versioning

[Semantic Versioning 2.0.0][git-semver]

**Given a version number MAJOR.MINOR.PATCH, increment the:**

* MAJOR version when you make incompatible API changes,
* MINOR version when you add functionality in a backwards-compatible manner, and
* PATCH version when you make backwards-compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

**FAQ**
How should I deal with revisions in the 0.y.z initial development phase?

> The simplest thing to do is start your initial development release at 0.1.0 and then increment the minor version for each subsequent release.

How do I know when to release 1.0.0?

> If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backwards compatibility, you should probably already be 1.0.0.

<br>

## License

MIT © angular-package ([license][sass-string-license])

<!-- Funding -->
[github-badge-sponsor]: https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/angular-package
[github-sponsor-link]: https://github.com/sponsors/angular-package
[patreon-badge]: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dangularpackage%26type%3Dpatrons&style=flat
[patreon-link]: https://www.patreon.com/join/angularpackage/checkout?fan_landing=true&rid=0

[angulario]: https://angular.io
[skeleton]: https://github.com/angular-package/skeleton

<!-- Update status -->
[experimental]: https://img.shields.io/badge/-Experimental-orange
[fix]: https://img.shields.io/badge/-Fix-red
[new]: https://img.shields.io/badge/-eNw-green
[update]: https://img.shields.io/badge/-Update-red
[documentation]: https://img.shields.io/badge/-Documentation-informational
[demonstration]: https://img.shields.io/badge/-Demonstration-green

<!-- Discord -->
[discord-badge]: https://img.shields.io/discord/925168966098386944?style=social&logo=discord&label=Discord
[discord-channel]: https://discord.com/invite/rUCR2CW75G

<!-- Gitter -->
[gitter-badge]: https://img.shields.io/gitter/room/angular-package/ap-sass?style=social&logo=gitter
[gitter-chat]: https://app.gitter.im/#/room/#ap-sass:gitter.im

<!-- Twitter -->
[twitter-badge]: https://img.shields.io/twitter/follow/angularpackage?label=%40angularpackage&style=social
[twitter-follow]: https://twitter.com/angularpackage

<!-- GIT -->
[git-semver]: http://semver.org/

<!-- GIT: commit -->
[git-commit-angular]: https://gist.github.com/stephenparish/9941e89d80e2bc58a153
[git-commit-karma]: http://karma-runner.github.io/0.10/dev/git-commit-msg.html
[git-commit-conventional]: https://www.conventionalcommits.org/en/v1.0.0/

<!-- This package: sass -->
<!-- GitHub: badges -->
[sass-string-badge-issues]: https://img.shields.io/github/issues/angular-package/sass-string
[sass-string-badge-forks]: https://img.shields.io/github/forks/angular-package/sass-string
[sass-string-badge-stars]: https://img.shields.io/github/stars/angular-package/sass-string
[sass-string-badge-license]: https://img.shields.io/github/license/angular-package/sass-string
<!-- GitHub: badges links -->
[sass-string-issues]: https://github.com/angular-package/sass-string/issues
[sass-string-forks]: https://github.com/angular-package/sass-string/network
[sass-string-license]: https://github.com/angular-package/sass-string/blob/master/LICENSE
[sass-string-stars]: https://github.com/angular-package/sass-string/stargazers
<!-- This package -->
[sass-string-github-changelog]: https://github.com/angular-package/sass-string/blob/main/CHANGELOG.md

<!-- Package: sass-string -->
<!-- npm -->
[sass-string-npm-badge-svg]: https://badge.fury.io/js/%40angular-package%2Fsass-string.svg
[sass-string-npm-badge-png]: https://badge.fury.io/js/%40angular-package%2Fsass-string.png
[sass-string-npm-badge]: https://badge.fury.io/js/%40angular-package%2Fsass-string
[sass-string-npm-readme]: https://www.npmjs.com/package/@angular-package/sass-string#readme

<!-- GitHub -->
[sass-string-github-readme]: https://github.com/angular-package/sass-string#readme
1 change: 1 addition & 0 deletions index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@forward "src/lib";
44 changes: 44 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, '../../coverage/sass-string'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
11 changes: 11 additions & 0 deletions ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/sass-string",
"lib": {
"entryFile": "src/public-api.ts"
},
"assets": [
"./src/lib/**/*.scss",
"*.scss"
]
}
54 changes: 54 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "@angular-package/sass-string",
"version": "1.0.0-beta",
"author": "@angular-package <contact@angular-package.dev>",
"homepage": "https://angular-package.github.io/spectre.css",
"description": "Modified string Sass module.",
"main": "./index.scss",
"license": "MIT",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
},
"devDependencies": {
"stylelint": "^15.10.3",
"stylelint-config-prettier-scss": "^1.0.0",
"stylelint-config-standard-scss": "^11.0.0",
"stylelint-order": "^6.0.3"
},
"peerDependencies": {
"sass": "^1.78.0"
},
"scripts": {},
"repository": {
"type": "git",
"url": "https://github.com/angular-package/sass-string"
},
"bugs": {
"url": "https://github.com/angular-package/sass-string/issues"
},
"keywords": [
"@angular-package",
"sass:string",
"scss",
"string"
],
"funding": [
{
"type": "individual",
"url": "https://checkout.revolut.com/pay/048b10a3-0e10-42c8-a917-e3e9cb4c8e29"
},
{
"type": "individual",
"url": "https://docs.angular-package.dev/donate/cryptocurrency"
},
{
"type": "patreon",
"url": "https://www.patreon.com/angularpackage"
},
{
"type": "github",
"url": "https://github.com/sponsors/angular-package"
}
]
}
10 changes: 10 additions & 0 deletions spec.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Not active.

// @use "./src/lib/spec";
// @use "../sass-string";

// Distribution: works.
// @use "../../dist/sass-string";

// @debug sass-string.ends-with("primary dark", dark); // true

14 changes: 14 additions & 0 deletions src/lib/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@forward "string.ends-with.function";
@forward "string.index.function";
@forward "string.is-lower-case.function";
@forward "string.is-upper-case.function";
@forward "string.is.function";
@forward "string.join.function";
@forward "string.of.function";
@forward "string.replace-multiple.function";
@forward "string.replace.function";
@forward "string.split.function";
@forward "string.starts-with.function";
@forward "string.to-map.function";
@forward "string.unquote.function";
@forward "sass:string" hide index, split, unquote;
33 changes: 33 additions & 0 deletions src/lib/_string.ends-with.function.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Sass.
@use 'sass:meta';
@use 'sass:string';

// Completed
// The `string.ends-with()` function determines whether `$string` ends with `$search-string` at `$position`.
// @param `$string` String to determine that it ends with `$search-string` at `$position`.
// @param `$search-string` String to determine that ends in `$string` at `$position`.
// @param `$position` Position at which `$search-string` is expected to be found.
// @returns The returned value is a `bool` indicating whether `$string` ends with `$search-string` at `$position`.
@function ends-with($string, $search-string, $position: null) {
@if not (meta.type-of($string) == string) {
@error "$string: #{$string} is not string";
}
@if not (meta.type-of($search-string) == string) {
@error "$search-string: #{$search-string} is not string";
}
$index: string.index($string, $search-string);
@if if($position, $position and $index == $position, true) {
@return ($index - 1) + string.length($search-string) == string.length($string);
}
@return false;
}

// Examples.
// $-text: 'Primary color red';

// @debug ends-with($-text, 'red'); // true
// @debug ends-with($-text, 'color red'); // true

// Position.
// @debug ends-with($-text, 'color red', 9); // true
// @debug ends-with($-text, 'color red', 4); // false
Loading