@tacdaed/fragments 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/README.md +73 -0
  2. package/assets/resources/fonts/OpenSans/OpenSans-Italic-VariableFont_wdth_wght.ttf +0 -0
  3. package/assets/resources/fonts/OpenSans/OpenSans-VariableFont_wdth_wght.ttf +0 -0
  4. package/assets/resources/fonts/Roboto/Roboto-Black.ttf +0 -0
  5. package/assets/resources/fonts/Roboto/Roboto-BlackItalic.ttf +0 -0
  6. package/assets/resources/fonts/Roboto/Roboto-Bold.ttf +0 -0
  7. package/assets/resources/fonts/Roboto/Roboto-BoldItalic.ttf +0 -0
  8. package/assets/resources/fonts/Roboto/Roboto-Italic.ttf +0 -0
  9. package/assets/resources/fonts/Roboto/Roboto-Light.ttf +0 -0
  10. package/assets/resources/fonts/Roboto/Roboto-LightItalic.ttf +0 -0
  11. package/assets/resources/fonts/Roboto/Roboto-Medium.ttf +0 -0
  12. package/assets/resources/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
  13. package/assets/resources/fonts/Roboto/Roboto-Regular.ttf +0 -0
  14. package/assets/resources/fonts/Roboto/Roboto-Thin.ttf +0 -0
  15. package/assets/resources/fonts/Roboto/Roboto-ThinItalic.ttf +0 -0
  16. package/assets/styles/scss/_all.scss +5 -0
  17. package/assets/styles/scss/_fonts.scss +122 -0
  18. package/assets/styles/scss/_functions.scss +3 -0
  19. package/assets/styles/scss/_reset.scss +0 -0
  20. package/assets/styles/scss/_variables.scss +138 -0
  21. package/assets/styles/scss/directives/_badge.scss +59 -0
  22. package/assets/styles/scss/directives/_tooltip.scss +154 -0
  23. package/assets/styles/scss/style.scss +1 -0
  24. package/fesm2022/fragments.mjs +8928 -0
  25. package/fesm2022/fragments.mjs.map +1 -0
  26. package/index.d.ts +3929 -0
  27. package/package.json +29 -0
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # Fragments Library
2
+
3
+ A reusable Angular library for UI fragments, code highlighting, and more.
4
+
5
+ ## Features
6
+
7
+ - UI components and utilities
8
+ - Syntax highlighting for code blocks
9
+ - SCSS themes and FontAwesome integration
10
+
11
+ ## Installation
12
+
13
+ Install the library in your Angular project:
14
+
15
+ ```sh
16
+ npm install fragments
17
+ ```
18
+
19
+ ## Setup
20
+
21
+ ### 1. Import Library Module
22
+
23
+ Import the library module in your app module:
24
+
25
+ ```ts
26
+ import { FragmentsModule } from 'fragments';
27
+
28
+ @NgModule({
29
+ imports: [
30
+ FragmentsModule,
31
+ // ...other modules
32
+ ],
33
+ })
34
+ export class AppModule {}
35
+ ```
36
+
37
+ ### 2. Add Styles to `angular.json`
38
+
39
+ To enable syntax highlighting, you must import a Highlight.js theme in your app’s `angular.json`:
40
+
41
+ ```json
42
+ "styles": [
43
+ "node_modules/fragments/assets/styles/scss/highlight.js/github-dark.scss",
44
+ "node_modules/fragments/assets/styles/scss/style.scss",
45
+ "node_modules/fragments/assets/font-awesome/css/all.min.css",
46
+ "src/styles.scss"
47
+ ]
48
+ ```
49
+
50
+ #### Choosing a Highlight.js Theme
51
+
52
+ You can choose any theme from:
53
+
54
+ ```
55
+ node_modules/fragments/assets/styles/scss/highlight.js/
56
+ ```
57
+
58
+ Popular options include:
59
+
60
+ - `github-dark.scss`
61
+ - `atom-one-dark.scss`
62
+ - `monokai.scss`
63
+ - `default.scss`
64
+
65
+ Pick the style that best fits your app!
66
+
67
+ ## Notes
68
+
69
+ - **Highlight.js is bundled with the library.**
70
+ You do not need to install it separately.
71
+ - If you do not import a Highlight.js style, code highlighting will not be styled correctly.
72
+
73
+ ---
@@ -0,0 +1,5 @@
1
+ @use './fonts';
2
+ @use './variables';
3
+ @use './functions';
4
+ @use './directives/badge';
5
+ @use './directives/tooltip';
@@ -0,0 +1,122 @@
1
+ /* ==========================================================================
2
+ FONT DEFINITIONS
3
+ Path: assets/resources/fonts/
4
+ ========================================================================== */
5
+
6
+ /* =======================
7
+ OPEN SANS
8
+ ======================= */
9
+ @font-face {
10
+ font-family: 'Open Sans';
11
+ font-style: normal;
12
+ font-weight: 100 900;
13
+ font-display: swap;
14
+ src: url('/assets/resources/fonts/OpenSans/OpenSans-VariableFont_wdth_wght.ttf') format('truetype');
15
+ }
16
+
17
+ @font-face {
18
+ font-family: 'Open Sans';
19
+ font-style: italic;
20
+ font-weight: 100 900;
21
+ font-display: swap;
22
+ src: url('/assets/resources/fonts/OpenSans/OpenSans-Italic-VariableFont_wdth_wght.ttf') format('truetype');
23
+ }
24
+
25
+ /* =======================
26
+ ROBOTO
27
+ ======================= */
28
+ @font-face {
29
+ font-family: 'Roboto';
30
+ src: url('/assets/resources/fonts/Roboto/Roboto-Thin.ttf') format('truetype');
31
+ font-weight: 100;
32
+ font-style: normal;
33
+ font-display: swap;
34
+ }
35
+
36
+ @font-face {
37
+ font-family: 'Roboto';
38
+ src: url('/assets/resources/fonts/Roboto/Roboto-ThinItalic.ttf') format('truetype');
39
+ font-weight: 100;
40
+ font-style: italic;
41
+ font-display: swap;
42
+ }
43
+
44
+ @font-face {
45
+ font-family: 'Roboto';
46
+ src: url('/assets/resources/fonts/Roboto/Roboto-Light.ttf') format('truetype');
47
+ font-weight: 300;
48
+ font-style: normal;
49
+ font-display: swap;
50
+ }
51
+
52
+ @font-face {
53
+ font-family: 'Roboto';
54
+ src: url('/assets/resources/fonts/Roboto/Roboto-LightItalic.ttf') format('truetype');
55
+ font-weight: 300;
56
+ font-style: italic;
57
+ font-display: swap;
58
+ }
59
+
60
+ @font-face {
61
+ font-family: 'Roboto';
62
+ src: url('/assets/resources/fonts/Roboto/Roboto-Regular.ttf') format('truetype');
63
+ font-weight: 400;
64
+ font-style: normal;
65
+ font-display: swap;
66
+ }
67
+
68
+ @font-face {
69
+ font-family: 'Roboto';
70
+ src: url('/assets/resources/fonts/Roboto/Roboto-Italic.ttf') format('truetype');
71
+ font-weight: 400;
72
+ font-style: italic;
73
+ font-display: swap;
74
+ }
75
+
76
+ @font-face {
77
+ font-family: 'Roboto';
78
+ src: url('/assets/resources/fonts/Roboto/Roboto-Medium.ttf') format('truetype');
79
+ font-weight: 500;
80
+ font-style: normal;
81
+ font-display: swap;
82
+ }
83
+
84
+ @font-face {
85
+ font-family: 'Roboto';
86
+ src: url('/assets/resources/fonts/Roboto/Roboto-MediumItalic.ttf') format('truetype');
87
+ font-weight: 500;
88
+ font-style: italic;
89
+ font-display: swap;
90
+ }
91
+
92
+ @font-face {
93
+ font-family: 'Roboto';
94
+ src: url('/assets/resources/fonts/Roboto/Roboto-Bold.ttf') format('truetype');
95
+ font-weight: 700;
96
+ font-style: normal;
97
+ font-display: swap;
98
+ }
99
+
100
+ @font-face {
101
+ font-family: 'Roboto';
102
+ src: url('/assets/resources/fonts/Roboto/Roboto-BoldItalic.ttf') format('truetype');
103
+ font-weight: 700;
104
+ font-style: italic;
105
+ font-display: swap;
106
+ }
107
+
108
+ @font-face {
109
+ font-family: 'Roboto';
110
+ src: url('/assets/resources/fonts/Roboto/Roboto-Black.ttf') format('truetype');
111
+ font-weight: 900;
112
+ font-style: normal;
113
+ font-display: swap;
114
+ }
115
+
116
+ @font-face {
117
+ font-family: 'Roboto';
118
+ src: url('/assets/resources/fonts/Roboto/Roboto-BlackItalic.ttf') format('truetype');
119
+ font-weight: 900;
120
+ font-style: italic;
121
+ font-display: swap;
122
+ }
@@ -0,0 +1,3 @@
1
+ @function px-to-rem($px, $base: 16px) {
2
+ @return calc($px / $base * 1rem);
3
+ }
File without changes
@@ -0,0 +1,138 @@
1
+ @use 'sass:color';
2
+
3
+ $color-primary: #6ea8d9;
4
+ $color-primary-light: #b3d1f0;
5
+ $color-primary-dark: #4c7aae;
6
+
7
+ $color-secondary: #e6c57a;
8
+ $color-secondary-light: #f7e7ba;
9
+ $color-secondary-dark: #c9a24e;
10
+
11
+ $color-tertiary: #d97ebd;
12
+ $color-tertiary-light: #f1bdd8;
13
+ $color-tertiary-dark: #b05a99;
14
+
15
+ $color-dark: #3d3d3d;
16
+ $color-light: #fdfdfd;
17
+ $color-neutral: #f1f5f9;
18
+ $color-neutral-text: #334155;
19
+
20
+ $color-info: #6baed9;
21
+ $color-info-light: #cce2f2;
22
+ $color-info-dark: #4b8bbf;
23
+
24
+ $color-warning: #eba566;
25
+ $color-warning-light: #fcd8b8;
26
+ $color-warning-dark: #d68a47;
27
+
28
+ $color-danger: #d66a6a;
29
+ $color-danger-light: #f2bebe;
30
+ $color-danger-dark: #b34d4d;
31
+
32
+ $color-success: #6baf7d;
33
+ $color-success-light: #a1d7a0;
34
+ $color-success-dark: #478c49;
35
+
36
+ $color-disabled: #bfbfbf;
37
+ $color-disabled-text: #9e9e9e;
38
+ $color-dark-soft: #737579;
39
+ $color-dark-neutral: #5e5f62;
40
+ $color-light-soft: #e6e6e6;
41
+ $color-light-neutral: #cfcece;
42
+
43
+ // Breakpoints
44
+ $screen-sm-min: 576px;
45
+ $screen-md-min: 768px;
46
+ $screen-lg-min: 992px;
47
+ $screen-xl-min: 1200px;
48
+
49
+ // Table
50
+ $table-input-padding: 10px;
51
+
52
+ // Input
53
+ $input-text-color: $color-dark-neutral;
54
+ $input-background: $color-light;
55
+ $input-border-color: color.scale($color-dark-soft, $lightness: 50%);
56
+ $input-border-radius: .25rem;
57
+ $input-padding: .25rem .5rem;
58
+ $input-font-size: 1rem;
59
+ $input-focus-border-color: $color-primary;
60
+ $input-error-border-color: $color-danger;
61
+ $input-disabled-background: $color-disabled;
62
+ $input-disabled-border-color: $color-dark-soft;
63
+ $input-placeholder-color: $color-dark-soft;
64
+ $input-font-family:
65
+ 'Open Sans',
66
+ 'Roboto',
67
+ system-ui,
68
+ -apple-system,
69
+ "Segoe UI",
70
+ "Helvetica Neue",
71
+ "Noto Sans",
72
+ "Liberation Sans",
73
+ Arial,
74
+ sans-serif,
75
+ "Apple Color Emoji",
76
+ "Segoe UI Emoji",
77
+ "Segoe UI Symbol",
78
+ "Noto Color Emoji";
79
+
80
+ // Shadows
81
+ $box-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.12);
82
+ $box-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.1);
83
+ $box-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.05);
84
+
85
+ $box-shadow-light-sm: 0 1px 1.5px rgba($color-light, 0.08), 0 0.5px 1px rgba($color-light, 0.06);
86
+ $box-shadow-light-md: 0 2px 4px rgba($color-light, 0.1), 0 1px 2px rgba($color-light, 0.08);
87
+ $box-shadow-light-lg: 0 6px 12px rgba($color-light, 0.12), 0 3px 6px rgba($color-light, 0.1);
88
+
89
+ $box-shadow-primary-sm: 0 2px 4px rgba($color-primary-dark, 0.1), 0 1px 2px rgba($color-primary-dark, 0.08);
90
+ $box-shadow-primary-md: 0 6px 12px rgba($color-primary-dark, 0.15), 0 3px 6px rgba($color-primary-dark, 0.1);
91
+ $box-shadow-primary-lg: 0 12px 24px rgba($color-primary-dark, 0.2), 0 6px 12px rgba($color-primary-dark, 0.15);
92
+
93
+ $box-shadow-secondary-sm: 0 2px 4px rgba($color-secondary-dark, 0.1), 0 1px 2px rgba($color-secondary-dark, 0.08);
94
+ $box-shadow-secondary-md: 0 6px 12px rgba($color-secondary-dark, 0.15), 0 3px 6px rgba($color-secondary-dark, 0.1);
95
+ $box-shadow-secondary-lg: 0 12px 24px rgba($color-secondary-dark, 0.2), 0 6px 12px rgba($color-secondary-dark, 0.15);
96
+
97
+ $box-shadow-tertiary-sm: 0 2px 4px rgba($color-tertiary-dark, 0.1), 0 1px 2px rgba($color-tertiary-dark, 0.08);
98
+ $box-shadow-tertiary-md: 0 6px 12px rgba($color-tertiary-dark, 0.15), 0 3px 6px rgba($color-tertiary-dark, 0.1);
99
+ $box-shadow-tertiary-lg: 0 12px 24px rgba($color-tertiary-dark, 0.2), 0 6px 12px rgba($color-tertiary-dark, 0.15);
100
+
101
+ $box-shadow-selection-option-hover: 0 2px 4px rgba($color-dark-soft, 0.15), 0 1px 2px rgba($color-dark-neutral, 0.1);
102
+
103
+ // Inner shadows (inset)
104
+ $box-shadow-inner-sm: inset 0 1px 2px rgba(0, 0, 0, 0.06);
105
+ $box-shadow-inner-md: inset 0 4px 6px rgba(0, 0, 0, 0.06);
106
+ $box-shadow-inner-lg: inset 0 10px 15px rgba(0, 0, 0, 0.06);
107
+
108
+ // Fonts
109
+ $base-font: 'Open Sans', 'Roboto', system-ui, 'Helvetica Neue', sans-serif;
110
+
111
+ // Font Sizes
112
+ $font-size-2xs: 0.5rem;
113
+ $font-size-xs: 0.75rem;
114
+ $font-size-sm: 0.875rem;
115
+ $font-size-md: 1rem;
116
+ $font-size-lg: 1.125rem;
117
+ $font-size-xl: 1.25rem;
118
+ $font-size-2xl: 1.5rem;
119
+ $font-size-3xl: 1.875rem;
120
+ $font-size-4xl: 2.25rem;
121
+ $font-size-5xl: 3rem;
122
+
123
+ // Loader
124
+ $frg-loader-color-primary: $color-primary;
125
+ $frg-loader-color-secondary: $color-secondary;
126
+ $frg-loader-color-tertiary: $color-tertiary;
127
+ $frg-loader-color-dark: $color-dark;
128
+ $frg-loader-color-light: $color-light;
129
+ $frg-loader-size-xs: 1rem;
130
+ $frg-loader-size-sm: 1.5rem;
131
+ $frg-loader-size-md: 2.25rem;
132
+ $frg-loader-size-lg: 3rem;
133
+ $frg-loader-size-xl: 4.5rem;
134
+ $frg-loader-border-width: 0.1875rem;
135
+
136
+ // Accordion
137
+ $frg-accordion-border-color: #dbdbdb;
138
+ $frg-accordion-header-background-color: #f6f6f6;
@@ -0,0 +1,59 @@
1
+ @use '../variables' as *;
2
+
3
+ /* Host container for badges */
4
+ .frg-has-badge {
5
+ position: relative;
6
+ display: inline-flex;
7
+ align-items: center;
8
+ }
9
+
10
+ /* Badge element */
11
+ .frg-badge {
12
+ position: relative;
13
+ top: -12px;
14
+ right: 4px;
15
+ display: inline-flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ gap: 0.25rem;
19
+ font-weight: 600;
20
+ line-height: 1;
21
+ border-radius: 999px;
22
+ min-width: 1rem;
23
+ height: 1rem;
24
+ padding: 0 0.2rem;
25
+ font-size: 0.75rem;
26
+ background-color: $color-primary;
27
+ color: white;
28
+
29
+ /* Sizes */
30
+ &--sm { font-size: 0.625rem; height: 1rem; min-width: 1rem; }
31
+ &--md { font-size: 0.75rem; height: 1.25rem; min-width: 1.25rem; }
32
+ &--lg { font-size: 0.875rem; height: 1.5rem; min-width: 1.5rem; }
33
+
34
+ /* Dot mode */
35
+ &--dot {
36
+ width: 0.5rem;
37
+ height: 0.5rem;
38
+ min-width: 0.5rem;
39
+ padding: 0;
40
+ border-radius: 50%;
41
+ }
42
+
43
+ /* Style variants */
44
+ &--primary { background-color: $color-primary; }
45
+ &--secondary { background-color: $color-secondary; }
46
+ &--success { background-color: $color-success; }
47
+ &--danger { background-color: $color-danger; }
48
+ &--warning { background-color: $color-warning; }
49
+ &--info { background-color: $color-info; }
50
+ &--tertiary { background-color: $color-tertiary; }
51
+ &--dark { background-color: $color-dark; }
52
+ &--light { background-color: $color-light; color: $color-dark; }
53
+
54
+ /* Disabled state */
55
+ &--disabled {
56
+ opacity: 0.4;
57
+ pointer-events: none;
58
+ }
59
+ }
@@ -0,0 +1,154 @@
1
+ @use '../variables' as *;
2
+
3
+ .frg-tooltip {
4
+ max-width: 18rem;
5
+ padding: 0.4rem 0.6rem;
6
+ border-radius: 0.25rem;
7
+ background-color: $color-dark;
8
+ color: $color-light;
9
+ font-size: $font-size-sm;
10
+ line-height: 1.3;
11
+ box-shadow: $box-shadow-md;
12
+ pointer-events: none;
13
+ }
14
+
15
+ .fragment-tooltip {
16
+ @extend .frg-tooltip;
17
+ }
18
+
19
+ .frg-popover {
20
+ @extend .frg-tooltip;
21
+ max-width: 22rem;
22
+ pointer-events: auto;
23
+ }
24
+
25
+ .frg-popover-inner {
26
+ @extend .frg-tooltip-inner;
27
+ }
28
+
29
+ .frg-popover-actions {
30
+ display: flex;
31
+ justify-content: flex-end;
32
+ margin-top: 0.35rem;
33
+ }
34
+
35
+ .frg-popover-button {
36
+ border: none;
37
+ border-radius: 0.2rem;
38
+ background-color: $color-light;
39
+ color: $color-dark;
40
+ font-size: $font-size-xs;
41
+ font-weight: 600;
42
+ padding: 0.2rem 0.5rem;
43
+ cursor: pointer;
44
+ }
45
+
46
+ .frg-popover-indicator {
47
+ @extend .frg-tooltip-indicator;
48
+ }
49
+
50
+ .frg-tooltip-inner {
51
+ display: flex;
52
+ flex-direction: column;
53
+ gap: 0.25rem;
54
+
55
+ p {
56
+ margin: 0;
57
+ }
58
+
59
+ strong {
60
+ font-weight: 600;
61
+ }
62
+ }
63
+
64
+ .fragment-tooltip-inner {
65
+ @extend .frg-tooltip-inner;
66
+ }
67
+
68
+ .frg-tooltip-indicator,
69
+ .fragment-tooltip-indicator {
70
+ position: absolute;
71
+ width: 0;
72
+ height: 0;
73
+ border-style: solid;
74
+ border-left: 6px solid transparent;
75
+ border-right: 6px solid transparent;
76
+ border-top: 6px solid $color-dark;
77
+ border-bottom: 0;
78
+ }
79
+
80
+ .frg-tooltip[data-position^='top'] .frg-tooltip-indicator,
81
+ .fragment-tooltip[data-position^='top'] .fragment-tooltip-indicator,
82
+ .frg-popover[data-position^='top'] .frg-popover-indicator {
83
+ bottom: -5px;
84
+ left: 50%;
85
+ transform: translateX(-50%);
86
+ border-top-color: $color-dark;
87
+ border-bottom: 0;
88
+ }
89
+
90
+ .frg-tooltip[data-position='top-left'] .frg-tooltip-indicator,
91
+ .fragment-tooltip[data-position='top-left'] .fragment-tooltip-indicator,
92
+ .frg-popover[data-position='top-left'] .frg-popover-indicator {
93
+ left: auto;
94
+ right: 0.75rem;
95
+ transform: none;
96
+ }
97
+
98
+ .frg-tooltip[data-position='top-right'] .frg-tooltip-indicator,
99
+ .fragment-tooltip[data-position='top-right'] .fragment-tooltip-indicator,
100
+ .frg-popover[data-position='top-right'] .frg-popover-indicator {
101
+ left: 0.75rem;
102
+ right: auto;
103
+ transform: none;
104
+ }
105
+
106
+ .frg-tooltip[data-position^='bottom'] .frg-tooltip-indicator,
107
+ .fragment-tooltip[data-position^='bottom'] .fragment-tooltip-indicator,
108
+ .frg-popover[data-position^='bottom'] .frg-popover-indicator {
109
+ top: -5px;
110
+ left: 50%;
111
+ transform: translateX(-50%);
112
+ border-top: 0;
113
+ border-bottom: 6px solid $color-dark;
114
+ }
115
+
116
+ .frg-tooltip[data-position='bottom-left'] .frg-tooltip-indicator,
117
+ .fragment-tooltip[data-position='bottom-left'] .fragment-tooltip-indicator,
118
+ .frg-popover[data-position='bottom-left'] .frg-popover-indicator {
119
+ left: auto;
120
+ right: 0.75rem;
121
+ transform: none;
122
+ }
123
+
124
+ .frg-tooltip[data-position='bottom-right'] .frg-tooltip-indicator,
125
+ .fragment-tooltip[data-position='bottom-right'] .fragment-tooltip-indicator,
126
+ .frg-popover[data-position='bottom-right'] .frg-popover-indicator {
127
+ left: 0.75rem;
128
+ right: auto;
129
+ transform: none;
130
+ }
131
+
132
+ .frg-tooltip[data-position='left'] .frg-tooltip-indicator,
133
+ .fragment-tooltip[data-position='left'] .fragment-tooltip-indicator,
134
+ .frg-popover[data-position='left'] .frg-popover-indicator {
135
+ right: -5px;
136
+ top: 50%;
137
+ transform: translateY(-50%);
138
+ border-top: 6px solid transparent;
139
+ border-bottom: 6px solid transparent;
140
+ border-left: 6px solid $color-dark;
141
+ border-right: 0;
142
+ }
143
+
144
+ .frg-tooltip[data-position='right'] .frg-tooltip-indicator,
145
+ .fragment-tooltip[data-position='right'] .fragment-tooltip-indicator,
146
+ .frg-popover[data-position='right'] .frg-popover-indicator {
147
+ left: -5px;
148
+ top: 50%;
149
+ transform: translateY(-50%);
150
+ border-top: 6px solid transparent;
151
+ border-bottom: 6px solid transparent;
152
+ border-right: 6px solid $color-dark;
153
+ border-left: 0;
154
+ }
@@ -0,0 +1 @@
1
+ @use './all' as *;