| 1 |
/* |
| 2 |
* ============================================================================= |
| 3 |
* OpenStation — Starter Widget styles |
| 4 |
* ============================================================================= |
| 5 |
* |
| 6 |
* NAMING CONVENTION |
| 7 |
* ----------------- |
| 8 |
* Prefix every class with a short namespace unique to your widget. |
| 9 |
* This file uses "dm-starter__" — change it to match your widget name. |
| 10 |
* Without a prefix, your styles can collide with the shell's own classes |
| 11 |
* or another plugin's widget running on the same page. |
| 12 |
* |
| 13 |
* CSS CUSTOM PROPERTIES |
| 14 |
* --------------------- |
| 15 |
* OpenStation declares these variables in the shell palette, so your card |
| 16 |
* inherits them. Using them means your widget follows the desktop theme |
| 17 |
* and the user's chosen accent without any extra code. |
| 18 |
* |
| 19 |
* --os-ui-color-text Primary text — body copy, headings |
| 20 |
* --os-ui-color-text-subtle Muted text — labels, timestamps, metadata |
| 21 |
* --os-ui-color-border Divider lines and borders |
| 22 |
* --os-ui-color-accent The user's accent — buttons, highlights, links |
| 23 |
* --os-ui-color-surface The card's glass background (rarely needed) |
| 24 |
* |
| 25 |
* The card is a dark glass panel under every theme, so the first four |
| 26 |
* resolve to on-dark values. Always provide a fallback as the second |
| 27 |
* argument to var() in case the shell loads in an unexpected context — |
| 28 |
* and pick a fallback that reads on dark, or the card looks correct |
| 29 |
* everywhere except where the palette is missing: |
| 30 |
* color: var(--os-ui-color-text, #fff); |
| 31 |
* |
| 32 |
* LAYOUT |
| 33 |
* ------ |
| 34 |
* The card body is a block-level element with 12px padding on all sides. |
| 35 |
* Your root element should fill it completely: |
| 36 |
* height: 100%; display: flex; flex-direction: column; |
| 37 |
* |
| 38 |
* Use flex: 1 on the main content area so it expands to fill available |
| 39 |
* space, and flex-shrink: 0 on fixed-height elements like headers and |
| 40 |
* footers so they do not compress when the card is resized small. |
| 41 |
* |
| 42 |
* RESPONSIVE SIZING |
| 43 |
* ----------------- |
| 44 |
* When a widget is resizable, the card can be made very small by the user. |
| 45 |
* Use min-width: 0 on flex children that contain text so they truncate |
| 46 |
* cleanly rather than overflowing. Use white-space: nowrap + overflow: |
| 47 |
* hidden + text-overflow: ellipsis on single-line text that must not wrap. |
| 48 |
* |
| 49 |
* Avoid fixed pixel widths on any element the user might resize. Use |
| 50 |
* percentage widths or flex layout so the widget reflows gracefully. |
| 51 |
*/ |
| 52 |
|
| 53 |
/* Root container — fills the card body and stacks children vertically. */ |
| 54 |
.dm-starter { |
| 55 |
display: flex; |
| 56 |
flex-direction: column; |
| 57 |
gap: 10px; |
| 58 |
height: 100%; |
| 59 |
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; |
| 60 |
font-size: 13px; |
| 61 |
color: var(--os-ui-color-text, #1a1a1a); |
| 62 |
/* Prevent the root from exceeding the card body width. */ |
| 63 |
min-width: 0; |
| 64 |
} |
| 65 |
|
| 66 |
/* |
| 67 |
* Header bar — small, uppercase label that identifies the widget. |
| 68 |
* flex-shrink: 0 keeps it at a fixed height even when the card is tiny. |
| 69 |
* This pattern (header + flex:1 body + optional footer) is the standard |
| 70 |
* layout used by all the built-in widgets. |
| 71 |
*/ |
| 72 |
.dm-starter__header { |
| 73 |
font-weight: 600; |
| 74 |
font-size: 11px; |
| 75 |
text-transform: uppercase; |
| 76 |
letter-spacing: 0.06em; |
| 77 |
color: var(--os-ui-color-text-subtle, #6b7280); |
| 78 |
padding-bottom: 8px; |
| 79 |
border-bottom: 1px solid var(--os-ui-color-border, #e5e7eb); |
| 80 |
/* Fixed height — does not grow or shrink with the card. */ |
| 81 |
flex-shrink: 0; |
| 82 |
/* Truncate if the label is too wide for a very narrow card. */ |
| 83 |
white-space: nowrap; |
| 84 |
overflow: hidden; |
| 85 |
text-overflow: ellipsis; |
| 86 |
} |
| 87 |
|
| 88 |
/* |
| 89 |
* Main content area — flex: 1 makes this fill all remaining vertical space |
| 90 |
* between the header and the counter button below it. |
| 91 |
* min-width: 0 prevents text from overflowing its flex container. |
| 92 |
*/ |
| 93 |
.dm-starter__body { |
| 94 |
flex: 1; |
| 95 |
font-size: 12px; |
| 96 |
line-height: 1.5; |
| 97 |
color: var(--os-ui-color-text, #1a1a1a); |
| 98 |
min-width: 0; |
| 99 |
/* Allow long post titles to wrap rather than overflow. */ |
| 100 |
overflow-wrap: break-word; |
| 101 |
} |
| 102 |
|
| 103 |
/* |
| 104 |
* Counter button — demonstrates using --os-ui-color-accent for interactive |
| 105 |
* elements so the button colour matches the user's chosen shell accent. |
| 106 |
* flex-shrink: 0 keeps it at its natural height at the bottom of the card. |
| 107 |
*/ |
| 108 |
.dm-starter__counter { |
| 109 |
flex-shrink: 0; |
| 110 |
background: var(--os-ui-color-accent, #3b82f6); |
| 111 |
color: #fff; |
| 112 |
border: none; |
| 113 |
border-radius: 6px; |
| 114 |
padding: 6px 12px; |
| 115 |
font-size: 11px; |
| 116 |
font-weight: 600; |
| 117 |
cursor: pointer; |
| 118 |
/* Subtle hover/active feedback without JavaScript. */ |
| 119 |
transition: opacity 0.15s ease; |
| 120 |
/* Prevent the button from stretching full width in a flex column. */ |
| 121 |
align-self: flex-start; |
| 122 |
} |
| 123 |
.dm-starter__counter:hover { opacity: 0.85; } |
| 124 |
.dm-starter__counter:active { opacity: 0.70; } |
| 125 |
|