uifolio 0.6.0 → 0.7.1

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
@@ -14,6 +14,7 @@ and the alias is rewritten automatically.
14
14
  # from any project, through the npm package
15
15
  npx uifolio@latest add calendar --color "#10B981" --radius 6
16
16
  pnpm dlx uifolio@latest add video-player otp
17
+ pnpm dlx uifolio@latest add horizontal-accordion storytelling
17
18
 
18
19
  # from the root of the project that contains UIfolio
19
20
  npm run uifolio -- list
@@ -31,19 +32,43 @@ node cli/uifolio.mjs add file-upload --alias "#lib" --dry-run # simulate
31
32
  | `uifolio init` | writes `uifolio.json` (dir, lib, alias) in the target project |
32
33
  | `uifolio add <names...>` | copies the component **+ transitive dependencies** (helpers `@/lib/*`) |
33
34
 
34
- Options: `--cwd <dir>`, `--dir <path>` (default `src/components/ui`), `--lib <path>` (default `src/lib`), `--alias <alias>` (default `@`), `--page <path>` (created if missing), `--interactive` (force the questions), `--force` (overwrite), `--dry-run` (simulate), `--color <hex>` and `--radius <px>`.
35
+ Options: `--cwd <dir>`, `--dir <path>` (default `src/components/ui`), `--animations <path>` (default `src/components/animations`), `--lib <path>` (default `src/lib`), `--alias <alias>` (default `@`), `--page <path>` (created if missing), `--interactive` (force the questions), `--force` (overwrite), `--dry-run` (simulate), `--color <hex>` and `--radius <px>`.
35
36
 
36
- `add` does not stop at the copy. The components always land in
37
- `src/components/ui` (override with `--dir`) and the page imports them through
38
- the `@/` alias. Without `--page`, the CLI asks where to use them:
37
+ `add` does not stop at the copy. The components land in
38
+ `src/components/ui` (override with `--dir`), the animations in
39
+ `src/components/animations` (override with `--animations`), and the page imports
40
+ them through the `@/` alias. Without `--page`, the CLI asks where to use them:
39
41
 
40
- 1. *Do you already have a file ready to receive the component (…component…) (y/N) ?* `yes` → *In which file should the component (…component…) be copied (e.g. src/pages/calendar.tsx) ?*: the import and a ready-to-render example are added without duplication, and the file is created when missing;
42
+ 1. *Do you already have a file ready to receive the component (…component…) (y/N) ?* `yes` → *In which file should the component (…component…) be copied (e.g. src/pages/calendar.tsx) ?*: the import and a ready-to-render usage are added without duplication, and the file is created when missing. When the file already exists, the CLI also asks *At which line should the component (…component…) start (the content on that line moves after it) ?* (an empty answer keeps the automatic placement);
41
43
  2. `no` → *Would you like to create a new folder and an import file (Y/n) ?* `yes` → *Please specify the new path (e.g. src/pages/calendar.tsx) ?*: the folder and the file are created; `no` → install only, no file is touched.
42
44
 
43
- The example is a small component (`<CalendarExample />` plus its definition)
44
- that carries the data and props each component needs (items for `Stories` and
45
- `CommandMenu`, a source for the players, children for the resizable panels…),
46
- so the component is visible immediately instead of an empty `<Component />`.
45
+ The usage is written **inside the page's own component**, not in a separate
46
+ `<CalendarExample />` helper: the element, its props and the state or data it
47
+ needs (items for `Stories` and `CommandMenu`, a source for the players,
48
+ children for the resizable panels…) are inlined where the component is added,
49
+ so it is visible immediately instead of an empty `<Component />`. The state and
50
+ data go at the top of the component body, before its `return`.
51
+
52
+ ```tsx
53
+ 'use client'
54
+
55
+ import { useState } from 'react'
56
+ import { Choice } from '@/components/ui/choice'
57
+
58
+ export default function Home() {
59
+ const [checked, setChecked] = useState(true)
60
+ return (
61
+ <main>
62
+ <Choice
63
+ checked={checked}
64
+ onChange={setChecked}
65
+ label="Email alerts"
66
+ description="Get a summary every week."
67
+ />
68
+ </main>
69
+ )
70
+ }
71
+ ```
47
72
 
48
73
  Answering `-` to a path question installs the component without creating or
49
74
  modifying any page.
@@ -114,6 +139,14 @@ only marks the installation as complete when that is relevant.
114
139
  | OtpInput | `src/components/ui/otp-input.tsx` | 4 fields, paste, rotate + success check |
115
140
  | ColorPicker | `src/components/ui/color-picker.tsx` | advanced panel, saturation/lightness, hue, alpha, eyedropper, RGB channels, presets, HEX/RGB/HSL/RGBA |
116
141
  | Table | `src/components/ui/table.tsx` | shadcn-style typed table, uniform `px-4` cells and a wider gap before Actions, select-all checkbox, row actions |
142
+ | HorizontalAccordion | `src/components/animations/horizontal-accordion.tsx` | theme-colored panels, hover, click, arrow/Home/End keyboard |
143
+ | Storytelling | `src/components/animations/horizontal-story.tsx` | vertical scroll driven horizontal story, palettes, mobile touch fallback |
144
+ | StackingCards | `src/components/animations/stacking-cards.tsx` | cards settle on scroll, customizable gradients or solid color |
145
+ | ScrollText | `src/components/animations/scroll-text.tsx` | letters light up with their viewport position, reversible |
146
+ | ImageCrossfade | `src/components/animations/image-crossfade.tsx` | pinned crossfading images, captions, dots and customizable overlay |
147
+
148
+ The animation helpers (`data.ts`, `palette.ts`, `animation-settings-*`, `palette-*`)
149
+ are copied automatically when the installed animation needs them.
117
150
 
118
151
  Copyable helpers (the CLI follows them automatically): `src/lib/utils.ts`,
119
152
  `src/lib/video.ts`, `src/lib/vtt.ts`, `src/lib/date.ts`, `src/lib/uploader.ts`, `src/lib/color.ts`,