@aphexcms/ui 0.8.6 → 0.9.0-next.20261109083516
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
-
import { cn, type WithElementRef } from '../../../utils.js';
|
|
4
|
+
import { cn, randomId, type WithElementRef } from '../../../utils.js';
|
|
5
5
|
import { useMessageScroller } from './message-scroller-context.svelte.js';
|
|
6
6
|
|
|
7
7
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
onMount(() => {
|
|
23
23
|
if (!ref) return;
|
|
24
|
-
const id = messageId ??
|
|
24
|
+
const id = messageId ?? randomId();
|
|
25
25
|
const unregister = state.registerItem(id, ref, scrollAnchor);
|
|
26
26
|
const observer = new IntersectionObserver(
|
|
27
27
|
([entry]) => state.setItemVisible(id, entry?.isIntersecting ?? false),
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { type ClassValue } from 'clsx';
|
|
2
2
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
|
+
/**
|
|
4
|
+
* A v4 UUID that also works outside a secure context.
|
|
5
|
+
*
|
|
6
|
+
* `crypto.randomUUID` is only defined on HTTPS or `localhost`, so opening the
|
|
7
|
+
* dev server's Network URL (`vite dev --host` prints one) from a phone or
|
|
8
|
+
* another machine leaves it `undefined` and every call throws. Kept here rather
|
|
9
|
+
* than imported from `@aphexcms/cms-core` because the dependency runs the other
|
|
10
|
+
* way — cms-core consumes this package.
|
|
11
|
+
*/
|
|
12
|
+
export declare function randomId(): string;
|
|
3
13
|
export type WithoutChild<T> = T extends {
|
|
4
14
|
child?: any;
|
|
5
15
|
} ? Omit<T, 'child'> : T;
|
package/dist/utils.js
CHANGED
|
@@ -3,3 +3,26 @@ import { twMerge } from 'tailwind-merge';
|
|
|
3
3
|
export function cn(...inputs) {
|
|
4
4
|
return twMerge(clsx(inputs));
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* A v4 UUID that also works outside a secure context.
|
|
8
|
+
*
|
|
9
|
+
* `crypto.randomUUID` is only defined on HTTPS or `localhost`, so opening the
|
|
10
|
+
* dev server's Network URL (`vite dev --host` prints one) from a phone or
|
|
11
|
+
* another machine leaves it `undefined` and every call throws. Kept here rather
|
|
12
|
+
* than imported from `@aphexcms/cms-core` because the dependency runs the other
|
|
13
|
+
* way — cms-core consumes this package.
|
|
14
|
+
*/
|
|
15
|
+
export function randomId() {
|
|
16
|
+
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
|
|
17
|
+
return crypto.randomUUID();
|
|
18
|
+
}
|
|
19
|
+
if (typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function') {
|
|
20
|
+
const bytes = crypto.getRandomValues(new Uint8Array(16));
|
|
21
|
+
const hex = Array.from(bytes, (byte, index) => {
|
|
22
|
+
const value = index === 6 ? (byte & 0x0f) | 0x40 : index === 8 ? (byte & 0x3f) | 0x80 : byte;
|
|
23
|
+
return value.toString(16).padStart(2, '0');
|
|
24
|
+
}).join('');
|
|
25
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
26
|
+
}
|
|
27
|
+
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
28
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aphexcms/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0-next.20261109083516",
|
|
4
4
|
"description": "Shared UI components for Aphex CMS (shadcn-svelte)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -201,30 +201,29 @@
|
|
|
201
201
|
"src/app.css"
|
|
202
202
|
],
|
|
203
203
|
"peerDependencies": {
|
|
204
|
-
"bits-ui": "^2.14.4",
|
|
205
|
-
"clsx": "^2.1.1",
|
|
206
204
|
"svelte": "^5.44.0",
|
|
207
|
-
"
|
|
208
|
-
"tailwind-variants": "^3.2.2"
|
|
205
|
+
"tailwindcss": "^4.3.0"
|
|
209
206
|
},
|
|
210
207
|
"devDependencies": {
|
|
211
|
-
"@internationalized/date": "^3.12.2",
|
|
212
|
-
"@lucide/svelte": "^0.561.0",
|
|
213
208
|
"@sveltejs/kit": "^2.70.2",
|
|
214
209
|
"@sveltejs/package": "^2.5.6",
|
|
215
210
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
216
211
|
"@tailwindcss/vite": "^4.3.0",
|
|
217
|
-
"
|
|
212
|
+
"svelte": "^5.55.5",
|
|
213
|
+
"tailwindcss": "^4.3.0",
|
|
214
|
+
"typescript": "^5.9.3",
|
|
215
|
+
"vite": "^8.1.5"
|
|
216
|
+
},
|
|
217
|
+
"dependencies": {
|
|
218
|
+
"@internationalized/date": "^3.12.2",
|
|
219
|
+
"@lucide/svelte": "^0.561.0",
|
|
220
|
+
"bits-ui": "^2.14.4",
|
|
218
221
|
"clsx": "^2.1.1",
|
|
219
222
|
"mode-watcher": "^1.1.0",
|
|
220
|
-
"svelte": "^5.55.5",
|
|
221
223
|
"svelte-sonner": "^1.0.7",
|
|
222
224
|
"tailwind-merge": "^3.4.0",
|
|
223
225
|
"tailwind-variants": "^3.2.2",
|
|
224
|
-
"
|
|
225
|
-
"tw-animate-css": "^1.4.0",
|
|
226
|
-
"typescript": "^5.9.3",
|
|
227
|
-
"vite": "^8.1.5"
|
|
226
|
+
"tw-animate-css": "^1.4.0"
|
|
228
227
|
},
|
|
229
228
|
"scripts": {
|
|
230
229
|
"dev": "svelte-package --watch",
|
package/src/app.css
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
@import 'tw-animate-css';
|
|
4
4
|
|
|
5
|
+
/* The components, wherever this package was installed: src here, dist once published. */
|
|
6
|
+
@source './lib/**/*.{html,js,svelte,ts}';
|
|
7
|
+
@source '../dist/**/*.{html,js,svelte,ts}';
|
|
8
|
+
|
|
5
9
|
@custom-variant dark (&:is(.dark *));
|
|
6
10
|
|
|
7
11
|
/* bits-ui sets data-orientation on slider/progress parts; the shadcn components use
|