@felfhenor/ui 0.0.0-stage → 0.1.1

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.
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
+ "description": "Angular UI library with first-class gamepad support, built on Tailwind v4 and daisyUI.",
3
+ "license": "UNLICENSED",
4
+ "peerDependencies": {
5
+ "@angular/cdk": "^22.1.0",
6
+ "@angular/common": "^22.1.0",
7
+ "@angular/core": "^22.1.0",
8
+ "@ng-icons/core": "^34.0.0",
9
+ "@ng-icons/tabler-icons": "^34.0.0",
10
+ "@ng-select/ng-select": "^23.5.1",
11
+ "@ngneat/helipopper": "^13.1.2",
12
+ "@ngneat/hotkeys": "^4.1.0",
13
+ "@sweetalert2/ngx-sweetalert2": "^15.0.0",
14
+ "animejs": "^4.5.0",
15
+ "daisyui": "^5.7.9",
16
+ "es-toolkit": "^1.50.0",
17
+ "ngxtension": "^7.2.0",
18
+ "sweetalert2": "^11.26.25",
19
+ "tailwindcss": "^4.3.3",
20
+ "tippy.js": "^6.3.7"
21
+ },
22
+ "dependencies": {
23
+ "tslib": "^2.8.1"
24
+ },
25
+ "sideEffects": false,
2
26
  "name": "@felfhenor/ui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
27
+ "type": "module",
28
+ "main": "./fesm2022/felfhenor-ui.mjs",
29
+ "module": "./fesm2022/felfhenor-ui.mjs",
30
+ "typings": "./types/felfhenor-ui.d.ts",
31
+ "types": "./types/felfhenor-ui.d.ts",
32
+ "exports": {
33
+ ".": {
34
+ "types": "./types/felfhenor-ui.d.ts",
35
+ "default": "./fesm2022/felfhenor-ui.mjs"
36
+ },
37
+ "./styles/*": "./styles/*",
38
+ "./assets/*": "./assets/*",
39
+ "./package.json": {
40
+ "default": "./package.json"
41
+ }
42
+ },
43
+ "version": "0.1.1"
44
+ }
@@ -0,0 +1,279 @@
1
+ // daisyUI badges are fixed-height, so a wrapped warning sentence would spill out of its fill.
2
+ .badge {
3
+ height: auto;
4
+ min-height: var(--size);
5
+ }
6
+
7
+ .tippy-variation-contextMenu .tippy-box {
8
+ background-color: unset;
9
+ color: unset;
10
+ }
11
+
12
+ .tippy-box {
13
+ max-width: 400px !important;
14
+ border-radius: 0;
15
+ }
16
+
17
+ .tippy-content {
18
+ font-variant-numeric: tabular-nums;
19
+ }
20
+
21
+ .text-shadow-black {
22
+ text-shadow:
23
+ -1px -1px 0 #000,
24
+ 1px -1px 0 #000,
25
+ -1px 1px 0 #000,
26
+ 1px 1px 0 #000;
27
+ }
28
+
29
+ .text-shadow-white {
30
+ text-shadow:
31
+ -1px -1px 0 #fff,
32
+ 1px -1px 0 #fff,
33
+ -1px 1px 0 #fff,
34
+ 1px 1px 0 #fff;
35
+ }
36
+
37
+ .tabular-nums {
38
+ font-feature-settings: 'tnum' 1;
39
+ font-family: var(--font-numeric);
40
+ }
41
+
42
+ @utility text-lighter {
43
+ opacity: 0.9;
44
+ }
45
+
46
+ // Typography roles; use these over raw size/weight combos so the design language stays consistent.
47
+ @utility type-page-title {
48
+ @apply card-title;
49
+ }
50
+
51
+ // At least a small button tall, so a column headed by a title lines up with one headed by a tab bar or button.
52
+ @utility type-section-title {
53
+ @apply card-title text-base min-h-8;
54
+ }
55
+
56
+ @utility type-label {
57
+ @apply text-sm font-semibold;
58
+ }
59
+
60
+ @utility type-entity-heading {
61
+ @apply text-lg font-semibold;
62
+ }
63
+
64
+ @utility type-entity-name {
65
+ @apply font-semibold;
66
+ }
67
+
68
+ // Size is left to the slot it fills (row name, detail heading, etc).
69
+ @utility type-unknown {
70
+ @apply font-semibold text-lighter;
71
+ }
72
+
73
+ @utility type-muted {
74
+ @apply text-sm text-lighter;
75
+ }
76
+
77
+ @utility type-meta {
78
+ @apply text-xs text-lighter;
79
+ }
80
+
81
+ @utility type-hint {
82
+ @apply text-xs text-lighter;
83
+
84
+ &::before {
85
+ content: '[';
86
+ }
87
+
88
+ &::after {
89
+ content: ']';
90
+ }
91
+ }
92
+
93
+ @utility type-flavor {
94
+ @apply text-sm italic text-lighter;
95
+ }
96
+
97
+ // Why something can't be done right now.
98
+ @utility type-blocker {
99
+ @apply text-xs text-error;
100
+ }
101
+
102
+ // Neutral is darker than the dark bases, so an outlined neutral button rests in base-content instead.
103
+ .btn-neutral.btn-outline:not([ffListRow]) {
104
+ --btn-rest-fg: var(--color-base-content);
105
+ --btn-border: color-mix(in oklab, var(--color-base-content) 35%, transparent);
106
+ }
107
+
108
+ // Error text on the dark bases is under 4.5:1 contrast, so an outlined error button rests a tint lighter.
109
+ .btn-error.btn-outline {
110
+ --btn-rest-fg: color-mix(in oklab, var(--color-error) 75%, white);
111
+ }
112
+
113
+ // ffDisabledText's overlay still takes hover on a disabled button (which doesn't), so its tooltip can say why.
114
+ @layer components {
115
+ .ff-disabled-tip {
116
+ position: relative;
117
+ }
118
+ }
119
+
120
+ .ff-disabled-tip-target {
121
+ position: absolute;
122
+ inset: 0;
123
+ cursor: not-allowed;
124
+ pointer-events: auto;
125
+ }
126
+
127
+ .ff-disabled-tip:not(:disabled) > .ff-disabled-tip-target {
128
+ pointer-events: none;
129
+ }
130
+
131
+ // "You are here": active tab, navbar view, side-rail item.
132
+ @utility here {
133
+ --here-bg: color-mix(
134
+ in oklab,
135
+ var(--color-primary) 30%,
136
+ var(--color-base-200)
137
+ );
138
+ border-color: var(--color-primary) !important;
139
+ background:
140
+ var(--ff-texture-button),
141
+ linear-gradient(to bottom, var(--here-bg), var(--here-bg)) !important;
142
+ color: var(--color-base-content) !important;
143
+
144
+ &.here-animate {
145
+ animation: here-glow 1.5s ease-in-out infinite;
146
+ }
147
+ }
148
+
149
+ @keyframes here-glow {
150
+ 0%,
151
+ 100% {
152
+ box-shadow: 0 0 2px 0 var(--color-primary);
153
+ }
154
+
155
+ 50% {
156
+ box-shadow: 0 0 6px 4px var(--color-primary);
157
+ }
158
+ }
159
+
160
+ @utility badge-data {
161
+ --badge-color: color-mix(
162
+ in oklab,
163
+ var(--color-base-content) 14%,
164
+ transparent
165
+ );
166
+ --badge-fg: var(--color-base-content);
167
+ }
168
+
169
+ // Darker than --color-attention so white text clears 4.5:1.
170
+ @utility badge-attention {
171
+ --badge-color: oklch(55% 0.13 75);
172
+ --badge-fg: #fff;
173
+ }
174
+
175
+ // Corner dot tinted by a text-* class (text-attention for "needs you"); the parent must be position: relative.
176
+ @utility status-dot {
177
+ position: absolute;
178
+ top: 3px;
179
+ right: 3px;
180
+ width: 8px;
181
+ height: 8px;
182
+ background: currentColor;
183
+ box-shadow: 0 0 6px 1px color-mix(in oklab, currentColor 80%, transparent);
184
+ }
185
+
186
+ // Icon zoom sizes, named for where they're applied rather than their raw
187
+ // percentage, so usage sites read as intent instead of a magic number.
188
+ @utility zoom-inline {
189
+ zoom: 25%;
190
+ }
191
+
192
+ @utility zoom-row {
193
+ zoom: 50%;
194
+ }
195
+
196
+ @utility zoom-tooltip {
197
+ zoom: 75%;
198
+ }
199
+
200
+ @utility zoom-tile {
201
+ zoom: 75%;
202
+ }
203
+
204
+ @utility zoom-header {
205
+ zoom: 150%;
206
+ }
207
+
208
+ .checkbox:checked {
209
+ --input-color: var(--color-primary);
210
+ }
211
+
212
+ .label-checkbox {
213
+ justify-content: left;
214
+
215
+ .label-text {
216
+ @apply ml-3;
217
+ }
218
+ }
219
+
220
+ // Fixed label/control columns so every labeled dropdown and slider in Options lines up.
221
+ .label-option {
222
+ justify-content: left;
223
+ @apply gap-2 min-h-[36px] leading-none;
224
+
225
+ > .label-text {
226
+ @apply w-64 shrink-0 m-0 flex items-center gap-2;
227
+ }
228
+
229
+ > .ng-select,
230
+ > .range {
231
+ @apply w-56 shrink-0;
232
+ }
233
+ }
234
+
235
+ .list-row::after {
236
+ --border: 0;
237
+ }
238
+
239
+ .btn,
240
+ .badge,
241
+ .tab {
242
+ @apply select-none;
243
+ }
244
+
245
+ .btn:active:not(:disabled, [disabled], .btn-disabled) {
246
+ translate: 0 2px;
247
+ }
248
+
249
+ .page-card {
250
+ @apply overflow-hidden;
251
+ }
252
+
253
+ // Zoom multiplies vh lengths too, so anything sized in vh inside divides by --ui-zoom.
254
+ .ui-scaled {
255
+ --ui-zoom: var(--ui-scale, 1);
256
+ zoom: var(--ui-zoom);
257
+ }
258
+
259
+ // Modals declared inside a scaled panel stay 1x like every other modal, so their vh height caps still fit.
260
+ .ui-scaled dialog.modal {
261
+ --ui-zoom: 1;
262
+ zoom: calc(1 / var(--ui-scale, 1));
263
+ }
264
+
265
+ @media (max-width: 1365px) {
266
+ .card-page-container {
267
+ font-size: 0.95rem;
268
+ }
269
+ }
270
+
271
+ @media (max-width: 1199px) {
272
+ .card-page-container {
273
+ font-size: 0.9rem;
274
+ }
275
+ }
276
+
277
+ .search-bar {
278
+ min-width: 300px;
279
+ }
@@ -0,0 +1,15 @@
1
+ .ff-button-glow-active {
2
+ animation: ff-button-glow-pulse 1.5s ease-in-out infinite;
3
+ }
4
+
5
+ @keyframes ff-button-glow-pulse {
6
+ 0%,
7
+ 100% {
8
+ box-shadow: 0 0 2px 0
9
+ color-mix(in oklab, var(--ff-glow-color) 70%, transparent);
10
+ }
11
+ 50% {
12
+ box-shadow: 0 0 10px 4px
13
+ color-mix(in oklab, var(--ff-glow-color) 90%, transparent);
14
+ }
15
+ }
@@ -0,0 +1,64 @@
1
+ @font-face {
2
+ font-family: 'FancyText';
3
+ src:
4
+ url('../assets/fonts/GeistPixel-Square.woff2')
5
+ format('truetype supports variations'),
6
+ url('../assets/fonts/GeistPixel-Square.woff2') format('truetype-variations');
7
+ }
8
+
9
+ @font-face {
10
+ font-family: 'OtherText';
11
+ src: url('../assets/fonts/GeistPixel-Square.woff2') format('woff2');
12
+ font-weight: 400;
13
+ font-style: normal;
14
+ font-display: swap;
15
+ }
16
+
17
+ @font-face {
18
+ font-family: 'NumericText';
19
+ // GeistPixel-Square with every digit padded to the widest one's advance, so counters don't jitter.
20
+ src: url('../assets/fonts/GeistPixel-Square-Tabular.woff2') format('woff2');
21
+ font-weight: 400;
22
+ font-style: normal;
23
+ font-display: swap;
24
+ }
25
+
26
+ @font-face {
27
+ font-family: 'CleanText';
28
+ src: url('../assets/fonts/Montserrat-VariableFont_wght.ttf')
29
+ format('truetype');
30
+ font-weight: 100 900;
31
+ font-style: normal;
32
+ font-display: swap;
33
+ }
34
+
35
+ @font-face {
36
+ font-family: 'CleanText';
37
+ src: url('../assets/fonts/Montserrat-Italic-VariableFont_wght.ttf')
38
+ format('truetype');
39
+ font-weight: 100 900;
40
+ font-style: italic;
41
+ font-display: swap;
42
+ }
43
+
44
+ body {
45
+ --font-text: 'OtherText', serif;
46
+ --font-fancy: 'FancyText', sans-serif;
47
+ --font-numeric: 'NumericText';
48
+ --font-letter-spacing: 1px;
49
+
50
+ font-family: var(--font-text);
51
+ letter-spacing: var(--font-letter-spacing);
52
+
53
+ &.clean-font {
54
+ --font-text: 'CleanText', sans-serif;
55
+ --font-fancy: 'CleanText', sans-serif;
56
+ --font-numeric: 'CleanText', sans-serif;
57
+ --font-letter-spacing: normal;
58
+ }
59
+ }
60
+
61
+ .title {
62
+ font-family: var(--font-fancy);
63
+ letter-spacing: var(--font-letter-spacing);
64
+ }
@@ -0,0 +1,144 @@
1
+ $ff-glyph-families:
2
+ xbox, playstation, switch, switch2, steam-controller, steam-deck;
3
+
4
+ @each $family in $ff-glyph-families {
5
+ @font-face {
6
+ font-family: 'ff-glyph-#{$family}';
7
+ src: url('../assets/fonts/input/#{$family}.woff2') format('woff2');
8
+ font-display: block;
9
+ }
10
+
11
+ .ff-glyph-#{$family} {
12
+ font-family: 'ff-glyph-#{$family}';
13
+ }
14
+ }
15
+
16
+ // Kenney glyphs fill half an em, so 2.25rem renders an 18px glyph.
17
+ .ff-glyph {
18
+ display: inline-block;
19
+ flex-shrink: 0;
20
+ width: 0.5em;
21
+ height: 0.5em;
22
+ overflow: visible;
23
+ font-size: 2.25rem;
24
+ text-align: center;
25
+ vertical-align: middle;
26
+ // Synthetic bold from a bold parent (e.g. .btn) fills in the glyph cutouts.
27
+ font-weight: normal;
28
+ font-synthesis: none;
29
+ }
30
+
31
+ html.ff-input-gamepad :focus {
32
+ outline: 2px solid color-mix(in oklab, var(--color-primary) 70%, white);
33
+ // Inset, so a scroll or overflow-hidden parent can't clip one side.
34
+ outline-offset: -2px;
35
+
36
+ // Item art fills these boxes and would cover an inset ring; white plus a glow stays visible on every rarity color.
37
+ &[tabindex]:not(button, .ff-focus-row),
38
+ &.ff-focus-outset {
39
+ outline-color: white;
40
+ outline-offset: 2px;
41
+ box-shadow: 0 0 10px 3px rgb(255 255 255 / 45%);
42
+ filter: brightness(1.2);
43
+ }
44
+ }
45
+
46
+ // ng-select's focusable is a tiny inner input, so ring the whole control instead.
47
+ html.ff-input-gamepad .ff-select:focus-within {
48
+ outline: 2px solid color-mix(in oklab, var(--color-primary) 70%, white);
49
+ outline-offset: 2px;
50
+
51
+ :focus {
52
+ outline: none;
53
+ }
54
+ }
55
+
56
+ // Option templates are built for one-line dropdown rows; in a narrow popup tile their text wraps, so center
57
+ // every row instead of letting sprites stretch to the wrapped height.
58
+ .ff-select-tile .flex:not(.flex-col) {
59
+ align-items: center;
60
+ }
61
+
62
+ // ...and never let icons give up width to a long name or badge.
63
+ .ff-select-tile
64
+ :is(.zoom-row, ff-slot-icon-blank, app-sprite-node, ff-atlas-image) {
65
+ flex-shrink: 0;
66
+ }
67
+
68
+ // Hints tied to one input method, e.g. "Shift-click" or "Press X".
69
+ html.ff-input-gamepad .ff-kbm-only,
70
+ html:not(.ff-input-gamepad) .ff-gamepad-only {
71
+ display: none !important;
72
+ }
73
+
74
+ html.ff-input-gamepad {
75
+ &,
76
+ * {
77
+ cursor: none !important;
78
+ }
79
+ }
80
+
81
+ // A row lifted by controller grab mode; inset because these lists scroll and clip anything outside the row.
82
+ .ff-reorder-grabbed {
83
+ outline: 2px solid white;
84
+ outline-offset: -2px;
85
+ box-shadow: inset 0 0 12px 2px rgb(255 255 255 / 35%);
86
+ position: relative;
87
+ z-index: 1;
88
+ }
89
+
90
+ // Rows sit in scrolling lists, so their ring stays inside the row.
91
+ html.ff-input-gamepad .ff-focus-row:focus {
92
+ outline-color: white;
93
+ outline-offset: -2px;
94
+ box-shadow: inset 0 0 12px 2px rgb(255 255 255 / 25%);
95
+ filter: none;
96
+ }
97
+
98
+ ff-input-prompt {
99
+ --ff-prompt-collapse: calc(-1 * var(--ff-prompt-gap, 0px));
100
+ transition:
101
+ margin-inline 150ms ease-out,
102
+ padding-inline 150ms ease-out;
103
+
104
+ > .ff-glyph {
105
+ transition:
106
+ width 150ms ease-out,
107
+ opacity 150ms ease-out;
108
+ }
109
+ }
110
+
111
+ @starting-style {
112
+ ff-input-prompt > .ff-glyph {
113
+ width: 0;
114
+ opacity: 0;
115
+ }
116
+ }
117
+
118
+ // Hidden glyphs take no room, so a button or row only stretches while its glyph shows.
119
+ .ff-prompt-collapsed,
120
+ .ff-focus-row:not(:focus-within) .ff-row-glyph {
121
+ // Menu items pad their direct children, which would leave an empty box behind.
122
+ padding-inline: 0;
123
+
124
+ > .ff-glyph {
125
+ width: 0;
126
+ opacity: 0;
127
+ }
128
+
129
+ // Cancel the gap after the glyph (its neighbor may be a bare text node), or before it when it trails other elements.
130
+ margin-inline-end: var(--ff-prompt-collapse);
131
+
132
+ &:last-child:not(:first-child) {
133
+ margin-inline: var(--ff-prompt-collapse) 0;
134
+ }
135
+ }
136
+
137
+ // Room the fixed prompt bar takes at the bottom of the screen, for layouts pinned to the bottom edge.
138
+ :root {
139
+ --ff-prompt-bar-clearance: 0px;
140
+ }
141
+
142
+ html.ff-input-gamepad {
143
+ --ff-prompt-bar-clearance: 2.5rem;
144
+ }
@@ -0,0 +1,46 @@
1
+ .ng-select {
2
+ &.ng-select-opened > .ng-select-container,
3
+ &.ng-select-disabled > .ng-select-container,
4
+ .ng-select-container {
5
+ background-color: var(--color-base-200);
6
+ color: var(--color-base-content);
7
+ border-color: var(--color-base-300);
8
+ border-radius: 0;
9
+
10
+ .ng-placeholder {
11
+ color: #fff !important;
12
+ }
13
+ }
14
+
15
+ &.ng-select-disabled > .ng-select-container {
16
+ opacity: 0.6;
17
+ }
18
+ }
19
+
20
+ .ng-dropdown-panel {
21
+ background-color: var(--color-base-100) !important;
22
+ color: var(--color-base-content);
23
+ border-color: var(--color-base-300) !important;
24
+
25
+ // Overrides ng-select's inline width (from global appendTo: 'body') so the panel grows to fit its widest option instead of matching the trigger.
26
+ width: auto !important;
27
+ max-width: min(90vw, 32rem);
28
+ white-space: nowrap;
29
+ }
30
+
31
+ .ng-option-label {
32
+ color: var(--color-base-content) !important;
33
+ }
34
+
35
+ .ng-option {
36
+ background-color: var(--color-base-100) !important;
37
+ color: var(--color-base-content) !important;
38
+
39
+ &.ng-option-marked {
40
+ background-color: var(--color-base-300) !important;
41
+ }
42
+
43
+ &.ng-option-disabled {
44
+ opacity: 0.3;
45
+ }
46
+ }
@@ -0,0 +1,20 @@
1
+ // daisyUI's dark theme with our palette on top; unlayered, so it beats the plugin's theme variables.
2
+ // Plum stays clear of every rarity, difficulty, element and resource color; see the palette style guide.
3
+ :root {
4
+ --color-primary: oklch(48% 0.17 340);
5
+ --color-primary-content: oklch(97% 0.02 340);
6
+ --color-neutral: oklch(32% 0.02 340);
7
+ --color-neutral-content: oklch(95% 0.01 340);
8
+
9
+ --color-info: oklch(60% 0.14561 233.348);
10
+ --color-info-content: oklch(96% 0.066 243.157);
11
+
12
+ --color-success: oklch(60% 0.177 163.223);
13
+ --color-success-content: oklch(96% 0.077 168.94);
14
+
15
+ --color-warning: oklch(60% 0.189 84.429);
16
+ --color-warning-content: oklch(96% 0.112 45.904);
17
+
18
+ --color-error: oklch(60% 0.194 13.428);
19
+ --color-error-content: oklch(96% 0.105 12.094);
20
+ }
@@ -0,0 +1,32 @@
1
+ // Library loops and transitions; the host toggles :root.reduce-motion.
2
+ :root.reduce-motion {
3
+ --swal2-show-animation: none;
4
+ --swal2-hide-animation: none;
5
+ --swal2-toast-show-animation: none;
6
+ --swal2-toast-hide-animation: none;
7
+
8
+ .ff-button-glow-active {
9
+ animation: none;
10
+ box-shadow: 0 0 6px 2px
11
+ color-mix(in oklab, var(--ff-glow-color) 85%, transparent);
12
+ }
13
+
14
+ .animate-pulse {
15
+ animation: none;
16
+ }
17
+
18
+ .bar-progress-fill,
19
+ .modal-box,
20
+ .ff-spotlight-outline,
21
+ .ff-spotlight-callout,
22
+ ff-input-prompt,
23
+ ff-input-prompt > .ff-glyph {
24
+ transition: none;
25
+ }
26
+
27
+ // Scoped through the container to outrank sweetalert2's (0,3,1) icon selectors.
28
+ .swal2-container .swal2-icon-show,
29
+ .swal2-container .swal2-icon-show * {
30
+ animation: none;
31
+ }
32
+ }