Skip to content

Commit b05138c

Browse files
Merge pull request #1 from angular-package/0.0.x
0.0.1-alpha
2 parents ee81482 + 384d709 commit b05138c

File tree

131 files changed

+5960
-48
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+5960
-48
lines changed

README.md

Lines changed: 627 additions & 10 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 8 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,34 @@
11
{
22
"name": "@angular-package/ui",
3-
"version": "0.0.1",
3+
"version": "0.0.1-alpha",
4+
"description": "Configurable user interface.",
5+
"author": "@angular-package <contact@angular-package.dev> (https://angular-package.dev)",
6+
"homepage": "https://github.com/angular-package/ui",
47
"peerDependencies": {
5-
"@angular-package/component-loader": "^1.0.0-alpha.0",
68
"@angular/common": "^13.2.0",
7-
"@angular/core": "^13.2.0"
9+
"@angular/core": "^13.2.0",
10+
"rxjs": "^7.5.6"
811
},
912
"dependencies": {
1013
"tslib": "^2.3.0"
11-
}
14+
},
15+
"publishConfig": {
16+
"access": "public",
17+
"registry": "https://registry.npmjs.org"
18+
},
19+
"keywords": [
20+
"@angular-package",
21+
"@angular-package/ui",
22+
"UI",
23+
"User interface",
24+
"Configurable"
25+
],
26+
"repository": {
27+
"type": "git",
28+
"url": "https://github.com/angular-package/ui"
29+
},
30+
"bugs": {
31+
"url": "https://github.com/angular-package/ui/issues"
32+
},
33+
"license": "MIT"
1234
}

src/public-api.ts

Lines changed: 140 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,144 @@
11
/*
22
* Public API Surface of ui
33
*/
4+
export { Ability, AbilityService } from './utility/ability';
5+
export { Active, ActiveService } from './utility/active';
6+
export { Align } from './utility/align';
47

5-
export * from './lib/ui.service';
6-
export * from './lib/ui.component';
7-
export * from './lib/ui.module';
8+
export { BlurService } from './utility/blur';
9+
export { Boolean } from './utility/boolean';
10+
11+
// Color.
12+
export {
13+
// Class.
14+
Color,
15+
CssPropertyColor,
16+
17+
// Type.
18+
BgColors,
19+
Colors,
20+
Shade,
21+
22+
// Constant.
23+
CSS_COLORS
24+
} from './utility/color';
25+
26+
// Css property.
27+
export { CssProperty } from './utility/css-property';
28+
29+
// Expandable.
30+
export {
31+
Expandable,
32+
ExpandableService,
33+
} from './utility/expandable';
34+
35+
// Main.
36+
export {
37+
Duration,
38+
Status,
39+
} from './utility/lib';
40+
41+
// Margin.
42+
export {
43+
// Class.
44+
Margin,
45+
MarginService,
46+
} from './utility/margin';
47+
48+
// Name.
49+
export {
50+
// Class.
51+
Name,
52+
Prefix,
53+
Suffix,
54+
55+
// Type.
56+
AffixedName,
57+
PrefixedName,
58+
SuffixedName,
59+
} from './utility/name';
60+
61+
// Padding.
62+
export { Padding } from './utility/padding';
63+
64+
// Pattern.
65+
export { Pattern } from './utility/pattern';
66+
67+
// Position.
68+
export { Position } from './utility/position';
69+
70+
/*
71+
* Public API Surface of range
72+
*/
73+
export {
74+
// Abstract class.
75+
Inequality,
76+
77+
// Class.
78+
Greater,
79+
Less,
80+
Maximum,
81+
Minimum,
82+
Number,
83+
Range,
84+
} from './utility/range';
85+
86+
// Rxjs.
87+
export {
88+
Subjects,
89+
Subscriptions,
90+
} from './utility/rxjs';
91+
92+
// Scale.
93+
export {
94+
// Class.
95+
Scale,
96+
97+
// Constant.
98+
AVAILABLE_LEVELS,
99+
100+
// Type.
101+
Levels
102+
} from './utility/scale';
103+
104+
// Sidebar.
105+
export {
106+
// Service.
107+
SidebarService,
108+
109+
// Interface.
110+
SidebarConfig
111+
} from './utility/sidebar';
112+
113+
// Size.
114+
export {
115+
Size,
116+
SizeService,
117+
118+
// Interface.
119+
SizeOptions,
120+
121+
// Type.
122+
Sizes,
123+
SizesConfig,
124+
} from './utility/size';
125+
126+
// String.
127+
export { String } from './utility/string';
128+
129+
// Text align.
130+
export {
131+
// Class.
132+
TextAlign,
133+
134+
// Type.
135+
TxtAlign
136+
} from './utility/text-align';
137+
138+
// Type.
139+
export {
140+
Presence,
141+
Shape,
142+
Subscribable,
143+
TransitionDuration
144+
} from './utility/type';

src/utility/ability/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { Ability } from './src/ability.class';
2+
export { AbilityService } from './src/ability.service';
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
// Rxjs.
2+
import { Observer, Subscription } from 'rxjs';
3+
4+
// Status.
5+
import { Status } from '../../lib/status.class';
6+
7+
// Type.
8+
import { Subscribable } from '../../type/subscribable.type';
9+
10+
/**
11+
*
12+
*/
13+
export class Ability extends Status<'disabled' | 'enabled'> {
14+
/**
15+
*
16+
*/
17+
public get disabled(): boolean {
18+
return super.isFalse();
19+
}
20+
21+
/**
22+
*
23+
*/
24+
public get enabled(): boolean {
25+
return super.isTrue();
26+
}
27+
28+
/**
29+
*
30+
* @param status
31+
* @angularpackage
32+
*/
33+
constructor(status?: boolean) {
34+
super(status, ['disabled', 'enabled']);
35+
}
36+
37+
/**
38+
*
39+
* @returns
40+
* @angularpackage
41+
*/
42+
public disable(emit = true): this {
43+
this.falsy(emit), emit && this.emit('disabled');
44+
return this;
45+
}
46+
47+
/**
48+
*
49+
* @returns
50+
* @angularpackage
51+
*/
52+
public enable(emit = true): this {
53+
this.truthy(emit), emit && this.emit('enabled');
54+
return this;
55+
}
56+
57+
/**
58+
*
59+
* @returns
60+
* @angularpackage
61+
*/
62+
public isDisabled(callbackFn?: (status: boolean | undefined) => void): boolean {
63+
callbackFn && callbackFn(super.status);
64+
return super.status === false;
65+
}
66+
67+
/**
68+
*
69+
* @returns
70+
* @angularpackage
71+
*/
72+
public isEnabled(callbackFn?: (status: boolean | undefined) => void): boolean {
73+
callbackFn && callbackFn(super.status);
74+
return super.status === true;
75+
}
76+
77+
/**
78+
*
79+
* @param disabled
80+
* @param emit
81+
* @returns
82+
* @angularpackage
83+
*/
84+
public setDisabled(disabled?: boolean, emit = true): this {
85+
this.set(!disabled, emit)
86+
typeof disabled === 'boolean' && this.subjects.get('disabled').next(disabled);
87+
return this;
88+
}
89+
90+
/**
91+
*
92+
* @param enabled
93+
* @param emit
94+
* @returns
95+
* @angularpackage
96+
*/
97+
public setEnabled(enabled?: boolean, emit = true): this {
98+
this.set(enabled, emit);
99+
typeof enabled === 'boolean' && this.subjects.get('enabled').next(enabled);
100+
return this;
101+
}
102+
103+
/**
104+
*
105+
* @param to
106+
* @param observer
107+
* @returns
108+
* @angularpackage
109+
*/
110+
public subscribeTo(
111+
to: Subscribable<'disabled' | 'enabled'>,
112+
observer: Partial<Observer<boolean>>,
113+
): Subscription {
114+
return super.subjects.subscribe(to, observer);
115+
}
116+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @angular.
2+
import { Injectable } from '@angular/core';
3+
4+
// Ability.
5+
import { Ability } from './ability.class';
6+
7+
/**
8+
*
9+
*/
10+
@Injectable()
11+
export class AbilityService extends Ability {}

src/utility/active/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { Active } from './src/active.class';
2+
export { ActiveService } from './src/active.service';

0 commit comments

Comments
 (0)