@loomidev/centered-content 0.2.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/LICENSE +21 -0
- package/README.md +268 -0
- package/custom-elements.json +104 -0
- package/dist/generated/styles.css.d.ts +3 -0
- package/dist/generated/styles.css.d.ts.map +1 -0
- package/dist/generated/styles.css.js +5 -0
- package/dist/generated/styles.css.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/loomi-centered-content.d.ts +22 -0
- package/dist/loomi-centered-content.d.ts.map +1 -0
- package/dist/loomi-centered-content.js +44 -0
- package/dist/loomi-centered-content.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Michael K. Ocansey
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# @loomidev/centered-content
|
|
2
|
+
|
|
3
|
+
`<loomi-centered-content>` — vertically and horizontally centers its content. Great for
|
|
4
|
+
sign-in screens, empty pages and hero sections.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm install @loomidev/centered-content lit
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```js
|
|
11
|
+
import "@loomidev/centered-content";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Basic Usage
|
|
15
|
+
|
|
16
|
+
```html
|
|
17
|
+
<loomi-centered-content>
|
|
18
|
+
<h1>Welcome back</h1>
|
|
19
|
+
<p>Sign in to continue.</p>
|
|
20
|
+
</loomi-centered-content>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Custom Dimensions
|
|
24
|
+
|
|
25
|
+
`min-height` controls how tall the centering area is; `max-width` caps the width of the
|
|
26
|
+
content inside it. Both accept any CSS length.
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<loomi-centered-content min-height="100vh" max-width="20rem">
|
|
30
|
+
<h1>Welcome back</h1>
|
|
31
|
+
</loomi-centered-content>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Practical Example: Sign-In Screen
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<loomi-centered-content min-height="100vh" max-width="24rem">
|
|
38
|
+
<loomi-card>
|
|
39
|
+
<h1 style="margin:0 0 1rem">Sign in</h1>
|
|
40
|
+
<loomi-input type="email" label="Email"></loomi-input>
|
|
41
|
+
<loomi-input type="password" label="Password"></loomi-input>
|
|
42
|
+
<loomi-button block>Sign in</loomi-button>
|
|
43
|
+
</loomi-card>
|
|
44
|
+
</loomi-centered-content>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Practical Example: Empty Page
|
|
48
|
+
|
|
49
|
+
Pair it with [`<loomi-empty-state>`](../empty-state) for a centered "nothing here yet"
|
|
50
|
+
screen.
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<loomi-centered-content min-height="70vh" max-width="28rem">
|
|
54
|
+
<loomi-empty-state
|
|
55
|
+
heading="No projects yet"
|
|
56
|
+
message="Create your first project to get started."
|
|
57
|
+
button-label="New project"
|
|
58
|
+
></loomi-empty-state>
|
|
59
|
+
</loomi-centered-content>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Accessibility
|
|
63
|
+
|
|
64
|
+
For the library-wide baseline, see [Foundations — Accessibility](https://loomiui.com/foundations/#accessibility).
|
|
65
|
+
|
|
66
|
+
## Responsive behavior
|
|
67
|
+
|
|
68
|
+
For the shared container and viewport rules, see [Foundations — Responsive behavior](https://loomiui.com/foundations/#responsive-behavior).
|
|
69
|
+
|
|
70
|
+
## Dark mode
|
|
71
|
+
|
|
72
|
+
For theme activation, token overrides, and contrast guidance, see [Foundations — Dark mode](https://loomiui.com/foundations/#dark-mode).
|
|
73
|
+
|
|
74
|
+
## Attributes
|
|
75
|
+
|
|
76
|
+
| Attribute | Default | Description |
|
|
77
|
+
| ------------ | ------- | ------------------------------------------------ |
|
|
78
|
+
| `min-height` | `60vh` | Height of the centering area (any CSS length). |
|
|
79
|
+
| `max-width` | `28rem` | Max width of the inner content (any CSS length). |
|
|
80
|
+
|
|
81
|
+
## Slots
|
|
82
|
+
|
|
83
|
+
| Slot | Description |
|
|
84
|
+
| ----------- | ------------------------------------ |
|
|
85
|
+
| _(default)_ | Content placed inside the component. |
|
|
86
|
+
|
|
87
|
+
## Full Example
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<loomi-centered-content min-height="100vh" max-width="22rem">
|
|
91
|
+
<loomi-card>
|
|
92
|
+
<h1>404</h1>
|
|
93
|
+
<p>This page doesn't exist.</p>
|
|
94
|
+
<loomi-button url="/">Back home</loomi-button>
|
|
95
|
+
</loomi-card>
|
|
96
|
+
</loomi-centered-content>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
<!-- BEGIN loomi-framework-guide -->
|
|
100
|
+
|
|
101
|
+
## Framework integration
|
|
102
|
+
|
|
103
|
+
`<loomi-centered-content>` is a standard custom element, so the browser can use it in plain HTML, Blade, React, Vue, Angular, Svelte, Astro, and most other frameworks. The important beginner rule is: install the package, import it once before the tag is rendered, then write the Loomi tag in your template.
|
|
104
|
+
|
|
105
|
+
### Where to run commands
|
|
106
|
+
|
|
107
|
+
Run install commands from the app where you want to use this component. That means the folder that contains that app's `package.json`. Do not run these install commands from `packages/centered-content` unless you are editing LoomiUI itself.
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
cd /path/to/your-app
|
|
111
|
+
npm install @loomidev/centered-content lit
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
If you are contributing to LoomiUI itself, first move to the top-level `components` folder. That is where the main `package.json` for all packages lives, and `pnpm --filter ...` commands should be run from there:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
cd /path/to/your-copy-of-loomiui/components
|
|
118
|
+
pnpm --filter @loomidev/centered-content build
|
|
119
|
+
pnpm --filter @loomidev/centered-content typecheck
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Choose your framework
|
|
123
|
+
|
|
124
|
+
<loomi-tabs>
|
|
125
|
+
<loomi-tab label="HTML" active>
|
|
126
|
+
|
|
127
|
+
Use the CDN version for prototypes, documentation pages, or a quick reproduction. The import map tells the browser where to find Lit, which Loomi components use internally.
|
|
128
|
+
|
|
129
|
+
```html
|
|
130
|
+
<script type="importmap">
|
|
131
|
+
{ "imports": { "lit": "https://esm.sh/lit@3.3.3", "lit/": "https://esm.sh/lit@3.3.3/" } }
|
|
132
|
+
</script>
|
|
133
|
+
<script type="module" src="https://esm.sh/@loomidev/centered-content"></script>
|
|
134
|
+
|
|
135
|
+
<loomi-centered-content min-height="240px" max-width="32rem">
|
|
136
|
+
<loomi-empty-state heading="Nothing here yet" message="Create your first record to get started."></loomi-empty-state>
|
|
137
|
+
</loomi-centered-content>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
</loomi-tab>
|
|
141
|
+
<loomi-tab label="Bundlers and SPAs">
|
|
142
|
+
|
|
143
|
+
In Vite, Webpack, Parcel, Rollup, or a framework build pipeline, install the package and import it once in your main app JavaScript file. After that, you can use the Loomi tag anywhere in your app.
|
|
144
|
+
|
|
145
|
+
```js
|
|
146
|
+
import "@loomidev/centered-content";
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
</loomi-tab>
|
|
150
|
+
<loomi-tab label="Blade">
|
|
151
|
+
|
|
152
|
+
Run the install command from your Laravel project root, then import the component in `resources/js/app.js`. If your project uses Laravel Vite, `npm run dev` and `npm run build` should also be run from the Laravel project root.
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
cd /path/to/your-laravel-app
|
|
156
|
+
npm install @loomidev/centered-content lit
|
|
157
|
+
npm run dev
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
// resources/js/app.js
|
|
162
|
+
import "@loomidev/centered-content";
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
```blade
|
|
166
|
+
<loomi-centered-content min-height="240px" max-width="32rem">
|
|
167
|
+
<loomi-empty-state heading="Nothing here yet" message="Create your first record to get started."></loomi-empty-state>
|
|
168
|
+
</loomi-centered-content>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
</loomi-tab>
|
|
172
|
+
<loomi-tab label="React">
|
|
173
|
+
|
|
174
|
+
React can render Loomi tags directly. If you are on React 18, or if you need to pass arrays, objects, or functions, use a ref and assign those values after the component mounts.
|
|
175
|
+
|
|
176
|
+
```jsx
|
|
177
|
+
import "@loomidev/centered-content";
|
|
178
|
+
|
|
179
|
+
export function LoomiExample() {
|
|
180
|
+
return (
|
|
181
|
+
<loomi-centered-content min-height="240px" max-width="32rem">
|
|
182
|
+
<loomi-empty-state heading="Nothing here yet" message="Create your first record to get started."></loomi-empty-state>
|
|
183
|
+
</loomi-centered-content>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
If TypeScript does not recognize the Loomi tag in JSX, add it to your app's JSX type declarations.
|
|
189
|
+
|
|
190
|
+
</loomi-tab>
|
|
191
|
+
<loomi-tab label="Vue">
|
|
192
|
+
|
|
193
|
+
Import the package in the component that uses it, or once in your main Vue file. Vue templates can use Loomi tags directly. For arrays, objects, or functions, pass the value as a JavaScript property instead of as plain text.
|
|
194
|
+
|
|
195
|
+
```vue
|
|
196
|
+
<script setup>
|
|
197
|
+
import "@loomidev/centered-content";
|
|
198
|
+
</script>
|
|
199
|
+
|
|
200
|
+
<template>
|
|
201
|
+
<loomi-centered-content min-height="240px" max-width="32rem">
|
|
202
|
+
<loomi-empty-state heading="Nothing here yet" message="Create your first record to get started."></loomi-empty-state>
|
|
203
|
+
</loomi-centered-content>
|
|
204
|
+
</template>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
If Vue warns that the tag is an unknown component, configure `compilerOptions.isCustomElement` for tags that start with `loomi-` in your Vite or Vue config.
|
|
208
|
+
|
|
209
|
+
</loomi-tab>
|
|
210
|
+
<loomi-tab label="Angular">
|
|
211
|
+
|
|
212
|
+
Import the package once and tell Angular to allow custom HTML tags with `CUSTOM_ELEMENTS_SCHEMA`. For NgModule apps, add the schema to the module instead of the standalone component.
|
|
213
|
+
|
|
214
|
+
```ts
|
|
215
|
+
// app.component.ts
|
|
216
|
+
import { CUSTOM_ELEMENTS_SCHEMA, Component } from "@angular/core";
|
|
217
|
+
import "@loomidev/centered-content";
|
|
218
|
+
|
|
219
|
+
@Component({
|
|
220
|
+
selector: "app-root",
|
|
221
|
+
standalone: true,
|
|
222
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
223
|
+
template: `
|
|
224
|
+
<loomi-centered-content min-height="240px" max-width="32rem">
|
|
225
|
+
<loomi-empty-state heading="Nothing here yet" message="Create your first record to get started."></loomi-empty-state>
|
|
226
|
+
</loomi-centered-content>
|
|
227
|
+
`,
|
|
228
|
+
})
|
|
229
|
+
export class AppComponent {}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
</loomi-tab>
|
|
233
|
+
<loomi-tab label="Svelte / Astro">
|
|
234
|
+
|
|
235
|
+
Svelte can import the package inside a component script. Astro can import it in the frontmatter of the page or layout where the tag appears.
|
|
236
|
+
|
|
237
|
+
```svelte
|
|
238
|
+
<script>
|
|
239
|
+
import "@loomidev/centered-content";
|
|
240
|
+
</script>
|
|
241
|
+
|
|
242
|
+
<loomi-centered-content min-height="240px" max-width="32rem">
|
|
243
|
+
<loomi-empty-state heading="Nothing here yet" message="Create your first record to get started."></loomi-empty-state>
|
|
244
|
+
</loomi-centered-content>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
```astro
|
|
248
|
+
---
|
|
249
|
+
import "@loomidev/centered-content";
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
<loomi-centered-content min-height="240px" max-width="32rem">
|
|
253
|
+
<loomi-empty-state heading="Nothing here yet" message="Create your first record to get started."></loomi-empty-state>
|
|
254
|
+
</loomi-centered-content>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
</loomi-tab>
|
|
258
|
+
</loomi-tabs>
|
|
259
|
+
|
|
260
|
+
### Server-side rendering notes
|
|
261
|
+
|
|
262
|
+
Frameworks such as Next.js, Nuxt, SvelteKit, and Astro sometimes render HTML on the server before browser-only code runs. If your framework complains, move the Loomi import to client-side code. In Next.js, that usually means a component with `"use client"`; in Nuxt, it often means a `.client.ts` plugin.
|
|
263
|
+
|
|
264
|
+
<!-- END loomi-framework-guide -->
|
|
265
|
+
|
|
266
|
+
## Dependencies
|
|
267
|
+
|
|
268
|
+
- `@loomidev/core`
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/index.ts",
|
|
8
|
+
"declarations": [],
|
|
9
|
+
"exports": [
|
|
10
|
+
{
|
|
11
|
+
"kind": "js",
|
|
12
|
+
"name": "LoomiCenteredContent",
|
|
13
|
+
"declaration": {
|
|
14
|
+
"name": "LoomiCenteredContent",
|
|
15
|
+
"module": "./loomi-centered-content.js"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"kind": "javascript-module",
|
|
22
|
+
"path": "src/loomi-centered-content.ts",
|
|
23
|
+
"declarations": [
|
|
24
|
+
{
|
|
25
|
+
"kind": "class",
|
|
26
|
+
"description": "`<loomi-centered-content>` — vertically and horizontally centers its content. Handy for\nsign-in screens, empty pages and hero sections.",
|
|
27
|
+
"name": "LoomiCenteredContent",
|
|
28
|
+
"slots": [
|
|
29
|
+
{
|
|
30
|
+
"description": "The content to center.",
|
|
31
|
+
"name": ""
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"members": [
|
|
35
|
+
{
|
|
36
|
+
"kind": "field",
|
|
37
|
+
"name": "minHeight",
|
|
38
|
+
"type": {
|
|
39
|
+
"text": "string"
|
|
40
|
+
},
|
|
41
|
+
"default": "\"\"",
|
|
42
|
+
"description": "Minimum height of the centering area (any CSS length).",
|
|
43
|
+
"attribute": "min-height"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"kind": "field",
|
|
47
|
+
"name": "maxWidth",
|
|
48
|
+
"type": {
|
|
49
|
+
"text": "string"
|
|
50
|
+
},
|
|
51
|
+
"default": "\"\"",
|
|
52
|
+
"description": "Maximum width of the inner content (any CSS length).",
|
|
53
|
+
"attribute": "max-width"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"attributes": [
|
|
57
|
+
{
|
|
58
|
+
"name": "min-height",
|
|
59
|
+
"type": {
|
|
60
|
+
"text": "string"
|
|
61
|
+
},
|
|
62
|
+
"default": "\"\"",
|
|
63
|
+
"description": "Minimum height of the centering area (any CSS length).",
|
|
64
|
+
"fieldName": "minHeight"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "max-width",
|
|
68
|
+
"type": {
|
|
69
|
+
"text": "string"
|
|
70
|
+
},
|
|
71
|
+
"default": "\"\"",
|
|
72
|
+
"description": "Maximum width of the inner content (any CSS length).",
|
|
73
|
+
"fieldName": "maxWidth"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"superclass": {
|
|
77
|
+
"name": "LoomiElement",
|
|
78
|
+
"package": "@loomidev/core"
|
|
79
|
+
},
|
|
80
|
+
"tagName": "loomi-centered-content",
|
|
81
|
+
"customElement": true
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"exports": [
|
|
85
|
+
{
|
|
86
|
+
"kind": "js",
|
|
87
|
+
"name": "LoomiCenteredContent",
|
|
88
|
+
"declaration": {
|
|
89
|
+
"name": "LoomiCenteredContent",
|
|
90
|
+
"module": "src/loomi-centered-content.ts"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"kind": "custom-element-definition",
|
|
95
|
+
"name": "loomi-centered-content",
|
|
96
|
+
"declaration": {
|
|
97
|
+
"name": "LoomiCenteredContent",
|
|
98
|
+
"module": "src/loomi-centered-content.ts"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../src/generated/styles.css.ts"],"names":[],"mappings":"AAGA,+EAA+E;AAC/E,eAAO,MAAM,eAAe,yBAA2Y,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Generated by @loomidev/centered-content — do not edit by hand. Run `pnpm build` to regenerate.
|
|
2
|
+
import { unsafeCSS } from "lit";
|
|
3
|
+
/** Compiled, Shadow-DOM-scoped styles. Colors resolve via `var(--loomi-*)`. */
|
|
4
|
+
export const componentStyles = unsafeCSS("/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */\n@layer theme,base,components,utilities;:host{display:block}:host([hidden]){display:none}.loomi-center{text-align:center;min-height:var(--loomi-center-min,60vh);flex-direction:column;justify-content:center;align-items:center;width:100%;display:flex}.loomi-inner{width:100%;max-width:var(--loomi-center-max,28rem)}");
|
|
5
|
+
//# sourceMappingURL=styles.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.css.js","sourceRoot":"","sources":["../../src/generated/styles.css.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAEhC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,6XAA6X,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type TemplateResult } from "lit";
|
|
2
|
+
import { LoomiElement } from "@loomidev/core";
|
|
3
|
+
/**
|
|
4
|
+
* `<loomi-centered-content>` — vertically and horizontally centers its content. Handy for
|
|
5
|
+
* sign-in screens, empty pages and hero sections.
|
|
6
|
+
*
|
|
7
|
+
* @slot - The content to center.
|
|
8
|
+
*/
|
|
9
|
+
export declare class LoomiCenteredContent extends LoomiElement {
|
|
10
|
+
static styles: import("lit").CSSResultGroup[];
|
|
11
|
+
/** Minimum height of the centering area (any CSS length). */
|
|
12
|
+
minHeight: string;
|
|
13
|
+
/** Maximum width of the inner content (any CSS length). */
|
|
14
|
+
maxWidth: string;
|
|
15
|
+
render(): TemplateResult;
|
|
16
|
+
}
|
|
17
|
+
declare global {
|
|
18
|
+
interface HTMLElementTagNameMap {
|
|
19
|
+
"loomi-centered-content": LoomiCenteredContent;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=loomi-centered-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loomi-centered-content.d.ts","sourceRoot":"","sources":["../src/loomi-centered-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAe,MAAM,gBAAgB,CAAC;AAG3D;;;;;GAKG;AACH,qBACa,oBAAqB,SAAQ,YAAY;IACpD,OAAgB,MAAM,iCAAgC;IAEtD,6DAA6D;IACtB,SAAS,SAAM;IACtD,2DAA2D;IACrB,QAAQ,SAAM;IAE3C,MAAM,IAAI,cAAc;CAKlC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,wBAAwB,EAAE,oBAAoB,CAAC;KAChD;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { LoomiElement, loomiStyles } from "@loomidev/core";
|
|
10
|
+
import { componentStyles } from "./generated/styles.css.js";
|
|
11
|
+
/**
|
|
12
|
+
* `<loomi-centered-content>` — vertically and horizontally centers its content. Handy for
|
|
13
|
+
* sign-in screens, empty pages and hero sections.
|
|
14
|
+
*
|
|
15
|
+
* @slot - The content to center.
|
|
16
|
+
*/
|
|
17
|
+
let LoomiCenteredContent = class LoomiCenteredContent extends LoomiElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
/** Minimum height of the centering area (any CSS length). */
|
|
21
|
+
this.minHeight = "";
|
|
22
|
+
/** Maximum width of the inner content (any CSS length). */
|
|
23
|
+
this.maxWidth = "";
|
|
24
|
+
}
|
|
25
|
+
static { this.styles = loomiStyles(componentStyles); }
|
|
26
|
+
render() {
|
|
27
|
+
if (this.minHeight)
|
|
28
|
+
this.style.setProperty("--loomi-center-min", this.minHeight);
|
|
29
|
+
if (this.maxWidth)
|
|
30
|
+
this.style.setProperty("--loomi-center-max", this.maxWidth);
|
|
31
|
+
return html `<div class="loomi-center"><div class="loomi-inner"><slot></slot></div></div>`;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
__decorate([
|
|
35
|
+
property({ attribute: "min-height" })
|
|
36
|
+
], LoomiCenteredContent.prototype, "minHeight", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
property({ attribute: "max-width" })
|
|
39
|
+
], LoomiCenteredContent.prototype, "maxWidth", void 0);
|
|
40
|
+
LoomiCenteredContent = __decorate([
|
|
41
|
+
customElement("loomi-centered-content")
|
|
42
|
+
], LoomiCenteredContent);
|
|
43
|
+
export { LoomiCenteredContent };
|
|
44
|
+
//# sourceMappingURL=loomi-centered-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loomi-centered-content.js","sourceRoot":"","sources":["../src/loomi-centered-content.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D;;;;;GAKG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,YAAY;IAA/C;;QAGL,6DAA6D;QACtB,cAAS,GAAG,EAAE,CAAC;QACtD,2DAA2D;QACrB,aAAQ,GAAG,EAAE,CAAC;IAOtD,CAAC;aAZiB,WAAM,GAAG,WAAW,CAAC,eAAe,CAAC,AAA/B,CAAgC;IAO7C,MAAM;QACb,IAAI,IAAI,CAAC,SAAS;YAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACjF,IAAI,IAAI,CAAC,QAAQ;YAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,oBAAoB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/E,OAAO,IAAI,CAAA,8EAA8E,CAAC;IAC5F,CAAC;;AARsC;IAAtC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;uDAAgB;AAEhB;IAArC,QAAQ,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;sDAAe;AANzC,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CAahC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@loomidev/centered-content",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "<loomi-centered-content> — center content vertically and horizontally.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/loomidev/loomiui.git",
|
|
8
|
+
"directory": "packages/centered-content"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"module": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"custom-elements.json"
|
|
21
|
+
],
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./loomi-centered-content.js": {
|
|
28
|
+
"types": "./dist/loomi-centered-content.d.ts",
|
|
29
|
+
"import": "./dist/loomi-centered-content.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@loomidev/core": "^0.2.0"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"lit": "^3.0.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@tailwindcss/cli": "^4.0.0",
|
|
40
|
+
"lit": "^3.3.3",
|
|
41
|
+
"tailwindcss": "^4.0.0",
|
|
42
|
+
"typescript": "^5.6.3",
|
|
43
|
+
"@loomidev/theme": "^0.2.0"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"web-components",
|
|
47
|
+
"lit",
|
|
48
|
+
"loomiui",
|
|
49
|
+
"layout"
|
|
50
|
+
],
|
|
51
|
+
"customElements": "custom-elements.json",
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "node scripts/build-styles.mjs && tsc -p tsconfig.json",
|
|
54
|
+
"dev": "node scripts/build-styles.mjs && tsc -p tsconfig.json --watch",
|
|
55
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
56
|
+
}
|
|
57
|
+
}
|