terrier-engine 4.1.0 → 4.3.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.
- package/app.ts +9 -13
- package/dropdowns.ts +6 -17
- package/fragments.ts +30 -30
- package/gen/hub-icons.ts +697 -0
- package/glyps.ts +2 -2
- package/images/icons/active.svg +1 -0
- package/images/icons/admin.svg +1 -0
- package/images/icons/archive.svg +1 -0
- package/images/icons/arrow_down.svg +1 -0
- package/images/icons/arrow_left.svg +1 -0
- package/images/icons/arrow_right.svg +1 -0
- package/images/icons/arrow_up.svg +1 -0
- package/images/icons/assign.svg +1 -0
- package/images/icons/attachment.svg +1 -0
- package/images/icons/back.svg +1 -0
- package/images/icons/badge.svg +1 -0
- package/images/icons/board.svg +1 -0
- package/images/icons/branch.svg +1 -0
- package/images/icons/bug.svg +1 -0
- package/images/icons/calculator.svg +1 -0
- package/images/icons/checkmark.svg +1 -0
- package/images/icons/close.svg +1 -0
- package/images/icons/clypboard.svg +1 -0
- package/images/icons/comment.svg +1 -0
- package/images/icons/complete.svg +1 -0
- package/images/icons/dashboard.svg +1 -0
- package/images/icons/data_pull.svg +1 -0
- package/images/icons/data_update.svg +1 -0
- package/images/icons/database.svg +1 -0
- package/images/icons/day.svg +1 -0
- package/images/icons/delete.svg +1 -0
- package/images/icons/documentation.svg +1 -0
- package/images/icons/edit.svg +1 -0
- package/images/icons/feature.svg +1 -0
- package/images/icons/flex.svg +1 -0
- package/images/icons/forward.svg +1 -0
- package/images/icons/github.svg +1 -0
- package/images/icons/history.svg +1 -0
- package/images/icons/home.svg +1 -0
- package/images/icons/image.svg +1 -0
- package/images/icons/inbox.svg +1 -0
- package/images/icons/info.svg +1 -0
- package/images/icons/issue.svg +1 -0
- package/images/icons/lane.svg +1 -0
- package/images/icons/lane_asap.svg +1 -0
- package/images/icons/lane_days.svg +1 -0
- package/images/icons/lane_hours.svg +1 -0
- package/images/icons/lane_weeks.svg +1 -0
- package/images/icons/lanes_board.svg +1 -0
- package/images/icons/level_complete.svg +1 -0
- package/images/icons/level_highway.svg +1 -0
- package/images/icons/level_on_ramp.svg +1 -0
- package/images/icons/level_parking.svg +1 -0
- package/images/icons/minus.svg +1 -0
- package/images/icons/night.svg +1 -0
- package/images/icons/origin.svg +1 -0
- package/images/icons/pending.svg +1 -0
- package/images/icons/plus.svg +1 -0
- package/images/icons/post.svg +1 -0
- package/images/icons/pr_closed.svg +1 -0
- package/images/icons/pr_merged.svg +1 -0
- package/images/icons/pr_open.svg +1 -0
- package/images/icons/prioritized.svg +1 -0
- package/images/icons/project.svg +1 -0
- package/images/icons/question.svg +1 -0
- package/images/icons/reaction.svg +1 -0
- package/images/icons/recent.svg +1 -0
- package/images/icons/refresh.svg +1 -0
- package/images/icons/request.svg +1 -0
- package/images/icons/settings.svg +1 -0
- package/images/icons/status.svg +1 -0
- package/images/icons/step_deploy.svg +1 -0
- package/images/icons/step_develop.svg +1 -0
- package/images/icons/step_investigate.svg +1 -0
- package/images/icons/step_review.svg +1 -0
- package/images/icons/step_test.svg +1 -0
- package/images/icons/steps.svg +1 -0
- package/images/icons/steps_board.svg +1 -0
- package/images/icons/subscribe.svg +1 -0
- package/images/icons/support.svg +1 -0
- package/images/icons/terrier.svg +1 -0
- package/images/icons/thumbs_up.svg +1 -0
- package/images/icons/type.svg +1 -0
- package/images/icons/unprioritized.svg +1 -0
- package/images/icons/upload.svg +1 -0
- package/images/icons/user.svg +1 -0
- package/images/icons/users.svg +1 -0
- package/images/optimized/icon-active.svg +1 -0
- package/images/optimized/icon-admin.svg +1 -0
- package/images/optimized/icon-archive.svg +1 -0
- package/images/optimized/icon-arrow_down.svg +1 -0
- package/images/optimized/icon-arrow_left.svg +1 -0
- package/images/optimized/icon-arrow_right.svg +1 -0
- package/images/optimized/icon-arrow_up.svg +1 -0
- package/images/optimized/icon-assign.svg +1 -0
- package/images/optimized/icon-attachment.svg +1 -0
- package/images/optimized/icon-back.svg +1 -0
- package/images/optimized/icon-badge.svg +1 -0
- package/images/optimized/icon-board.svg +1 -0
- package/images/optimized/icon-branch.svg +1 -0
- package/images/optimized/icon-bug.svg +1 -0
- package/images/optimized/icon-calculator.svg +1 -0
- package/images/optimized/icon-checkmark.svg +1 -0
- package/images/optimized/icon-close.svg +1 -0
- package/images/optimized/icon-clypboard.svg +1 -0
- package/images/optimized/icon-comment.svg +1 -0
- package/images/optimized/icon-complete.svg +1 -0
- package/images/optimized/icon-dashboard.svg +1 -0
- package/images/optimized/icon-data_pull.svg +1 -0
- package/images/optimized/icon-data_update.svg +1 -0
- package/images/optimized/icon-database.svg +1 -0
- package/images/optimized/icon-day.svg +1 -0
- package/images/optimized/icon-delete.svg +1 -0
- package/images/optimized/icon-documentation.svg +1 -0
- package/images/optimized/icon-edit.svg +1 -0
- package/images/optimized/icon-feature.svg +1 -0
- package/images/optimized/icon-flex.svg +1 -0
- package/images/optimized/icon-forward.svg +1 -0
- package/images/optimized/icon-github.svg +1 -0
- package/images/optimized/icon-history.svg +1 -0
- package/images/optimized/icon-home.svg +1 -0
- package/images/optimized/icon-image.svg +1 -0
- package/images/optimized/icon-inbox.svg +1 -0
- package/images/optimized/icon-info.svg +1 -0
- package/images/optimized/icon-issue.svg +1 -0
- package/images/optimized/icon-lane.svg +1 -0
- package/images/optimized/icon-lane_asap.svg +1 -0
- package/images/optimized/icon-lane_days.svg +1 -0
- package/images/optimized/icon-lane_hours.svg +1 -0
- package/images/optimized/icon-lane_weeks.svg +1 -0
- package/images/optimized/icon-lanes_board.svg +1 -0
- package/images/optimized/icon-level_complete.svg +1 -0
- package/images/optimized/icon-level_highway.svg +1 -0
- package/images/optimized/icon-level_on_ramp.svg +1 -0
- package/images/optimized/icon-level_parking.svg +1 -0
- package/images/optimized/icon-minus.svg +1 -0
- package/images/optimized/icon-night.svg +1 -0
- package/images/optimized/icon-origin.svg +1 -0
- package/images/optimized/icon-pending.svg +1 -0
- package/images/optimized/icon-plus.svg +1 -0
- package/images/optimized/icon-post.svg +1 -0
- package/images/optimized/icon-pr_closed.svg +1 -0
- package/images/optimized/icon-pr_merged.svg +1 -0
- package/images/optimized/icon-pr_open.svg +1 -0
- package/images/optimized/icon-prioritized.svg +1 -0
- package/images/optimized/icon-project.svg +1 -0
- package/images/optimized/icon-question.svg +1 -0
- package/images/optimized/icon-reaction.svg +1 -0
- package/images/optimized/icon-recent.svg +1 -0
- package/images/optimized/icon-refresh.svg +1 -0
- package/images/optimized/icon-request.svg +1 -0
- package/images/optimized/icon-settings.svg +1 -0
- package/images/optimized/icon-status.svg +1 -0
- package/images/optimized/icon-step_deploy.svg +1 -0
- package/images/optimized/icon-step_develop.svg +1 -0
- package/images/optimized/icon-step_investigate.svg +1 -0
- package/images/optimized/icon-step_review.svg +1 -0
- package/images/optimized/icon-step_test.svg +1 -0
- package/images/optimized/icon-steps.svg +1 -0
- package/images/optimized/icon-steps_board.svg +1 -0
- package/images/optimized/icon-subscribe.svg +1 -0
- package/images/optimized/icon-support.svg +1 -0
- package/images/optimized/icon-terrier.svg +1 -0
- package/images/optimized/icon-thumbs_up.svg +1 -0
- package/images/optimized/icon-type.svg +1 -0
- package/images/optimized/icon-unprioritized.svg +1 -0
- package/images/optimized/icon-upload.svg +1 -0
- package/images/optimized/icon-user.svg +1 -0
- package/images/optimized/icon-users.svg +1 -0
- package/images/optimized/terrier-hub-favicon.svg +1 -0
- package/images/optimized/terrier-hub-icon-dark.svg +1 -0
- package/images/optimized/terrier-hub-icon-light.svg +1 -0
- package/images/optimized/terrier-hub-loader.svg +1 -0
- package/images/optimized/terrier-hub-logo-dark.svg +1 -0
- package/images/optimized/terrier-hub-logo-light.svg +1 -0
- package/images/raw/icon-active.svg +8 -0
- package/images/raw/icon-admin.svg +9 -0
- package/images/raw/icon-archive.svg +9 -0
- package/images/raw/icon-arrow_down.svg +7 -0
- package/images/raw/icon-arrow_left.svg +7 -0
- package/images/raw/icon-arrow_right.svg +7 -0
- package/images/raw/icon-arrow_up.svg +7 -0
- package/images/raw/icon-assign.svg +8 -0
- package/images/raw/icon-attachment.svg +7 -0
- package/images/raw/icon-back.svg +7 -0
- package/images/raw/icon-badge.svg +10 -0
- package/images/raw/icon-board.svg +20 -0
- package/images/raw/icon-branch.svg +11 -0
- package/images/raw/icon-bug.svg +8 -0
- package/images/raw/icon-calculator.svg +31 -0
- package/images/raw/icon-checkmark.svg +8 -0
- package/images/raw/icon-close.svg +8 -0
- package/images/raw/icon-clypboard.svg +9 -0
- package/images/raw/icon-comment.svg +12 -0
- package/images/raw/icon-complete.svg +8 -0
- package/images/raw/icon-dashboard.svg +18 -0
- package/images/raw/icon-data_pull.svg +9 -0
- package/images/raw/icon-data_update.svg +9 -0
- package/images/raw/icon-database.svg +10 -0
- package/images/raw/icon-day.svg +19 -0
- package/images/raw/icon-delete.svg +11 -0
- package/images/raw/icon-documentation.svg +21 -0
- package/images/raw/icon-edit.svg +11 -0
- package/images/raw/icon-feature.svg +7 -0
- package/images/raw/icon-flex.svg +6 -0
- package/images/raw/icon-forward.svg +7 -0
- package/images/raw/icon-github.svg +8 -0
- package/images/raw/icon-history.svg +12 -0
- package/images/raw/icon-home.svg +8 -0
- package/images/raw/icon-image.svg +9 -0
- package/images/raw/icon-inbox.svg +9 -0
- package/images/raw/icon-info.svg +11 -0
- package/images/raw/icon-issue.svg +10 -0
- package/images/raw/icon-lane.svg +9 -0
- package/images/raw/icon-lane_asap.svg +9 -0
- package/images/raw/icon-lane_days.svg +11 -0
- package/images/raw/icon-lane_hours.svg +8 -0
- package/images/raw/icon-lane_weeks.svg +10 -0
- package/images/raw/icon-lanes_board.svg +10 -0
- package/images/raw/icon-level_complete.svg +8 -0
- package/images/raw/icon-level_highway.svg +11 -0
- package/images/raw/icon-level_on_ramp.svg +8 -0
- package/images/raw/icon-level_parking.svg +10 -0
- package/images/raw/icon-minus.svg +8 -0
- package/images/raw/icon-night.svg +9 -0
- package/images/raw/icon-origin.svg +11 -0
- package/images/raw/icon-pending.svg +10 -0
- package/images/raw/icon-plus.svg +8 -0
- package/images/raw/icon-post.svg +12 -0
- package/images/raw/icon-pr_closed.svg +15 -0
- package/images/raw/icon-pr_merged.svg +11 -0
- package/images/raw/icon-pr_open.svg +12 -0
- package/images/raw/icon-prioritized.svg +11 -0
- package/images/raw/icon-project.svg +24 -0
- package/images/raw/icon-question.svg +9 -0
- package/images/raw/icon-reaction.svg +6 -0
- package/images/raw/icon-recent.svg +12 -0
- package/images/raw/icon-refresh.svg +11 -0
- package/images/raw/icon-request.svg +10 -0
- package/images/raw/icon-settings.svg +11 -0
- package/images/raw/icon-status.svg +8 -0
- package/images/raw/icon-step_deploy.svg +15 -0
- package/images/raw/icon-step_develop.svg +12 -0
- package/images/raw/icon-step_investigate.svg +14 -0
- package/images/raw/icon-step_review.svg +11 -0
- package/images/raw/icon-step_test.svg +14 -0
- package/images/raw/icon-steps.svg +18 -0
- package/images/raw/icon-steps_board.svg +19 -0
- package/images/raw/icon-subscribe.svg +10 -0
- package/images/raw/icon-support.svg +14 -0
- package/images/raw/icon-terrier.svg +7 -0
- package/images/raw/icon-thumbs_up.svg +1 -0
- package/images/raw/icon-type.svg +15 -0
- package/images/raw/icon-unprioritized.svg +10 -0
- package/images/raw/icon-upload.svg +8 -0
- package/images/raw/icon-user.svg +9 -0
- package/images/raw/icon-users.svg +14 -0
- package/images/raw/terrier-hub-favicon-alert.png +0 -0
- package/images/raw/terrier-hub-favicon-dark.png +0 -0
- package/images/raw/terrier-hub-favicon.png +0 -0
- package/images/raw/terrier-hub-favicon.svg +29 -0
- package/images/raw/terrier-hub-icon-dark.svg +23 -0
- package/images/raw/terrier-hub-icon-light.png +0 -0
- package/images/raw/terrier-hub-icon-light.svg +23 -0
- package/images/raw/terrier-hub-loader.svg +54 -0
- package/images/raw/terrier-hub-logo-dark.svg +27 -0
- package/images/raw/terrier-hub-logo-light.png +0 -0
- package/images/raw/terrier-hub-logo-light.svg +28 -0
- package/lightbox.ts +8 -21
- package/loading.ts +5 -6
- package/modals.ts +6 -18
- package/overlays.ts +1 -1
- package/package.json +1 -1
- package/parts/content-part.ts +24 -25
- package/parts/not-found-page.ts +1 -7
- package/parts/page-part.ts +47 -54
- package/parts/panel-part.ts +1 -8
- package/parts/terrier-form-part.ts +20 -0
- package/parts/terrier-part.ts +6 -11
- package/tabs.ts +164 -0
- package/theme.ts +41 -12
- package/toasts.ts +9 -9
- package/tooltips.ts +2 -2
- package/parts/themed-form-part.ts +0 -25
package/app.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {Part, PartConstructor, PartParent} from "tuff-core/parts"
|
|
|
3
3
|
import TerrierPart from "./parts/terrier-part"
|
|
4
4
|
import Tooltips from "./tooltips"
|
|
5
5
|
import Lightbox from "./lightbox"
|
|
6
|
-
import Theme
|
|
6
|
+
import Theme from "./theme"
|
|
7
7
|
import {ModalPart, ModalStackPart} from "./modals"
|
|
8
8
|
import {OverlayLayerType, OverlayPart} from "./overlays"
|
|
9
9
|
|
|
@@ -16,22 +16,18 @@ Logger.level = 'info'
|
|
|
16
16
|
/**
|
|
17
17
|
* Main application part that renders the entire page.
|
|
18
18
|
*/
|
|
19
|
-
export abstract class TerrierApp<
|
|
20
|
-
TThemeType extends ThemeType,
|
|
21
|
-
TSelf extends TerrierApp<TThemeType, TSelf, TTheme>,
|
|
22
|
-
TTheme extends Theme<TThemeType>
|
|
23
|
-
> extends TerrierPart<{theme: TTheme}, TThemeType, TSelf, TTheme> {
|
|
19
|
+
export abstract class TerrierApp<TState> extends TerrierPart<TState> {
|
|
24
20
|
|
|
25
|
-
_theme!:
|
|
26
|
-
|
|
27
|
-
get theme():
|
|
21
|
+
_theme!: Theme
|
|
22
|
+
|
|
23
|
+
get theme(): Theme {
|
|
28
24
|
return this._theme
|
|
29
25
|
}
|
|
30
26
|
|
|
31
27
|
overlayPart!: OverlayPart
|
|
32
28
|
|
|
33
29
|
async init() {
|
|
34
|
-
this._theme =
|
|
30
|
+
this._theme = new Theme()
|
|
35
31
|
this.overlayPart = this.makePart(OverlayPart, {})
|
|
36
32
|
log.info("Initialized")
|
|
37
33
|
}
|
|
@@ -44,7 +40,7 @@ export abstract class TerrierApp<
|
|
|
44
40
|
update(root: HTMLElement) {
|
|
45
41
|
log.info(`Update`, root)
|
|
46
42
|
Tooltips.init(root)
|
|
47
|
-
Lightbox.init
|
|
43
|
+
Lightbox.init(root, this, 'body-content')
|
|
48
44
|
}
|
|
49
45
|
|
|
50
46
|
|
|
@@ -70,7 +66,7 @@ export abstract class TerrierApp<
|
|
|
70
66
|
this.overlayPart.clearAll()
|
|
71
67
|
}
|
|
72
68
|
|
|
73
|
-
removeDropdown<StateType
|
|
69
|
+
removeDropdown<StateType>(state: StateType): boolean {
|
|
74
70
|
this.lastDropdownTarget = undefined
|
|
75
71
|
return this.overlayPart.removeLayer(state)
|
|
76
72
|
}
|
|
@@ -86,7 +82,7 @@ export abstract class TerrierApp<
|
|
|
86
82
|
|
|
87
83
|
/// Modals
|
|
88
84
|
|
|
89
|
-
showModal<ModalType extends ModalPart<StateType
|
|
85
|
+
showModal<ModalType extends ModalPart<StateType>, StateType>(
|
|
90
86
|
constructor: PartConstructor<ModalType, StateType>,
|
|
91
87
|
state: StateType
|
|
92
88
|
): ModalType {
|
package/dropdowns.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import {Logger} from "tuff-core/logging"
|
|
2
|
+
import {untypedKey} from "tuff-core/messages"
|
|
3
|
+
import {unique} from "tuff-core/arrays"
|
|
4
4
|
import {PartTag, StatelessPart} from "tuff-core/parts"
|
|
5
5
|
import Overlays from "./overlays"
|
|
6
6
|
import TerrierPart from "./parts/terrier-part"
|
|
7
7
|
import Objects from "tuff-core/objects"
|
|
8
|
-
import
|
|
9
|
-
import {TerrierApp} from "./app"
|
|
8
|
+
import {Action} from "./theme"
|
|
10
9
|
|
|
11
10
|
const log = new Logger('Dropdowns')
|
|
12
11
|
|
|
@@ -16,12 +15,7 @@ const clearDropdownKey = untypedKey()
|
|
|
16
15
|
* Abstract base class for dropdown parts.
|
|
17
16
|
* Subclasses must implement the `renderContent()` method to render the dropdown content.
|
|
18
17
|
*/
|
|
19
|
-
export abstract class Dropdown<
|
|
20
|
-
TState extends {},
|
|
21
|
-
TThemeType extends ThemeType,
|
|
22
|
-
TApp extends TerrierApp<TThemeType, TApp, TTheme>,
|
|
23
|
-
TTheme extends Theme<TThemeType>
|
|
24
|
-
> extends TerrierPart<TState, TThemeType, TApp, TTheme> {
|
|
18
|
+
export abstract class Dropdown<TState> extends TerrierPart<TState> {
|
|
25
19
|
|
|
26
20
|
parentPart?: StatelessPart
|
|
27
21
|
|
|
@@ -96,12 +90,7 @@ export abstract class Dropdown<
|
|
|
96
90
|
/**
|
|
97
91
|
* A concrete dropdown part that shows a list of actions.
|
|
98
92
|
*/
|
|
99
|
-
export class ActionsDropdown<
|
|
100
|
-
TThemeType extends ThemeType,
|
|
101
|
-
TApp extends TerrierApp<TThemeType, TApp, TTheme>,
|
|
102
|
-
TTheme extends Theme<TThemeType>
|
|
103
|
-
> extends Dropdown<Array<Action<TThemeType>>, TThemeType, TApp, TTheme> {
|
|
104
|
-
|
|
93
|
+
export class ActionsDropdown extends Dropdown<Array<Action>> {
|
|
105
94
|
|
|
106
95
|
get autoClose(): boolean {
|
|
107
96
|
return true
|
package/fragments.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {PartTag} from "tuff-core/parts"
|
|
2
2
|
import {AnchorTagAttrs, HtmlParentTag} from "tuff-core/html"
|
|
3
|
-
import Theme, {Action,
|
|
3
|
+
import Theme, {Action, ColorName, IconName, Packet} from "./theme"
|
|
4
4
|
import {ActionLevel, PanelActions} from "./parts/content-part"
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Base class for Panel and Card fragment builders.
|
|
8
8
|
*/
|
|
9
|
-
abstract class ContentFragment
|
|
10
|
-
protected constructor(readonly prefix: string, readonly theme: Theme
|
|
11
|
-
|
|
9
|
+
abstract class ContentFragment {
|
|
10
|
+
protected constructor(readonly prefix: string, readonly theme: Theme) {
|
|
11
|
+
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
protected _title?: string
|
|
@@ -17,18 +17,18 @@ abstract class ContentFragment<TT extends ThemeType> {
|
|
|
17
17
|
* @param t the title
|
|
18
18
|
* @param icon the optional icon
|
|
19
19
|
*/
|
|
20
|
-
title(t: string, icon?:
|
|
20
|
+
title(t: string, icon?: IconName) {
|
|
21
21
|
this._title = t
|
|
22
22
|
this._icon = icon
|
|
23
23
|
return this
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
protected _icon?:
|
|
26
|
+
protected _icon?: IconName
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @param i the panel icon
|
|
30
30
|
*/
|
|
31
|
-
icon(i:
|
|
31
|
+
icon(i: IconName) {
|
|
32
32
|
this._icon = i
|
|
33
33
|
return this
|
|
34
34
|
}
|
|
@@ -46,17 +46,17 @@ abstract class ContentFragment<TT extends ThemeType> {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
export class PanelFragment
|
|
50
|
-
constructor(theme: Theme
|
|
49
|
+
export class PanelFragment extends ContentFragment {
|
|
50
|
+
constructor(theme: Theme) {
|
|
51
51
|
super('tt-panel', theme)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/// Actions
|
|
55
55
|
|
|
56
56
|
actions = {
|
|
57
|
-
primary: Array<Action
|
|
58
|
-
secondary: Array<Action
|
|
59
|
-
tertiary: Array<Action
|
|
57
|
+
primary: Array<Action>(),
|
|
58
|
+
secondary: Array<Action>(),
|
|
59
|
+
tertiary: Array<Action>()
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -64,7 +64,7 @@ export class PanelFragment<TT extends ThemeType> extends ContentFragment<TT> {
|
|
|
64
64
|
* @param action the action to add
|
|
65
65
|
* @param level whether it's a primary, secondary, or tertiary action
|
|
66
66
|
*/
|
|
67
|
-
addAction(action: Action
|
|
67
|
+
addAction(action: Action, level: ActionLevel = 'primary') {
|
|
68
68
|
this.actions[level].push(action)
|
|
69
69
|
return this
|
|
70
70
|
}
|
|
@@ -104,7 +104,7 @@ export class PanelFragment<TT extends ThemeType> extends ContentFragment<TT> {
|
|
|
104
104
|
* @param actions the actions
|
|
105
105
|
* @param theme the theme with which to render actions
|
|
106
106
|
*/
|
|
107
|
-
function panelActions
|
|
107
|
+
function panelActions(panel: PartTag, actions: PanelActions, theme: Theme) {
|
|
108
108
|
if (actions.primary.length || actions.secondary.length) {
|
|
109
109
|
panel.div('.panel-actions', actionsContainer => {
|
|
110
110
|
for (const level of ['secondary', 'primary'] as const) {
|
|
@@ -122,8 +122,8 @@ function panelActions<TT extends ThemeType>(panel: PartTag, actions: PanelAction
|
|
|
122
122
|
/**
|
|
123
123
|
* Cards are like panels except they don't have any actions and are themselves an anchor.
|
|
124
124
|
*/
|
|
125
|
-
class CardFragment
|
|
126
|
-
constructor(theme: Theme
|
|
125
|
+
class CardFragment extends ContentFragment {
|
|
126
|
+
constructor(theme: Theme) {
|
|
127
127
|
super('tt-card', theme)
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -164,15 +164,15 @@ class CardFragment<TT extends ThemeType> extends ContentFragment<TT> {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
|
|
167
|
-
class LabeledValueFragment
|
|
167
|
+
class LabeledValueFragment extends ContentFragment {
|
|
168
168
|
|
|
169
|
-
constructor(theme: Theme
|
|
169
|
+
constructor(theme: Theme) {
|
|
170
170
|
super('tt-labeled-value', theme)
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
private _value?: string
|
|
174
|
-
private _valueIcon?:
|
|
175
|
-
private _valueIconColor?:
|
|
174
|
+
private _valueIcon?: IconName
|
|
175
|
+
private _valueIconColor?: ColorName | null
|
|
176
176
|
private _valueClass?: string[]
|
|
177
177
|
|
|
178
178
|
private _href?: string
|
|
@@ -182,7 +182,7 @@ class LabeledValueFragment<TT extends ThemeType> extends ContentFragment<TT> {
|
|
|
182
182
|
|
|
183
183
|
private _tooltip?: string
|
|
184
184
|
|
|
185
|
-
value(value: string, icon?:
|
|
185
|
+
value(value: string, icon?: IconName, iconColor?: ColorName | null) {
|
|
186
186
|
this._value = value
|
|
187
187
|
this._valueIcon = icon
|
|
188
188
|
this._valueIconColor = iconColor
|
|
@@ -258,10 +258,10 @@ type ListValueDefinition = {
|
|
|
258
258
|
tooltip?: string
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
class LabeledListFragment
|
|
261
|
+
class LabeledListFragment extends ContentFragment {
|
|
262
262
|
private _values?: ListValueDefinition[]
|
|
263
263
|
|
|
264
|
-
constructor(theme: Theme
|
|
264
|
+
constructor(theme: Theme) {
|
|
265
265
|
super('tt-labeled-list', theme)
|
|
266
266
|
}
|
|
267
267
|
|
|
@@ -307,7 +307,7 @@ class LabeledListFragment<TT extends ThemeType> extends ContentFragment<TT> {
|
|
|
307
307
|
* Creates a new card fragment builder.
|
|
308
308
|
* Make sure to call `render()` in order to render it to a parent tag.
|
|
309
309
|
*/
|
|
310
|
-
function card
|
|
310
|
+
function card(theme: Theme) {
|
|
311
311
|
return new CardFragment(theme)
|
|
312
312
|
}
|
|
313
313
|
|
|
@@ -316,7 +316,7 @@ function card<TT extends ThemeType>(theme: Theme<TT>) {
|
|
|
316
316
|
* Creates a new panel fragment builder.
|
|
317
317
|
* Make sure to call `render()` in order to render it to a parent tag.
|
|
318
318
|
*/
|
|
319
|
-
function panel
|
|
319
|
+
function panel(theme: Theme) {
|
|
320
320
|
return new PanelFragment(theme)
|
|
321
321
|
}
|
|
322
322
|
|
|
@@ -324,18 +324,18 @@ function panel<TT extends ThemeType>(theme: Theme<TT>) {
|
|
|
324
324
|
* Creates a new labeled value fragment builder.
|
|
325
325
|
* Make sure to call `render()` in order to render it to a parent tag.
|
|
326
326
|
*/
|
|
327
|
-
function labeledValue
|
|
327
|
+
function labeledValue(theme: Theme) {
|
|
328
328
|
return new LabeledValueFragment(theme)
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
-
function labeledList
|
|
331
|
+
function labeledList(theme: Theme) {
|
|
332
332
|
return new LabeledListFragment(theme)
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
/**
|
|
336
336
|
* Create a new button in the parent.
|
|
337
337
|
*/
|
|
338
|
-
function button
|
|
338
|
+
function button(parent: PartTag, theme: Theme, title?: string, icon?: IconName, iconColor: ColorName | null = null) {
|
|
339
339
|
return parent.a('.tt-button', button => {
|
|
340
340
|
if (icon) theme.renderIcon(button, icon, iconColor)
|
|
341
341
|
if (title?.length) button.div('.title', {text: title})
|
|
@@ -346,7 +346,7 @@ function button<TT extends ThemeType>(parent: PartTag, theme: Theme<TT>, title?:
|
|
|
346
346
|
* Create a new simple value display in the parent.
|
|
347
347
|
* This is just some text with an optional icon that doesn't have a separate label.
|
|
348
348
|
*/
|
|
349
|
-
function simpleValue
|
|
349
|
+
function simpleValue(parent: PartTag, theme: Theme, title: string, icon?: IconName, iconColor: ColorName | null = 'link') {
|
|
350
350
|
return parent.div('.tt-simple-value.shrink', button => {
|
|
351
351
|
if (icon) theme.renderIcon(button, icon, iconColor)
|
|
352
352
|
button.div('.title', {text: title})
|
|
@@ -356,7 +356,7 @@ function simpleValue<TT extends ThemeType>(parent: PartTag, theme: Theme<TT>, ti
|
|
|
356
356
|
/**
|
|
357
357
|
* Helper to create a heading with an optional icon.
|
|
358
358
|
*/
|
|
359
|
-
function simpleHeading
|
|
359
|
+
function simpleHeading(parent: PartTag, theme: Theme, title: string, icon?: IconName) {
|
|
360
360
|
return parent.h3('.shrink', heading => {
|
|
361
361
|
if (icon) {
|
|
362
362
|
theme.renderIcon(heading, icon, 'link')
|