Skip to content

Commit f50f052

Browse files
Merge pull request #1 from angular-package/develop
1.0.0-beta
2 parents e2458cb + 0ef5939 commit f50f052

27 files changed

+1538
-0
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.idea/
2+
node_modules/
3+
yarn.lock
4+
package-lock.json
5+
.*
6+
!.csscomb.json
7+
!.gitignore
8+
!.gitattributes
9+
!.hound.yml
10+
!.scss-lint.yml
11+
!.stylelintrc.json
12+
temp

README.md

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
# angular-package
2+
3+
<a href='https://angular-package.dev' target='_blank'>
4+
<img align="right" width="92" height="92" src="https://avatars.githubusercontent.com/u/31412194?s=400&u=c9929aa36826318ccac8f7b84516e1ce3af7e21c&v=4" />
5+
</a>
6+
7+
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.
8+
9+
<br>
10+
11+
<a href="https://angular-package.github.io/sass"><img src="https://sass-lang.com/assets/img/logos/logo.svg" width="92" height="92" /></a>
12+
13+
## Sass String
14+
15+
Sass String - Modified string Sass module.
16+
17+
[![Gitter][gitter-badge]][gitter-chat]
18+
[![Discord][discord-badge]][discord-channel]
19+
[![Twitter][twitter-badge]][twitter-follow]
20+
21+
<!-- npm badge -->
22+
[![npm version][sass-string-npm-badge-svg]][sass-string-npm-badge]
23+
24+
<!-- GitHub badges -->
25+
[![GitHub issues][sass-string-badge-issues]][sass-string-issues]
26+
[![GitHub forks][sass-string-badge-forks]][sass-string-forks]
27+
[![GitHub stars][sass-string-badge-stars]][sass-string-stars]
28+
[![GitHub license][sass-string-badge-license]][sass-string-license]
29+
30+
<!-- Sponsors -->
31+
[![GitHub Sponsors][github-badge-sponsor]][github-sponsor-link]
32+
[![Patreon Sponsors][patreon-badge]][patreon-link]
33+
34+
Extended sass modules:
35+
36+
* 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.
37+
38+
<br>
39+
40+
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. ♥
41+
42+
> Feel **free** to submit a pull request. Help is always appreciated.
43+
44+
<br>
45+
46+
## Table of contents
47+
48+
* [Skeleton](#skeleton)
49+
* [Code scaffolding](#code-scaffolding)
50+
* [Documentation](#documentation)
51+
* [Changelog](#changelog)
52+
* [Git](#git)
53+
* [Commit](#commit)
54+
* [Versioning](#versioning)
55+
* [License](#license)
56+
57+
<br>
58+
59+
## Skeleton
60+
61+
This package was generated by the [skeleton workspace][skeleton] with [Angular CLI](https://github.com/angular/angular-cli) version `14.2.0`.
62+
63+
Copy this package to the `packages/sass-string` folder of the [skeleton workspace][skeleton] then run the commands below.
64+
65+
<br>
66+
67+
## Code scaffolding
68+
69+
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`.
70+
> Note: Don't forget to add `--project sass-string` or else it will be added to the default project in your `angular.json` file.
71+
72+
### Build
73+
74+
Run `ng build sass-string` to build the project. The build artifacts will be stored in the `dist/` directory.
75+
76+
### Publishing
77+
78+
After building your library with `ng build sass-string`, go to the dist folder `cd dist/sass-string` and run `npm publish`.
79+
80+
## Running unit tests
81+
82+
Run `ng test sass-string` to execute the unit tests via [Karma](https://karma-runner.github.io).
83+
84+
## Further help
85+
86+
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.
87+
88+
<br>
89+
90+
## Documentation
91+
92+
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/)
93+
94+
<br>
95+
96+
## Changelog
97+
98+
To read it, click on the [CHANGELOG.md][sass-string-github-changelog] link.
99+
100+
<br>
101+
102+
## GIT
103+
104+
### Commit
105+
106+
* [AngularJS Git Commit Message Conventions][git-commit-angular]
107+
* [Karma Git Commit Msg][git-commit-karma]
108+
* [Conventional Commits][git-commit-conventional]
109+
110+
### Versioning
111+
112+
[Semantic Versioning 2.0.0][git-semver]
113+
114+
**Given a version number MAJOR.MINOR.PATCH, increment the:**
115+
116+
* MAJOR version when you make incompatible API changes,
117+
* MINOR version when you add functionality in a backwards-compatible manner, and
118+
* PATCH version when you make backwards-compatible bug fixes.
119+
120+
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
121+
122+
**FAQ**
123+
How should I deal with revisions in the 0.y.z initial development phase?
124+
125+
> 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.
126+
127+
How do I know when to release 1.0.0?
128+
129+
> 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.
130+
131+
<br>
132+
133+
## License
134+
135+
MIT © angular-package ([license][sass-string-license])
136+
137+
<!-- Funding -->
138+
[github-badge-sponsor]: https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/angular-package
139+
[github-sponsor-link]: https://github.com/sponsors/angular-package
140+
[patreon-badge]: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dangularpackage%26type%3Dpatrons&style=flat
141+
[patreon-link]: https://www.patreon.com/join/angularpackage/checkout?fan_landing=true&rid=0
142+
143+
[angulario]: https://angular.io
144+
[skeleton]: https://github.com/angular-package/skeleton
145+
146+
<!-- Update status -->
147+
[experimental]: https://img.shields.io/badge/-Experimental-orange
148+
[fix]: https://img.shields.io/badge/-Fix-red
149+
[new]: https://img.shields.io/badge/-eNw-green
150+
[update]: https://img.shields.io/badge/-Update-red
151+
[documentation]: https://img.shields.io/badge/-Documentation-informational
152+
[demonstration]: https://img.shields.io/badge/-Demonstration-green
153+
154+
<!-- Discord -->
155+
[discord-badge]: https://img.shields.io/discord/925168966098386944?style=social&logo=discord&label=Discord
156+
[discord-channel]: https://discord.com/invite/rUCR2CW75G
157+
158+
<!-- Gitter -->
159+
[gitter-badge]: https://img.shields.io/gitter/room/angular-package/ap-sass?style=social&logo=gitter
160+
[gitter-chat]: https://app.gitter.im/#/room/#ap-sass:gitter.im
161+
162+
<!-- Twitter -->
163+
[twitter-badge]: https://img.shields.io/twitter/follow/angularpackage?label=%40angularpackage&style=social
164+
[twitter-follow]: https://twitter.com/angularpackage
165+
166+
<!-- GIT -->
167+
[git-semver]: http://semver.org/
168+
169+
<!-- GIT: commit -->
170+
[git-commit-angular]: https://gist.github.com/stephenparish/9941e89d80e2bc58a153
171+
[git-commit-karma]: http://karma-runner.github.io/0.10/dev/git-commit-msg.html
172+
[git-commit-conventional]: https://www.conventionalcommits.org/en/v1.0.0/
173+
174+
<!-- This package: sass -->
175+
<!-- GitHub: badges -->
176+
[sass-string-badge-issues]: https://img.shields.io/github/issues/angular-package/sass-string
177+
[sass-string-badge-forks]: https://img.shields.io/github/forks/angular-package/sass-string
178+
[sass-string-badge-stars]: https://img.shields.io/github/stars/angular-package/sass-string
179+
[sass-string-badge-license]: https://img.shields.io/github/license/angular-package/sass-string
180+
<!-- GitHub: badges links -->
181+
[sass-string-issues]: https://github.com/angular-package/sass-string/issues
182+
[sass-string-forks]: https://github.com/angular-package/sass-string/network
183+
[sass-string-license]: https://github.com/angular-package/sass-string/blob/master/LICENSE
184+
[sass-string-stars]: https://github.com/angular-package/sass-string/stargazers
185+
<!-- This package -->
186+
[sass-string-github-changelog]: https://github.com/angular-package/sass-string/blob/main/CHANGELOG.md
187+
188+
<!-- Package: sass-string -->
189+
<!-- npm -->
190+
[sass-string-npm-badge-svg]: https://badge.fury.io/js/%40angular-package%2Fsass-string.svg
191+
[sass-string-npm-badge-png]: https://badge.fury.io/js/%40angular-package%2Fsass-string.png
192+
[sass-string-npm-badge]: https://badge.fury.io/js/%40angular-package%2Fsass-string
193+
[sass-string-npm-readme]: https://www.npmjs.com/package/@angular-package/sass-string#readme
194+
195+
<!-- GitHub -->
196+
[sass-string-github-readme]: https://github.com/angular-package/sass-string#readme

index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@forward "src/lib";

karma.conf.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-jasmine-html-reporter'),
12+
require('karma-coverage'),
13+
require('@angular-devkit/build-angular/plugins/karma')
14+
],
15+
client: {
16+
jasmine: {
17+
// you can add configuration options for Jasmine here
18+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19+
// for example, you can disable the random execution with `random: false`
20+
// or set a specific seed with `seed: 4321`
21+
},
22+
clearContext: false // leave Jasmine Spec Runner output visible in browser
23+
},
24+
jasmineHtmlReporter: {
25+
suppressAll: true // removes the duplicated traces
26+
},
27+
coverageReporter: {
28+
dir: require('path').join(__dirname, '../../coverage/sass-string'),
29+
subdir: '.',
30+
reporters: [
31+
{ type: 'html' },
32+
{ type: 'text-summary' }
33+
]
34+
},
35+
reporters: ['progress', 'kjhtml'],
36+
port: 9876,
37+
colors: true,
38+
logLevel: config.LOG_INFO,
39+
autoWatch: true,
40+
browsers: ['Chrome'],
41+
singleRun: false,
42+
restartOnFileChange: true
43+
});
44+
};

ng-package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3+
"dest": "../../dist/sass-string",
4+
"lib": {
5+
"entryFile": "src/public-api.ts"
6+
},
7+
"assets": [
8+
"./src/lib/**/*.scss",
9+
"*.scss"
10+
]
11+
}

package.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "@angular-package/sass-string",
3+
"version": "1.0.0-beta",
4+
"author": "@angular-package <contact@angular-package.dev>",
5+
"homepage": "https://angular-package.github.io/spectre.css",
6+
"description": "Modified string Sass module.",
7+
"main": "./index.scss",
8+
"license": "MIT",
9+
"publishConfig": {
10+
"access": "public",
11+
"registry": "https://registry.npmjs.org"
12+
},
13+
"devDependencies": {
14+
"stylelint": "^15.10.3",
15+
"stylelint-config-prettier-scss": "^1.0.0",
16+
"stylelint-config-standard-scss": "^11.0.0",
17+
"stylelint-order": "^6.0.3"
18+
},
19+
"peerDependencies": {
20+
"sass": "^1.78.0"
21+
},
22+
"scripts": {},
23+
"repository": {
24+
"type": "git",
25+
"url": "https://github.com/angular-package/sass-string"
26+
},
27+
"bugs": {
28+
"url": "https://github.com/angular-package/sass-string/issues"
29+
},
30+
"keywords": [
31+
"@angular-package",
32+
"sass:string",
33+
"scss",
34+
"string"
35+
],
36+
"funding": [
37+
{
38+
"type": "individual",
39+
"url": "https://checkout.revolut.com/pay/048b10a3-0e10-42c8-a917-e3e9cb4c8e29"
40+
},
41+
{
42+
"type": "individual",
43+
"url": "https://docs.angular-package.dev/donate/cryptocurrency"
44+
},
45+
{
46+
"type": "patreon",
47+
"url": "https://www.patreon.com/angularpackage"
48+
},
49+
{
50+
"type": "github",
51+
"url": "https://github.com/sponsors/angular-package"
52+
}
53+
]
54+
}

spec.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Not active.
2+
3+
// @use "./src/lib/spec";
4+
// @use "../sass-string";
5+
6+
// Distribution: works.
7+
// @use "../../dist/sass-string";
8+
9+
// @debug sass-string.ends-with("primary dark", dark); // true
10+

src/lib/_index.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@forward "string.ends-with.function";
2+
@forward "string.index.function";
3+
@forward "string.is-lower-case.function";
4+
@forward "string.is-upper-case.function";
5+
@forward "string.is.function";
6+
@forward "string.join.function";
7+
@forward "string.of.function";
8+
@forward "string.replace-multiple.function";
9+
@forward "string.replace.function";
10+
@forward "string.split.function";
11+
@forward "string.starts-with.function";
12+
@forward "string.to-map.function";
13+
@forward "string.unquote.function";
14+
@forward "sass:string" hide index, split, unquote;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Sass.
2+
@use 'sass:meta';
3+
@use 'sass:string';
4+
5+
// Completed
6+
// The `string.ends-with()` function determines whether `$string` ends with `$search-string` at `$position`.
7+
// @param `$string` String to determine that it ends with `$search-string` at `$position`.
8+
// @param `$search-string` String to determine that ends in `$string` at `$position`.
9+
// @param `$position` Position at which `$search-string` is expected to be found.
10+
// @returns The returned value is a `bool` indicating whether `$string` ends with `$search-string` at `$position`.
11+
@function ends-with($string, $search-string, $position: null) {
12+
@if not (meta.type-of($string) == string) {
13+
@error "$string: #{$string} is not string";
14+
}
15+
@if not (meta.type-of($search-string) == string) {
16+
@error "$search-string: #{$search-string} is not string";
17+
}
18+
$index: string.index($string, $search-string);
19+
@if if($position, $position and $index == $position, true) {
20+
@return ($index - 1) + string.length($search-string) == string.length($string);
21+
}
22+
@return false;
23+
}
24+
25+
// Examples.
26+
// $-text: 'Primary color red';
27+
28+
// @debug ends-with($-text, 'red'); // true
29+
// @debug ends-with($-text, 'color red'); // true
30+
31+
// Position.
32+
// @debug ends-with($-text, 'color red', 9); // true
33+
// @debug ends-with($-text, 'color red', 4); // false

0 commit comments

Comments
 (0)