@aejkatappaja/phantom-ui 0.1.1 → 0.2.2

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
@@ -1,3 +1,25 @@
1
+ <!--
2
+ ```
3
+ <custom-element-demo>
4
+ <template>
5
+ <script src="https://cdn.jsdelivr.net/npm/@aejkatappaja/phantom-ui/dist/phantom-ui.cdn.js"></script>
6
+ <phantom-ui loading>
7
+ <div style="background:#16213e;border-radius:12px;padding:20px;width:320px;color:#e0e0e0;font-family:system-ui">
8
+ <div style="display:flex;align-items:center;gap:12px;margin-bottom:16px">
9
+ <div style="width:48px;height:48px;border-radius:50%;background:#0f3460"></div>
10
+ <div>
11
+ <h3 style="margin:0 0 4px">Sarah Chen</h3>
12
+ <p style="margin:0;font-size:13px;color:#8899aa">Senior Engineer</p>
13
+ </div>
14
+ </div>
15
+ <p style="font-size:14px;line-height:1.5">Building scalable distributed systems and mentoring junior engineers.</p>
16
+ </div>
17
+ </phantom-ui>
18
+ </template>
19
+ </custom-element-demo>
20
+ ```
21
+ -->
22
+
1
23
  <p align="center">
2
24
  <img src="logo-phantom.svg" alt="phantom-ui" width="200" />
3
25
  </p>
@@ -7,13 +29,24 @@
7
29
  </p>
8
30
 
9
31
  <p align="center">
10
- <a href="https://www.npmjs.com/package/phantom-ui"><img src="https://img.shields.io/npm/v/phantom-ui.svg?style=flat-square" alt="npm version" /></a>
11
- <a href="https://bundlephobia.com/package/phantom-ui"><img src="https://img.shields.io/bundlephobia/minzip/phantom-ui?style=flat-square" alt="bundle size" /></a>
12
- <a href="https://github.com/anthropics/phantom-ui/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/phantom-ui?style=flat-square" alt="license" /></a>
32
+ <a href="https://www.npmjs.com/package/@aejkatappaja/phantom-ui"><img src="https://img.shields.io/npm/v/@aejkatappaja/phantom-ui.svg?style=flat-square" alt="npm version" /></a>
33
+ <img src="https://img.shields.io/badge/minzipped-~8kb-blue?style=flat-square" alt="bundle size" />
34
+ <a href="https://github.com/Aejkatappaja/phantom-ui/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@aejkatappaja/phantom-ui?style=flat-square" alt="license" /></a>
35
+ <a href="https://www.webcomponents.org/element/@aejkatappaja/phantom-ui"><img src="https://img.shields.io/badge/webcomponents.org-published-blue.svg?style=flat-square" alt="Published on webcomponents.org" /></a>
13
36
  </p>
14
37
 
15
38
  ---
16
39
 
40
+ <br />
41
+
42
+ <div align="center">
43
+ <picture>
44
+ <img src="preview.gif" alt="phantom-ui demo" width="400" />
45
+ </picture>
46
+ </div>
47
+
48
+ <br />
49
+
17
50
  Stop building skeleton screens by hand. Wrap your real UI in `<phantom-ui>` and it generates shimmer placeholders automatically by measuring your actual DOM at runtime.
18
51
 
19
52
  No separate skeleton components to maintain. No copy-pasting layouts. The real component _is_ the skeleton template.
@@ -29,16 +62,16 @@ Because it is a standard Web Component (built with Lit), it works in React, Vue,
29
62
  ## Install
30
63
 
31
64
  ```bash
32
- bun add phantom-ui # bun
33
- npm install phantom-ui # npm
34
- pnpm add phantom-ui # pnpm
35
- yarn add phantom-ui # yarn
65
+ bun add @aejkatappaja/phantom-ui # bun
66
+ npm install @aejkatappaja/phantom-ui # npm
67
+ pnpm add @aejkatappaja/phantom-ui # pnpm
68
+ yarn add @aejkatappaja/phantom-ui # yarn
36
69
  ```
37
70
 
38
71
  Or drop in a script tag with no build step:
39
72
 
40
73
  ```html
41
- <script src="https://cdn.jsdelivr.net/npm/phantom-ui/dist/phantom-ui.cdn.js"></script>
74
+ <script src="https://cdn.jsdelivr.net/npm/@aejkatappaja/phantom-ui/dist/phantom-ui.cdn.js"></script>
42
75
  ```
43
76
 
44
77
  ## Quick start
@@ -60,7 +93,7 @@ Set `loading` to show the shimmer. Remove it to reveal the real content.
60
93
  ### React
61
94
 
62
95
  ```tsx
63
- import "phantom-ui";
96
+ import "@aejkatappaja/phantom-ui";
64
97
 
65
98
  function ProfileCard({ user, isLoading }: Props) {
66
99
  return (
@@ -79,7 +112,7 @@ function ProfileCard({ user, isLoading }: Props) {
79
112
 
80
113
  ```vue
81
114
  <script setup lang="ts">
82
- import "phantom-ui";
115
+ import "@aejkatappaja/phantom-ui";
83
116
 
84
117
  const props = defineProps<{ loading: boolean }>();
85
118
  </script>
@@ -99,7 +132,7 @@ const props = defineProps<{ loading: boolean }>();
99
132
 
100
133
  ```svelte
101
134
  <script lang="ts">
102
- import "phantom-ui";
135
+ import "@aejkatappaja/phantom-ui";
103
136
 
104
137
  export let loading = true;
105
138
  </script>
@@ -117,7 +150,7 @@ const props = defineProps<{ loading: boolean }>();
117
150
 
118
151
  ```typescript
119
152
  import { Component, signal, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
120
- import "phantom-ui";
153
+ import "@aejkatappaja/phantom-ui";
121
154
 
122
155
  @Component({
123
156
  selector: "app-profile",
@@ -141,7 +174,7 @@ export class ProfileComponent {
141
174
 
142
175
  ```tsx
143
176
  import { createSignal } from "solid-js";
144
- import "phantom-ui";
177
+ import "@aejkatappaja/phantom-ui";
145
178
 
146
179
  function ProfileCard() {
147
180
  const [loading, setLoading] = createSignal(true);
@@ -168,7 +201,7 @@ The component needs browser APIs to measure the DOM. Import it client-side only:
168
201
  import { useEffect } from "react";
169
202
 
170
203
  export default function Page() {
171
- useEffect(() => { import("phantom-ui"); }, []);
204
+ useEffect(() => { import("@aejkatappaja/phantom-ui"); }, []);
172
205
  return <phantom-ui loading>...</phantom-ui>;
173
206
  }
174
207
  ```
@@ -176,7 +209,7 @@ export default function Page() {
176
209
  ```vue
177
210
  <!-- Nuxt -->
178
211
  <script setup>
179
- onMounted(() => import("phantom-ui"));
212
+ onMounted(() => import("@aejkatappaja/phantom-ui"));
180
213
  </script>
181
214
 
182
215
  <template>
@@ -190,7 +223,7 @@ onMounted(() => import("phantom-ui"));
190
223
  <!-- SvelteKit -->
191
224
  <script>
192
225
  import { onMount } from "svelte";
193
- onMount(() => import("phantom-ui"));
226
+ onMount(() => import("@aejkatappaja/phantom-ui"));
194
227
  </script>
195
228
  ```
196
229
 
@@ -205,10 +238,10 @@ Vue, Svelte, and Angular work out of the box without any type declaration.
205
238
  If the postinstall did not run (CI, monorepos, `--ignore-scripts`), you can generate it manually:
206
239
 
207
240
  ```bash
208
- npx phantom-ui init # npm
209
- bunx phantom-ui init # bun
210
- pnpx phantom-ui init # pnpm
211
- yarn dlx phantom-ui init # yarn
241
+ npx @aejkatappaja/phantom-ui init # npm
242
+ bunx @aejkatappaja/phantom-ui init # bun
243
+ pnpx @aejkatappaja/phantom-ui init # pnpm
244
+ yarn dlx @aejkatappaja/phantom-ui init # yarn
212
245
  ```
213
246
 
214
247
  <details>
@@ -217,7 +250,7 @@ yarn dlx phantom-ui init # yarn
217
250
  **React**
218
251
 
219
252
  ```typescript
220
- import type { PhantomUiAttributes } from "phantom-ui";
253
+ import type { PhantomUiAttributes } from "@aejkatappaja/phantom-ui";
221
254
 
222
255
  declare module "react/jsx-runtime" {
223
256
  export namespace JSX {
@@ -231,7 +264,7 @@ declare module "react/jsx-runtime" {
231
264
  **Solid**
232
265
 
233
266
  ```typescript
234
- import type { SolidPhantomUiAttributes } from "phantom-ui";
267
+ import type { SolidPhantomUiAttributes } from "@aejkatappaja/phantom-ui";
235
268
 
236
269
  declare module "solid-js" {
237
270
  namespace JSX {
@@ -245,7 +278,7 @@ declare module "solid-js" {
245
278
  **Qwik**
246
279
 
247
280
  ```typescript
248
- import type { PhantomUiAttributes } from "phantom-ui";
281
+ import type { PhantomUiAttributes } from "@aejkatappaja/phantom-ui";
249
282
 
250
283
  declare module "@builder.io/qwik" {
251
284
  namespace QwikJSX {
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@aejkatappaja/phantom-ui",
3
- "version": "0.1.1",
3
+ "version": "0.2.2",
4
4
  "description": "Structure-aware shimmer skeleton loader as a universal Web Component built with Lit. Works with React, Vue, Svelte, Angular, Solid, or vanilla JS.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/Aejkatappaja/phantom-ui"
8
+ },
5
9
  "type": "module",
6
10
  "main": "dist/phantom-ui.js",
7
11
  "module": "dist/phantom-ui.js",
@@ -63,8 +67,6 @@
63
67
  },
64
68
  "customElements": "custom-elements.json",
65
69
  "lint-staged": {
66
- "*.{ts,mjs}": [
67
- "biome check --write --no-errors-on-unmatched"
68
- ]
70
+ "*.{ts,mjs}": ["biome check --write --no-errors-on-unmatched"]
69
71
  }
70
72
  }
package/src/cli/init.mjs CHANGED
@@ -6,7 +6,7 @@ import { dirname, join, resolve } from "node:path";
6
6
  const FILENAME = "phantom-ui.d.ts";
7
7
 
8
8
  const templates = {
9
- react: `import type { PhantomUiAttributes } from "phantom-ui";
9
+ react: `import type { PhantomUiAttributes } from "@aejkatappaja/phantom-ui";
10
10
 
11
11
  declare module "react/jsx-runtime" {
12
12
  \texport namespace JSX {
@@ -16,7 +16,7 @@ declare module "react/jsx-runtime" {
16
16
  \t}
17
17
  }
18
18
  `,
19
- solid: `import type { SolidPhantomUiAttributes } from "phantom-ui";
19
+ solid: `import type { SolidPhantomUiAttributes } from "@aejkatappaja/phantom-ui";
20
20
 
21
21
  declare module "solid-js" {
22
22
  \tnamespace JSX {
@@ -26,7 +26,7 @@ declare module "solid-js" {
26
26
  \t}
27
27
  }
28
28
  `,
29
- qwik: `import type { PhantomUiAttributes } from "phantom-ui";
29
+ qwik: `import type { PhantomUiAttributes } from "@aejkatappaja/phantom-ui";
30
30
 
31
31
  declare module "@builder.io/qwik" {
32
32
  \tnamespace QwikJSX {