@lumiastream/ui 0.0.2-alpha.5 → 0.0.2-alpha.7
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 +81 -0
- package/dist/index.d.ts +18 -1
- package/dist/index.js +34 -3
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Lumia UI Kit
|
|
2
|
+
|
|
3
|
+
A modern, Tailwind‑powered component library used across the Lumia Stream ecosystem. It provides production‑ready React components, design tokens, and Storybook documentation—all published as `@lumiastream/ui`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ✨ Features
|
|
8
|
+
|
|
9
|
+
| Feature | Details |
|
|
10
|
+
| --------------------- | ----------------------------------------------------- |
|
|
11
|
+
| **React 18 → 19** | Built and typed for the latest React majors. |
|
|
12
|
+
| **Tailwind CSS 4** | Utility‑first styling with full theme access. |
|
|
13
|
+
| **TypeScript first** | 100 % typed public API (`.d.ts` included). |
|
|
14
|
+
| **Storybook 9** | Live docs with interactive playgrounds & a11y checks. |
|
|
15
|
+
| **ESM + CJS bundles** | Works in every modern build tool. |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 🔧 Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm i @lumiastream/ui
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
> **Peer dependencies**
|
|
26
|
+
>
|
|
27
|
+
> - React ≥ 18.0 < 20 (`^18 || ^19`)
|
|
28
|
+
> - Tailwind CSS is _already compiled_—you do **not** need Tailwind in the host app unless you want to extend the theme.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 🚀 Quick Start
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
// App.tsx
|
|
36
|
+
import { LSButton } from "@lumiastream/ui";
|
|
37
|
+
|
|
38
|
+
export default function App() {
|
|
39
|
+
return <LSButton variant="primary" label="Click Me" />;
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 📚 Storybook Docs
|
|
46
|
+
|
|
47
|
+
Run a fully interactive playground locally:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pnpm storybook
|
|
51
|
+
open http://localhost:6006
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The public Storybook for the latest release lives at [https://ui.lumiastream.com](https://ui.lumiastream.com).
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 🏗️ Building from source
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# clone & bootstrap
|
|
62
|
+
pnpm install
|
|
63
|
+
|
|
64
|
+
# compile library (ESM + CJS + types) and Tailwind sheet
|
|
65
|
+
pnpm build
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Artifacts land in `dist/` and are what gets published to npm.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 🤝 Running live
|
|
73
|
+
|
|
74
|
+
1. Run `pnpm storybook` for hot‑reloading Storybook and `pnpm watch` for the library bundle.
|
|
75
|
+
2. Commit with Conventional Commits (`feat:`, `fix:` …) so the release pipeline can auto‑generate changelogs.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 🪪 License
|
|
80
|
+
|
|
81
|
+
ISC © Lumia Stream LLC
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { CompletionContext } from '@codemirror/autocomplete';
|
|
2
3
|
|
|
3
4
|
interface LSButtonProps {
|
|
4
5
|
/** Is this the principal call to action on the page? */
|
|
@@ -15,4 +16,20 @@ interface LSButtonProps {
|
|
|
15
16
|
/** Primary UI component for user interaction */
|
|
16
17
|
declare const LSButton: ({ primary, size, backgroundColor, label, ...props }: LSButtonProps) => react_jsx_runtime.JSX.Element;
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
declare function allowedVariableCompletion(context: CompletionContext, variables: Record<string, any>, extraOptions: {
|
|
20
|
+
label: string;
|
|
21
|
+
displayLabel: string;
|
|
22
|
+
type: string;
|
|
23
|
+
info: string;
|
|
24
|
+
}[]): {
|
|
25
|
+
from: number;
|
|
26
|
+
options: {
|
|
27
|
+
label: string;
|
|
28
|
+
displayLabel: string;
|
|
29
|
+
type: string;
|
|
30
|
+
info: string;
|
|
31
|
+
}[];
|
|
32
|
+
validFor: RegExp;
|
|
33
|
+
} | null;
|
|
34
|
+
|
|
35
|
+
export { LSButton, type LSButtonProps, allowedVariableCompletion };
|
package/dist/index.js
CHANGED
|
@@ -40,14 +40,45 @@ var LSButton = ({
|
|
|
40
40
|
className: [
|
|
41
41
|
"bg-blue-500",
|
|
42
42
|
size === "small" ? "px-3 py-1 text-sm" : size === "large" ? "px-6 py-3 text-lg" : "px-4 py-2 text-base",
|
|
43
|
-
mode
|
|
43
|
+
mode,
|
|
44
|
+
backgroundColor ? `bg-[${backgroundColor}]` : ""
|
|
44
45
|
].join(" "),
|
|
45
|
-
style: { backgroundColor },
|
|
46
46
|
...props,
|
|
47
47
|
children: label
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
50
|
};
|
|
51
|
+
|
|
52
|
+
// src/utils/allowedVariableCompletion.ts
|
|
53
|
+
function allowedVariableCompletion(context, variables, extraOptions) {
|
|
54
|
+
const before = context.state.sliceDoc(0, context.pos);
|
|
55
|
+
const after = context.state.sliceDoc(context.pos, context.pos + 2);
|
|
56
|
+
const wordMatch = /(\w*)$/.exec(before);
|
|
57
|
+
if (!wordMatch) return null;
|
|
58
|
+
const word = wordMatch[1];
|
|
59
|
+
const from = context.pos - word.length;
|
|
60
|
+
const openCount = before.match(/({+)\s*\w*$/)?.[1].length ?? 0;
|
|
61
|
+
const closeCount = after.startsWith("}}") ? 2 : after.startsWith("}") ? 1 : 0;
|
|
62
|
+
const openNeeded = Math.max(0, 2 - openCount);
|
|
63
|
+
const closeNeeded = Math.max(0, 2 - closeCount);
|
|
64
|
+
const braceWrap = (v) => `${"{".repeat(openNeeded)}${v}${"}".repeat(closeNeeded)}`;
|
|
65
|
+
const options = [
|
|
66
|
+
...Object.keys(variables).map((variable) => ({
|
|
67
|
+
label: braceWrap(variable),
|
|
68
|
+
displayLabel: variable,
|
|
69
|
+
type: "variable",
|
|
70
|
+
info: "A variable in Lumia Stream"
|
|
71
|
+
})),
|
|
72
|
+
...extraOptions
|
|
73
|
+
];
|
|
74
|
+
return {
|
|
75
|
+
from,
|
|
76
|
+
options,
|
|
77
|
+
validFor: /^[\w$]*$/
|
|
78
|
+
// keep list open while typing identifiers
|
|
79
|
+
};
|
|
80
|
+
}
|
|
51
81
|
export {
|
|
52
|
-
LSButton
|
|
82
|
+
LSButton,
|
|
83
|
+
allowedVariableCompletion
|
|
53
84
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumiastream/ui",
|
|
3
|
-
"version": "0.0.2-alpha.
|
|
3
|
+
"version": "0.0.2-alpha.7",
|
|
4
4
|
"author": "Lumia Stream",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"description": "Lumia UI Kit",
|
|
@@ -21,14 +21,17 @@
|
|
|
21
21
|
"start": "storybook dev -p 6006",
|
|
22
22
|
"build": "tsup src/index.ts",
|
|
23
23
|
"build-storybook": "storybook build",
|
|
24
|
+
"watch": "tsup src/index.ts --watch",
|
|
24
25
|
"release": "changeset && changeset tag && pnpm build && pnpm publish",
|
|
25
26
|
"prepublishOnly": "pnpm build"
|
|
26
27
|
},
|
|
27
28
|
"peerDependencies": {
|
|
28
|
-
"react": "^18.0.0 || ^19.0.0",
|
|
29
|
-
"react-dom": "^18.0.0 || ^19.0.0"
|
|
29
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
30
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
31
|
+
"@codemirror/autocomplete": "^6.0.0"
|
|
30
32
|
},
|
|
31
33
|
"devDependencies": {
|
|
34
|
+
"@codemirror/autocomplete": "^6.0.0",
|
|
32
35
|
"@storybook/builder-vite": "^9.0.15",
|
|
33
36
|
"@storybook/react-vite": "^9.0.15",
|
|
34
37
|
"@tailwindcss/vite": "^4.1.11",
|