@screenly/edge-apps 1.2.1 → 1.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/README.md
CHANGED
|
@@ -150,6 +150,35 @@ signalReady()
|
|
|
150
150
|
|
|
151
151
|
This library includes reusable web components for building consistent Edge Apps. See the [components documentation](https://github.com/Screenly/edge-apps-library/blob/main/docs/components.md) for usage details.
|
|
152
152
|
|
|
153
|
+
## Styling with Tailwind CSS
|
|
154
|
+
|
|
155
|
+
Edge Apps scaffolded with `create` come with [Tailwind CSS](https://tailwindcss.com/) enabled out of the box via `@tailwindcss/vite` — no extra install or config file needed. Just add the import to your app's stylesheet:
|
|
156
|
+
|
|
157
|
+
```css
|
|
158
|
+
@layer theme, base, utilities;
|
|
159
|
+
|
|
160
|
+
@import 'tailwindcss/theme.css' layer(theme);
|
|
161
|
+
@import '@screenly/edge-apps/styles' layer(base);
|
|
162
|
+
@import 'tailwindcss/utilities.css' layer(utilities);
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
> [!IMPORTANT]
|
|
166
|
+
> Declare the layer order up front with `@layer theme, base, utilities;`, and import `@screenly/edge-apps/styles` (and any other unlayered base CSS) into the `base` layer. Per the CSS Cascade Layers spec, unlayered CSS always beats layered CSS regardless of selector specificity — so without this, `@screenly/edge-apps/styles`'s base rules (e.g. its `user-select: none` reset) would silently override Tailwind utility classes.
|
|
167
|
+
|
|
168
|
+
Then use utility classes directly in your markup instead of writing custom CSS:
|
|
169
|
+
|
|
170
|
+
```html
|
|
171
|
+
<main class="flex h-full w-full items-center justify-center">
|
|
172
|
+
<h1 class="text-6xl portrait:text-4xl">Hello, Screenly!</h1>
|
|
173
|
+
</main>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
> [!IMPORTANT]
|
|
177
|
+
> Inside `<auto-scaler>`, use `h-full`/`w-full` instead of `h-screen`/`w-screen`. `<auto-scaler>` renders its content into a fixed-size box (the `reference-width`/`reference-height` you pass it) and scales that box to fit the real viewport with a CSS transform. Viewport-relative utilities (`h-screen`, `w-screen`, or arbitrary `vh`/`vw` values) measure the real viewport, not the scaled box, so they won't line up with the rest of your layout. The `portrait:`/`landscape:` variants are unaffected since they're based on device orientation, which `<auto-scaler>` uses the same way.
|
|
178
|
+
|
|
179
|
+
> [!WARNING]
|
|
180
|
+
> Avoid `@import 'tailwindcss';` (the full package) in an Edge App. It includes Preflight, which resets `border`, `margin`, and `padding` to `0` on every element via a universal selector — including custom-element hosts. Components like `<app-header>` style themselves through `:host` in their own shadow DOM (border, padding, etc.), and Preflight's reset silently overrides that styling from outside, since the host tag itself is a normal element in your page's light DOM. Import `tailwindcss/theme.css` and `tailwindcss/utilities.css` directly instead, as shown above, to get Tailwind's utility classes without Preflight.
|
|
181
|
+
|
|
153
182
|
## Edge Apps Scripts CLI
|
|
154
183
|
|
|
155
184
|
This package provides the `edge-apps-scripts` CLI tool for running shared development commands across all Edge Apps. It includes centralized ESLint configuration to avoid duplication.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@screenly/edge-apps",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "A TypeScript library for interfacing with Screenly Edge Apps API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"jsdom": "^28.1.0",
|
|
105
105
|
"offline-geocode-city": "^1.0.2",
|
|
106
106
|
"panic-overlay": "^1.0.51",
|
|
107
|
-
"sharp": "^0.
|
|
107
|
+
"sharp": "^0.35.3",
|
|
108
108
|
"tailwindcss": "^4.2.1",
|
|
109
109
|
"typescript": "^5.9.3",
|
|
110
110
|
"typescript-eslint": "^8.57.0",
|
|
@@ -16,6 +16,8 @@ Install dependencies:
|
|
|
16
16
|
{{PM_RUN}} dev
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
Styling uses [Tailwind CSS](https://tailwindcss.com/) utility classes, enabled via the `tailwindcss/theme.css` and `tailwindcss/utilities.css` imports in `src/style.css`. Inside `<auto-scaler>`, use `h-full`/`w-full` rather than `h-screen`/`w-screen` — see the [`@screenly/edge-apps` README](https://github.com/Screenly/edge-apps-library#styling-with-tailwind-css) for details.
|
|
20
|
+
|
|
19
21
|
## Build
|
|
20
22
|
|
|
21
23
|
```bash
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
reference-height="1080"
|
|
13
13
|
orientation="auto"
|
|
14
14
|
>
|
|
15
|
-
<div id="app">
|
|
15
|
+
<div id="app" class="flex h-full w-full flex-col">
|
|
16
16
|
<app-header show-date></app-header>
|
|
17
|
-
<main class="
|
|
18
|
-
<h1 id="message"></h1>
|
|
17
|
+
<main class="flex flex-1 items-center justify-center">
|
|
18
|
+
<h1 id="message" class="text-6xl portrait:text-4xl"></h1>
|
|
19
19
|
</main>
|
|
20
20
|
</div>
|
|
21
21
|
</auto-scaler>
|
|
@@ -1,30 +1,22 @@
|
|
|
1
|
-
@
|
|
1
|
+
@layer theme, base, utilities;
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
@import 'tailwindcss/theme.css' layer(theme);
|
|
4
|
+
@import '@screenly/edge-apps/styles' layer(base);
|
|
5
|
+
@import 'tailwindcss/utilities.css' layer(utilities);
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
font-family: 'Inter', system-ui, sans-serif;
|
|
12
|
-
}
|
|
7
|
+
@layer base {
|
|
8
|
+
* {
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.content {
|
|
22
|
-
flex: 1;
|
|
23
|
-
display: flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
justify-content: center;
|
|
26
|
-
}
|
|
12
|
+
body {
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
font-family: 'Inter', system-ui, sans-serif;
|
|
17
|
+
}
|
|
27
18
|
|
|
28
|
-
#message {
|
|
29
|
-
|
|
19
|
+
#message {
|
|
20
|
+
color: var(--theme-color-primary, #972eff);
|
|
21
|
+
}
|
|
30
22
|
}
|