Compare commits

...

69 Commits

Author SHA1 Message Date
Trisha Lim
ebb17e253f make dev generate app.js instead of jazz-inspector.js 2025-03-14 13:15:23 +07:00
Trisha Lim
1ea69dbcc4 add basic json viewer 2025-03-14 12:54:37 +07:00
Trisha Lim
0fd5ec69d3 add covalue search to nav 2025-03-14 12:49:27 +07:00
Trisha Lim
ed9b863040 bare minimum dark styles 2025-03-14 12:19:54 +07:00
Trisha Lim
19de3bb4de add inspector to chat app 2025-03-14 11:43:40 +07:00
Trisha Lim
7b808802c1 replace indigo with blue 2025-03-14 11:38:07 +07:00
Trisha Lim
41f1cbafc3 remove javascript hover styles 2025-03-14 11:36:09 +07:00
Trisha Lim
1a98d9e16c match colors to jazz brand 2025-03-14 11:35:25 +07:00
Trisha Lim
203584df2d add button label 2025-03-14 11:28:25 +07:00
Trisha Lim
29f71d0e30 rewrite styles to tailwind 2025-03-14 11:27:32 +07:00
Trisha Lim
9883eb2c59 install twind 2025-03-14 11:26:51 +07:00
Trisha Lim
ecbf6d0248 add inspector to version history example 2025-03-14 11:15:27 +07:00
Guido D'Orsi
f44a4fa7a2 Merge pull request #1654 from garden-co/feat/inspector-position
Custom positioning of inspector widget button
2025-03-13 14:34:46 +01:00
Guido D'Orsi
b72d478ba1 Merge pull request #1625 from garden-co/music-player-ux
Music player: Allow deleting tracks and playlists
2025-03-13 13:08:18 +01:00
Benjamin S. Leveritt
b2bdfc702e Merge pull request #1645 from garden-co/feat/filestream-example-to-examples-page
add filestream example to examples page
2025-03-13 08:13:56 +00:00
Trisha Lim
dc3d6a28f6 add docs for inspector button position 2025-03-13 12:05:40 +07:00
Trisha Lim
43e339a4bc Custom positioning of inspector widget button 2025-03-13 11:35:29 +07:00
Guido D'Orsi
e1a66fd76b Merge pull request #1651 from garden-co/fix-message-not-readable
fix(chat-example): render "message not readable" if a message is not readable
2025-03-12 22:31:06 +01:00
pax-k
2074e45158 chore: changeset 2025-03-12 19:10:42 +02:00
pax-k
b06dac36a5 fix(chat-example): render "message not readable" if a message is not readable #1646 2025-03-12 19:08:11 +02:00
Benjamin S. Leveritt
b3b12a020e Merge pull request #1648 from garden-co/1643-add-colistapplydiff-tests
Fixes CoList.splice to support insertions at start
2025-03-12 14:13:24 +00:00
Benjamin S. Leveritt
a91f343d6d Adds changeset 2025-03-12 14:12:58 +00:00
Benjamin S. Leveritt
59a7ae94b4 Add comment 2025-03-12 14:03:48 +00:00
Benjamin S. Leveritt
c74f1aea8d Fixes CoList.splice to support insertions at start 2025-03-12 13:59:09 +00:00
Trisha Lim
debdb6dccc update readme of filestream example 2025-03-12 20:54:14 +07:00
Trisha Lim
11a952d45b add filestream example to examples page 2025-03-12 20:51:33 +07:00
Guido D'Orsi
3df07327f1 Merge pull request #1641 from garden-co/ref-assign-validation
fix: throw an error when assigning invalid values to ref fields
2025-03-12 14:49:01 +01:00
Guido D'Orsi
c66a3fb8e9 Merge pull request #1640 from garden-co/jmsv/1632/colist-sort-tests
CoList sort tests
2025-03-11 17:26:36 +01:00
Guido D'Orsi
57a3dbe2b4 fix: throw an error when assigning invalid values to ref fields 2025-03-11 17:08:11 +01:00
James Vickery
3f1cbcdaee add another push + sort + expect 2025-03-11 15:50:37 +00:00
James Vickery
bd1bf3fd2c colist sort tests 2025-03-11 15:46:13 +00:00
Anselm Eickhoff
065e84fc7d Merge pull request #1608 from garden-co/even-simpler-pricing 2025-03-11 15:43:58 +00:00
Anselm
341b056e09 Track fake sign ups and slight layout change 2025-03-11 14:41:40 +00:00
Anselm Eickhoff
75bf523b6a Merge pull request #1639 from garden-co/fix/missing-shadow-hero
fix(home): missing shadow on create-jazz-app section
2025-03-11 14:19:49 +00:00
Trisha Lim
2ad11eff11 fix(home): missing shadow on create-jazz-app section 2025-03-11 21:08:47 +07:00
Anselm Eickhoff
2bfab83df6 Merge pull request #1615 from garden-co/deemphasize-local-first
De-emphasise local-first on homepage
2025-03-11 13:42:34 +00:00
Benjamin S. Leveritt
9526674a95 Addressses feedback, adds backticks 2025-03-11 20:33:12 +07:00
Benjamin S. Leveritt
4f2424f5e8 Updates CoList docs to call out Deleting Items
Fixes #1602
2025-03-11 20:33:12 +07:00
Anselm
58c7305e47 More explanation improvements 2025-03-11 13:33:09 +00:00
Anselm
c05dd58c7d Slight wording changes 2025-03-11 13:25:25 +00:00
Anselm
cc3d31fc3b Address PR comments 2025-03-11 13:14:24 +00:00
James Vickery
83433fcfe2 Merge pull request #1637 from garden-co/jmsv/1635/registered-account-types
Use RegisteredAccount type
2025-03-11 12:33:35 +00:00
Anselm Eickhoff
7cdfc62593 Merge pull request #1634 from garden-co/chore/jazz-inspector-changeset
add changeset for #1591
2025-03-11 12:33:27 +00:00
James Vickery
a717754bb4 patch 2025-03-11 12:30:33 +00:00
James Vickery
1617940ce2 RegisteredAccount type for by props 2025-03-11 12:15:17 +00:00
Guido D'Orsi
d8508c260e Merge pull request #1636 from garden-co/show-account-registration-in-more-places
Show Account registration in more places in docs
2025-03-11 11:13:52 +01:00
Anselm Eickhoff
7e754cae9d Show Account registration in more places 2025-03-11 09:57:39 +00:00
Benjamin S. Leveritt
5e7b59293d Merge pull request #1595 from garden-co/817-add-minimal-filestream-example
adds filestream example
2025-03-11 08:53:56 +00:00
Trisha Lim
d133d4724d add changeset 2025-03-11 10:52:49 +07:00
3f765d5e-ac23-4170-97a5-68b8feee155b
e6ef9b6819 Update page.tsx 2025-03-11 10:51:13 +07:00
Benjamin S. Leveritt
91f9ea1823 Prioritise specific framework pages over vanilla 2025-03-11 10:39:55 +07:00
Benjamin S. Leveritt
3404fa99bf Bail on typing item.done 2025-03-11 10:39:55 +07:00
Benjamin S. Leveritt
4bdf0b064b Add fallback for frameworks we have yet to provide 2025-03-11 10:39:55 +07:00
Benjamin S. Leveritt
1e1372bb71 Adds VanillaJS to the Framework selector 2025-03-11 10:39:55 +07:00
Anselm
b1be0bbdf3 Fix more NextJS issues 2025-03-10 13:36:54 +00:00
Anselm
d4f2f6fd99 Fix NextJS issues 2025-03-10 13:32:48 +00:00
Anselm
f901c4628d More improvements and fixes 2025-03-10 13:27:12 +00:00
Nikita
c970eec586 allow deleting tracks and playlists 2025-03-10 14:08:50 +01:00
Anselm
ca909a09a5 First pass 2025-03-07 11:00:37 +00:00
Trisha Lim
ad9afc14ba use equal col widths 2025-03-07 14:26:13 +07:00
Nikos Papadopoulos
846a22fb87 moves the apikey into src/apiKey.ts 2025-03-06 18:16:21 +00:00
Nikos Papadopoulos
50133de036 updates vercel configuration 2025-03-06 17:26:26 +00:00
Nikos Papadopoulos
8eff068bdf adds drag and drop upload feature 2025-03-06 17:26:26 +00:00
Nikos Papadopoulos
77383b20c6 switches sync peer from localhost to cloud 2025-03-06 17:26:26 +00:00
Nikos Papadopoulos
4965807ce9 adds filestream example 2025-03-06 17:26:12 +00:00
Anselm
b424ff04fb Remove add-ons 2025-03-06 17:16:48 +00:00
Anselm
0f4bf6ab77 Merge branch 'main' into even-simpler-pricing 2025-03-06 17:10:25 +00:00
Anselm
65336464fc Simplified 2025-01-07 14:22:22 +00:00
Anselm
a628f5cc97 Even simpler pricing 2025-01-06 16:23:05 +00:00
93 changed files with 2767 additions and 979 deletions

View File

@@ -0,0 +1,5 @@
---
"jazz-inspector": patch
---
add z-index of 1 to inspector

View File

@@ -0,0 +1,5 @@
---
"jazz-tools": patch
---
Throw when assigning invalid values to ref fields

View File

@@ -0,0 +1,5 @@
---
"jazz-tools": patch
---
Use RegisteredAccount types for `by` props

View File

@@ -0,0 +1,5 @@
---
"jazz-example-chat": patch
---
In the chat app example, show a "Message not readable" placeholder, if messages from a chat list are not readable by the user.

View File

@@ -0,0 +1,5 @@
---
"jazz-tools": patch
---
Fixes coList.splice to handle insertions at start of list

View File

@@ -16,6 +16,7 @@
"clsx": "^2.0.0",
"hash-slash": "workspace:*",
"jazz-browser-media-images": "workspace:*",
"jazz-inspector": "workspace:*",
"jazz-react": "workspace:*",
"jazz-tools": "workspace:*",
"lucide-react": "^0.274.0",

View File

@@ -1,6 +1,7 @@
import { apiKey } from "@/apiKey.ts";
import { getRandomUsername, inIframe, onChatLoad } from "@/util.ts";
import { useIframeHashRouter } from "hash-slash";
import { JazzInspector } from "jazz-inspector";
import { JazzProvider, useAccount } from "jazz-react";
import { Group, ID } from "jazz-tools";
import { StrictMode } from "react";
@@ -61,6 +62,7 @@ createRoot(document.getElementById("root")!).render(
defaultProfileName={defaultProfileName}
>
<App />
<JazzInspector />
</JazzProvider>
</StrictMode>
</ThemeProvider>,

View File

@@ -1,6 +1,6 @@
import { createImage } from "jazz-browser-media-images";
import { useCoState } from "jazz-react";
import { ID } from "jazz-tools";
import { useAccount, useCoState } from "jazz-react";
import { Account, ID } from "jazz-tools";
import { useState } from "react";
import { Chat, Message } from "./schema.ts";
import {
@@ -17,6 +17,7 @@ import {
} from "./ui.tsx";
export function ChatScreen(props: { chatID: ID<Chat> }) {
const account = useAccount();
const chat = useCoState(Chat, props.chatID, [{}]);
const [showNLastMessages, setShowNLastMessages] = useState(30);
@@ -47,7 +48,7 @@ export function ChatScreen(props: { chatID: ID<Chat> }) {
chat
.slice(-showNLastMessages)
.reverse() // this plus flex-col-reverse on ChatBody gives us scroll-to-bottom behavior
.map((msg) => <ChatBubble msg={msg} key={msg.id} />)
.map((msg) => <ChatBubble me={account.me} msg={msg} key={msg.id} />)
) : (
<EmptyChatMessage />
)}
@@ -74,7 +75,20 @@ export function ChatScreen(props: { chatID: ID<Chat> }) {
);
}
function ChatBubble(props: { msg: Message }) {
function ChatBubble(props: { me: Account; msg: Message }) {
if (!props.me.canRead(props.msg)) {
return (
<BubbleContainer fromMe={false}>
<BubbleBody fromMe={false}>
<BubbleText
text="Message not readable"
className="text-gray-500 italic"
/>
</BubbleBody>
</BubbleContainer>
);
}
const lastEdit = props.msg._edits.text;
const fromMe = lastEdit.by?.isMe;
const { text, image } = props.msg;

View File

@@ -70,8 +70,12 @@ export function BubbleBody(props: {
);
}
export function BubbleText(props: { text: string }) {
return <p className="px-2 leading-relaxed">{props.text}</p>;
export function BubbleText(props: { text: string; className?: string }) {
return (
<p className={clsx("px-2 leading-relaxed", props.className)}>
{props.text}
</p>
);
}
export function BubbleImage(props: { image: ImageDefinition }) {

28
examples/filestream/.gitignore vendored Normal file
View File

@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
/test-results/
/playwright-report/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
playwright-report

View File

@@ -0,0 +1,267 @@
# jazz-tailwind-demo-auth-starter
## 0.0.52
### Patch Changes
- Updated dependencies [2f99de0]
- jazz-tools@0.10.15
- jazz-react@0.10.15
## 0.0.51
### Patch Changes
- Updated dependencies [75211e3]
- jazz-tools@0.10.14
- jazz-react@0.10.14
## 0.0.50
### Patch Changes
- Updated dependencies [07feedd]
- jazz-tools@0.10.13
- jazz-react@0.10.13
## 0.0.49
### Patch Changes
- Updated dependencies [4612e05]
- jazz-tools@0.10.12
- jazz-react@0.10.12
## 0.0.48
### Patch Changes
- jazz-react@0.10.9
## 0.0.47
### Patch Changes
- Updated dependencies [2fb6428]
- jazz-tools@0.10.8
- jazz-react@0.10.8
## 0.0.46
### Patch Changes
- Updated dependencies [1136d9b]
- Updated dependencies [0eed228]
- jazz-react@0.10.7
- jazz-tools@0.10.7
## 0.0.45
### Patch Changes
- Updated dependencies [1d71ca1]
- Updated dependencies [ada802b]
- jazz-react@0.10.6
- jazz-tools@0.10.6
## 0.0.44
### Patch Changes
- Updated dependencies [59ff77e]
- jazz-tools@0.10.5
- jazz-react@0.10.5
## 0.0.43
### Patch Changes
- jazz-react@0.10.4
- jazz-tools@0.10.4
## 0.0.42
### Patch Changes
- Updated dependencies [d8582fc]
- jazz-tools@0.10.3
- jazz-react@0.10.3
## 0.0.41
### Patch Changes
- jazz-react@0.10.2
- jazz-tools@0.10.2
## 0.0.40
### Patch Changes
- Updated dependencies [5a63cba]
- jazz-tools@0.10.1
- jazz-react@0.10.1
## 0.0.39
### Patch Changes
- Updated dependencies [498954f]
- Updated dependencies [d42c2aa]
- Updated dependencies [dd03464]
- Updated dependencies [b426342]
- jazz-react@0.10.0
- jazz-tools@0.10.0
## 0.0.38
### Patch Changes
- jazz-react@0.9.23
- jazz-tools@0.9.23
## 0.0.37
### Patch Changes
- jazz-react@0.9.22
## 0.0.36
### Patch Changes
- Updated dependencies [1be017d]
- jazz-tools@0.9.21
- jazz-react@0.9.21
## 0.0.35
### Patch Changes
- Updated dependencies [b01cc1f]
- jazz-tools@0.9.20
- jazz-react@0.9.20
## 0.0.34
### Patch Changes
- jazz-react@0.9.19
- jazz-tools@0.9.19
## 0.0.33
### Patch Changes
- jazz-react@0.9.18
- jazz-tools@0.9.18
## 0.0.32
### Patch Changes
- Updated dependencies [c2ca1fe]
- Updated dependencies [1227047]
- jazz-tools@0.9.17
- jazz-react@0.9.17
## 0.0.31
### Patch Changes
- Updated dependencies [24b3b6a]
- jazz-tools@0.9.16
- jazz-react@0.9.16
## 0.0.30
### Patch Changes
- Updated dependencies [7491711]
- jazz-tools@0.9.15
- jazz-react@0.9.15
## 0.0.29
### Patch Changes
- Updated dependencies [3df93cc]
- jazz-tools@0.9.14
- jazz-react@0.9.14
## 0.0.28
### Patch Changes
- jazz-react@0.9.13
- jazz-tools@0.9.13
## 0.0.27
### Patch Changes
- jazz-react@0.9.12
- jazz-tools@0.9.12
## 0.0.26
### Patch Changes
- jazz-react@0.9.11
- jazz-tools@0.9.11
## 0.0.25
### Patch Changes
- Updated dependencies [5e83864]
- jazz-react@0.9.10
- jazz-tools@0.9.10
## 0.0.24
### Patch Changes
- Updated dependencies [8eb9247]
- jazz-tools@0.9.9
- jazz-react@0.9.9
## 0.0.23
### Patch Changes
- Updated dependencies [d1d773b]
- jazz-tools@0.9.8
- jazz-react@0.9.8
## 0.0.22
### Patch Changes
- jazz-react@0.9.4
## 0.0.21
### Patch Changes
- Updated dependencies [1b71969]
- jazz-react@0.9.1
- jazz-tools@0.9.1
## 0.0.20
### Patch Changes
- Updated dependencies [956a4d1]
- Updated dependencies [8eda792]
- jazz-react@0.9.0
- jazz-tools@0.9.0
## 0.0.19
### Patch Changes
- Updated dependencies [dc62b95]
- Updated dependencies [1de26f8]
- jazz-tools@0.8.51
- jazz-react@0.8.51

View File

@@ -0,0 +1,66 @@
# File upload example with Jazz and React
This is an example of how to upload and render images with Jazz.
Live version: https://file-upload-demo.jazz.tools
## Getting started
You can either
1. Clone the jazz repository, and run the app within the monorepo.
2. Or create a new Jazz project using this example as a template.
### Using the example as a template
Create a new Jazz project, and use this example as a template.
```bash
npx create-jazz-app@latest --example file-upload --project-name file-upload
```
Go to the new project directory.
```bash
cd file-upload
```
Run the dev server.
```bash
npm run dev
```
### Using the monorepo
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
Clone the jazz repository.
```bash
git clone https://github.com/garden-co/jazz.git
```
Install and build dependencies.
```bash
pnpm i && npx turbo build
```
Go to the example directory.
```bash
cd jazz/examples/file-upload/
```
Start the dev server.
```bash
pnpm dev
```
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
## Questions / problems / feedback
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
## Configuration: sync server
By default, the example app uses [Jazz Cloud](https://jazz.tools/cloud) (`wss://cloud.jazz.tools`) - so cross-device use, invites and collaboration should just work.
You can also run a local sync server by running `npx jazz-run sync` and adding the query param `?sync=ws://localhost:4200` to the URL of the example app (for example: `http://localhost:5173/?peer=ws://localhost:4200`), or by setting the `sync` parameter of `JazzProvider` component in [./src/main.tsx](./src/main.tsx).

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en" class="h-full">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Jazz | React + Demo Auth + Tailwind</title>
</head>
<body class="h-full flex flex-col">
<div id="root" class="align-self-center flex-1"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

View File

@@ -0,0 +1,32 @@
{
"name": "filestream",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"preview": "vite preview",
"format-and-lint": "biome check .",
"format-and-lint:fix": "biome check . --write"
},
"dependencies": {
"jazz-react": "workspace:*",
"jazz-tools": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.3",
"autoprefixer": "^10.4.20",
"globals": "^15.11.0",
"is-ci": "^3.0.1",
"postcss": "^8.5.3",
"tailwindcss": "^3.4.17",
"typescript": "~5.6.2",
"vite": "^6.0.11"
}
}

View File

@@ -0,0 +1,46 @@
import { defineConfig, devices } from "@playwright/test";
import isCI from "is-ci";
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: "./tests",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: isCI,
/* Retry on CI only */
retries: isCI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: isCI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: "http://localhost:5173/",
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
permissions: ["clipboard-read", "clipboard-write"],
},
/* Configure projects for major browsers */
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
/* Run your local dev server before starting the tests */
webServer: [
{
command: "pnpm preview --port 5173",
url: "http://localhost:5173/",
reuseExistingServer: !isCI,
},
],
});

View File

@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

View File

@@ -0,0 +1,37 @@
import { FileWidget } from "./FileWidget.js";
import { Logo } from "./Logo.tsx";
function App() {
return (
<>
<main className="container mt-16 flex flex-col gap-8">
<Logo />
<FileWidget />
<p className="text-center">
Edit the form above,{" "}
<button
type="button"
onClick={() => window.location.reload()}
className="font-semibold underline"
>
refresh
</button>{" "}
this page, and see your changes persist.
</p>
<p className="text-center my-16">
Go to{" "}
<a
className="font-semibold underline"
href="https://jazz.tools/docs/react/guide"
>
jazz.tools/docs/react/guide
</a>{" "}
for a full tutorial.
</p>
</main>
</>
);
}
export default App;

View File

@@ -0,0 +1,269 @@
"use client";
import { useAccount } from "jazz-react";
import { FileStream } from "jazz-tools";
import { useRef, useState } from "react";
export function FileWidget() {
const inputRef = useRef<HTMLInputElement>(null);
const dragAndDropElementRef = useRef<HTMLDivElement>(null);
const [isUploading, setIsUploading] = useState(false);
const [progress, setProgress] = useState(0);
const [error, setError] = useState<string | null>(null);
const { me } = useAccount();
async function handleUpload(event: React.FormEvent) {
event.preventDefault();
setError(null);
if (!me?.profile) {
setError("User profile not found");
return;
}
setProgress(0);
const file = inputRef.current?.files?.[0];
if (!file) {
setError("Please select a file");
return;
}
try {
setIsUploading(true);
me.profile.file = await FileStream.createFromBlob(file, {
onProgress: (p) => setProgress(Math.round(p * 100)),
});
} catch (error) {
setError(
error instanceof Error ? error.message : "Failed to upload file",
);
console.error("Error uploading file:", error);
} finally {
setIsUploading(false);
}
}
function handleDelete() {
if (!me?.profile) return;
delete me.profile?.file;
}
async function handleDownload() {
if (!me?.profile) return;
const file = me.profile.file;
if (!file) return;
try {
const blob = file.toBlob();
const url = URL.createObjectURL(blob || new Blob());
const a = document.createElement("a");
a.href = url;
a.download = file.id || "download";
a.click();
URL.revokeObjectURL(url);
} catch (error) {
console.error("Error downloading file:", error);
}
}
function formatFileSize(bytes?: number): string {
if (!bytes) return "0 Bytes";
const k = 1024;
const sizes = ["Bytes", "KB", "MB", "GB"];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
}
const onDragEnter = (e: React.DragEvent<HTMLDivElement>) => {
e.preventDefault();
e.stopPropagation();
dragAndDropElementRef?.current?.classList.replace(
"border-stone-400",
"border-blue-700",
);
};
const onDragOver = (e: React.DragEvent<HTMLDivElement>) => {
e.preventDefault();
e.stopPropagation();
dragAndDropElementRef?.current?.classList.replace(
"border-stone-400",
"border-blue-700",
);
};
const onDragLeave = (e: React.DragEvent<HTMLDivElement>) => {
e.preventDefault();
e.stopPropagation();
dragAndDropElementRef?.current?.classList.replace(
"border-blue-700",
"border-stone-400",
);
};
const onDrop = async (e: React.DragEvent<HTMLDivElement>) => {
e.preventDefault();
e.stopPropagation();
dragAndDropElementRef?.current?.classList.replace(
"border-blue-700",
"border-stone-400",
);
if (!me?.profile) {
setError("User profile not found");
return;
}
const droppedFiles = e.dataTransfer.files;
if (!droppedFiles || droppedFiles.length === 0) {
return;
}
const file = droppedFiles[0];
setProgress(0);
try {
setIsUploading(true);
me.profile.file = await FileStream.createFromBlob(file, {
onProgress: (p) => setProgress(Math.round(p * 100)),
});
} catch (error) {
setError(
error instanceof Error ? error.message : "Failed to upload file",
);
console.error("Error uploading file:", error);
} finally {
setIsUploading(false);
}
};
if (me?.profile?.file == null) {
return (
<div className="flex flex-col gap-4">
<div
className="flex flex-col border-2 border-dashed border-stone-400 h-48 items-center justify-center bg-stone-100 m-5 rounded-md"
ref={dragAndDropElementRef}
onDragEnter={onDragEnter}
onDragOver={onDragOver}
onDragLeave={onDragLeave}
onDrop={onDrop}
>
<p>Drag & drop your file here</p>
</div>
<form onSubmit={handleUpload} className="flex gap-2">
<input
className="bg-stone-100 py-1.5 px-2 text-sm rounded-md w-4/5"
ref={inputRef}
type="file"
accept="file"
onChange={() => setError(null)}
disabled={isUploading}
/>
<button
type="submit"
className="bg-stone-100 py-1.5 px-3 text-sm rounded-md disabled:opacity-50"
disabled={isUploading}
>
{isUploading ? `Uploading...` : "Upload file"}
</button>
</form>
{error && (
<div className="text-red-800 text-sm pl-4" role="alert">
{error}
</div>
)}
{isUploading && (
<div className="flex gap-2 items-center">
<div className="py-1.5 px-3 text-sm">Progress: {progress}%</div>
<div className="h-2 bg-stone-200 rounded-full flex-1">
<div
className="h-full bg-blue-500 rounded-full transition-all duration-300"
style={{ width: `${progress}%` }}
/>
</div>
</div>
)}
</div>
);
}
const fileData = me?.profile?.file?.getChunks();
const mimeType = fileData?.mimeType || "unknown";
return (
<div className="gap-2">
<div className="p-4">
<div className="space-y-2">
<div className="flex justify-between">
<span className="font-bold">File name</span>
<span>{fileData?.fileName}</span>
</div>
<div className="flex justify-between">
<span className="font-bold">Type</span>
<span>{mimeType}</span>
</div>
<div className="flex justify-between">
<span className="font-bold">Size</span>
<span>{formatFileSize(fileData?.totalSizeBytes)}</span>
</div>
</div>
</div>
<div className="flex gap-2 justify-end">
<button
className="bg-stone-100 py-1.5 px-3 text-sm rounded-md"
onClick={handleDelete}
>
Delete file
</button>
<button
className="bg-stone-100 py-1.5 px-3 text-sm rounded-md"
onClick={handleDownload}
>
Download file
</button>
</div>
<div className="w-full justify-center pt-8">
{fileData?.mimeType?.startsWith("image/") && (
<div className="flex justify-center">
<img
src={URL.createObjectURL(
me?.profile?.file?.toBlob() || new Blob(),
)}
alt="File preview"
className="max-w-xs mb-4"
/>
</div>
)}
{fileData?.mimeType?.startsWith("audio/") && (
<div className="flex justify-center">
<audio
src={URL.createObjectURL(
me?.profile?.file?.toBlob() || new Blob(),
)}
controls
className="w-full mb-4"
/>
</div>
)}
{fileData?.mimeType?.startsWith("video/") && (
<div className="flex justify-center">
<video
src={URL.createObjectURL(
me?.profile?.file?.toBlob() || new Blob(),
)}
controls
className="w-full mb-4"
/>
</div>
)}
</div>
</div>
);
}

View File

@@ -0,0 +1,21 @@
export function Logo() {
return (
<svg
viewBox="0 0 386 146"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="text-black w-48 mx-auto"
>
<path
d="M176.725 33.865H188.275V22.7H176.725V33.865ZM164.9 129.4H172.875C182.72 129.4 188.275 123.9 188.275 114.22V43.6H176.725V109.545C176.725 115.65 173.975 118.51 167.925 118.51H164.9V129.4ZM245.298 53.28C241.613 45.47 233.363 41.95 222.748 41.95C208.998 41.95 200.748 48.44 197.888 58.615L208.613 61.915C210.648 55.315 216.368 52.565 222.638 52.565C231.933 52.565 235.673 56.415 236.058 64.61C226.433 65.93 216.643 67.195 209.768 69.23C200.583 72.145 195.743 77.865 195.743 86.83C195.743 96.51 202.673 104.65 215.818 104.65C225.443 104.65 232.318 101.35 237.213 94.365V103H247.388V66.425C247.388 61.475 247.168 57.185 245.298 53.28ZM217.853 95.245C210.483 95.245 207.128 91.34 207.128 86.72C207.128 82.045 210.593 79.515 215.323 77.92C220.328 76.435 226.983 75.5 235.948 74.18C235.893 76.93 235.673 80.725 234.738 83.475C233.418 89.25 227.643 95.245 217.853 95.245ZM251.22 103H301.545V92.715H269.535L303.195 45.47V43.6H254.3V53.885H284.935L251.22 101.185V103ZM304.815 103H355.14V92.715H323.13L356.79 45.47V43.6H307.895V53.885H338.53L304.815 101.185V103Z"
fill="currentColor"
/>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M136.179 44.8277C136.179 44.8277 136.179 44.8277 136.179 44.8276V21.168C117.931 28.5527 97.9854 32.6192 77.0897 32.6192C65.1466 32.6192 53.5138 31.2908 42.331 28.7737V51.4076C42.331 51.4076 42.331 51.4076 42.331 51.4076V81.1508C41.2955 80.4385 40.1568 79.8458 38.9405 79.3915C36.1732 78.358 33.128 78.0876 30.1902 78.6145C27.2524 79.1414 24.5539 80.4419 22.4358 82.3516C20.3178 84.2613 18.8754 86.6944 18.291 89.3433C17.7066 91.9921 18.0066 94.7377 19.1528 97.2329C20.2991 99.728 22.2403 101.861 24.7308 103.361C27.2214 104.862 30.1495 105.662 33.1448 105.662H33.1455C33.6061 105.662 33.8365 105.662 34.0314 105.659C44.5583 105.449 53.042 96.9656 53.2513 86.4386C53.2534 86.3306 53.2544 86.2116 53.2548 86.0486H53.2552V85.7149L53.2552 85.5521V82.0762L53.2552 53.1993C61.0533 54.2324 69.0092 54.7656 77.0897 54.7656C77.6696 54.7656 78.2489 54.7629 78.8276 54.7574V110.696C77.792 109.983 76.6533 109.391 75.437 108.936C72.6697 107.903 69.6246 107.632 66.6867 108.159C63.7489 108.686 61.0504 109.987 58.9323 111.896C56.8143 113.806 55.3719 116.239 54.7875 118.888C54.2032 121.537 54.5031 124.283 55.6494 126.778C56.7956 129.273 58.7368 131.405 61.2273 132.906C63.7179 134.406 66.646 135.207 69.6414 135.207C70.1024 135.207 70.3329 135.207 70.5279 135.203C81.0548 134.994 89.5385 126.51 89.7478 115.983C89.7517 115.788 89.7517 115.558 89.7517 115.097V111.621L89.7517 54.3266C101.962 53.4768 113.837 51.4075 125.255 48.2397V80.9017C124.219 80.1894 123.081 79.5966 121.864 79.1424C119.097 78.1089 116.052 77.8384 113.114 78.3653C110.176 78.8922 107.478 80.1927 105.36 82.1025C103.242 84.0122 101.799 86.4453 101.215 89.0941C100.631 91.743 100.931 94.4886 102.077 96.9837C103.223 99.4789 105.164 101.612 107.655 103.112C110.145 104.612 113.073 105.413 116.069 105.413C116.53 105.413 116.76 105.413 116.955 105.409C127.482 105.2 135.966 96.7164 136.175 86.1895C136.179 85.9945 136.179 85.764 136.179 85.3029V81.8271L136.179 44.8277Z"
fill="#3313F7"
/>
</svg>
);
}

View File

@@ -0,0 +1 @@
export const apiKey = "filestream-example-jazz@garden.co";

View File

@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

View File

@@ -0,0 +1,29 @@
import { JazzProvider } from "jazz-react";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App.tsx";
import { apiKey } from "./apiKey.ts";
import "./index.css";
import { JazzAccount } from "./schema.ts";
// We use this to identify the app in the passkey auth
export const APPLICATION_NAME = "Jazz File Stream Example";
declare module "jazz-react" {
export interface Register {
Account: JazzAccount;
}
}
createRoot(document.getElementById("root")!).render(
<StrictMode>
<JazzProvider
sync={{
peer: `wss://cloud.jazz.tools/?key=${apiKey}`,
}}
AccountSchema={JazzAccount}
>
<App />
</JazzProvider>
</StrictMode>,
);

View File

@@ -0,0 +1,14 @@
import { Account, FileStream, Profile, co } from "jazz-tools";
export class JazzProfile extends Profile {
file = co.ref(FileStream, { optional: true });
}
export class JazzAccount extends Account {
profile = co.ref(JazzProfile);
/** The account migration is run on account creation and on every log-in.
* You can use it to set up the account root and any other initial CoValues you need.
*/
migrate(this: JazzAccount) {}
}

1
examples/filestream/src/vite-env.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
/// <reference types="vite/client" />

View File

@@ -0,0 +1,23 @@
import type { Config } from "tailwindcss";
const config: Config = {
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {
container: {
center: true,
padding: {
DEFAULT: "0.75rem",
sm: "1rem",
},
screens: {
lg: "600px",
xl: "600px",
},
},
},
},
plugins: [],
} as const;
export default config;

View File

@@ -0,0 +1,9 @@
import { expect, test } from "@playwright/test";
test("home page loads", async ({ page }) => {
await page.goto("/");
await expect(page.getByText("Welcome!")).toBeVisible();
await page.getByLabel("Name").fill("Bob");
await expect(page.getByText("Welcome, Bob!")).toBeVisible();
});

View File

@@ -0,0 +1,24 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2023", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"moduleResolution": "Bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["src"]
}

View File

@@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,
"moduleResolution": "Bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}

View File

@@ -0,0 +1,8 @@
{
"build": {
"env": {
"APP_NAME": "filestream"
}
},
"ignoreCommand": "node ../../ignore-vercel-build.js"
}

View File

@@ -0,0 +1,7 @@
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
});

View File

@@ -194,3 +194,16 @@ export async function onAnonymousAccountDiscarded(
me.root.rootPlaylist.tracks.push(track);
}
}
export async function deletePlaylist(playlistId: string) {
const { root } = await MusicaAccount.getMe().ensureLoaded({
root: {
playlists: [],
},
});
const index = root.playlists.findIndex((p) => p?.id === playlistId);
if (index > -1) {
root.playlists.splice(index, 1);
}
}

View File

@@ -52,6 +52,16 @@ export function MusicTrackRow({
removeTrackFromPlaylist(playlist, track);
}
function deleteTrack() {
if (!me || !track) return;
const tracks = me.root.rootPlaylist?.tracks;
if (!tracks) return;
const index = tracks.findIndex((t) => t?.id === trackId);
if (index !== -1) {
tracks.splice(index, 1);
}
}
return (
<li
className={
@@ -90,6 +100,15 @@ export function MusicTrackRow({
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem
key={`delete`}
onSelect={async () => {
if (!track) return;
deleteTrack();
}}
>
Delete
</DropdownMenuItem>
{playlists.map((playlist, index) => (
<Fragment key={index}>
<DropdownMenuItem

View File

@@ -1,4 +1,6 @@
import { deletePlaylist } from "@/4_actions";
import { useAccount } from "jazz-react";
import { Trash2 } from "lucide-react";
import { useNavigate, useParams } from "react-router";
import { LocalOnlyTag } from "./LocalOnlyTag";
@@ -24,6 +26,13 @@ export function SidePanel() {
navigate(`/playlist/${playlistId}`);
}
async function handleDeletePlaylist(playlistId: string) {
if (confirm("Are you sure you want to delete this playlist?")) {
await deletePlaylist(playlistId);
navigate(`/`);
}
}
return (
<aside className="w-64 p-6 bg-white overflow-y-auto">
<div className="flex items-center mb-1">
@@ -65,18 +74,28 @@ export function SidePanel() {
</a>
</li>
{me?.root.playlists.map((playlist, index) => (
<li key={index}>
<li
key={index}
className={`px-2 py-1 flex transition-all duration-300 rounded items-center justify-between ${
playlist.id === playlistId ? "bg-blue-100" : ""
}`}
>
<a
href="#"
className={`block px-2 py-1 text-sm rounded ${
playlist.id === playlistId
? "bg-blue-100 text-blue-600"
: "hover:bg-blue-100"
}`}
className={`w-full text-sm`}
onClick={(evt) => handlePlaylistClick(evt, playlist.id)}
>
{playlist.title}
</a>
{playlist.id === playlistId && (
<button
onClick={() => handleDeletePlaylist(playlist.id)}
className="ml-2 text-red-600 hover:text-red-800 animate-in fade-in scale-in duration-200"
aria-label={`Delete ${playlist.title}`}
>
<Trash2 size={16} />
</button>
)}
</li>
))}
</ul>

View File

@@ -12,6 +12,7 @@
},
"dependencies": {
"@tailwindcss/forms": "^0.5.9",
"jazz-inspector": "workspace:*",
"jazz-react": "workspace:*",
"jazz-tools": "workspace:*",
"react": "^18.3.1",

View File

@@ -80,7 +80,7 @@ export function IssueVersionHistory({ id }: { id: ID<Issue> }) {
<div className="flex flex-col text-sm gap-2">
<h2 className="sr-only">Edits</h2>
{edits.map((edit, i) => (
<div>
<div key={i}>
<p className="text-xs text-stone-400">
{edit.madeAt.toLocaleString()}
</p>

View File

@@ -3,6 +3,7 @@ import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App.tsx";
import "./index.css";
import { JazzInspector } from "jazz-inspector";
import { apiKey } from "./apiKey.ts";
createRoot(document.getElementById("root")!).render(
@@ -16,6 +17,7 @@ createRoot(document.getElementById("root")!).render(
<DemoAuthBasicUI appName="Jazz Version History Example">
<App />
</DemoAuthBasicUI>
<JazzInspector position="bottom right" />
</JazzProvider>
</StrictMode>,
);

View File

@@ -0,0 +1,20 @@
export function JazzIcon({ className }: { className?: string }) {
return (
<svg
className={className}
xmlns="http://www.w3.org/2000/svg"
width="125"
height="125"
viewBox="0 0 125 125"
fill="none"
>
<rect width="125" height="125" fill="white" />
<path
fillRule="evenodd"
clipRule="evenodd"
d="M118.179 29.6597V6C99.931 13.3847 79.9854 17.4512 59.0897 17.4512C47.1466 17.4512 35.5138 16.1228 24.331 13.6057V36.2396V65.9828C23.2955 65.2705 22.1568 64.6778 20.9405 64.2235C18.1732 63.19 15.128 62.9196 12.1902 63.4465C9.25242 63.9734 6.55392 65.2739 4.43582 67.1836C2.31782 69.0933 0.875416 71.5264 0.291016 74.1753C-0.293384 76.8241 0.00661504 79.5697 1.15281 82.0649C2.29911 84.56 4.24032 86.693 6.73082 88.193C9.22142 89.694 12.1495 90.494 15.1448 90.494C15.6054 90.494 15.8365 90.494 16.0314 90.491C26.5583 90.281 35.042 81.7976 35.2513 71.2706C35.2534 71.1626 35.2544 71.0436 35.2548 70.8806L35.2552 70.5469V70.3841V66.9082V38.0313C43.0533 39.0644 51.0092 39.5976 59.0897 39.5976C59.6696 39.5976 60.2489 39.5949 60.8276 39.5894V95.528C59.792 94.815 58.6533 94.223 57.437 93.768C54.6697 92.735 51.6246 92.464 48.6867 92.991C45.7489 93.518 43.0504 94.819 40.9323 96.728C38.8143 98.638 37.3719 101.071 36.7875 103.72C36.2032 106.369 36.5031 109.115 37.6494 111.61C38.7956 114.105 40.7368 116.237 43.2273 117.738C45.7179 119.238 48.646 120.039 51.6414 120.039C52.1024 120.039 52.3329 120.039 52.5279 120.035C63.0548 119.826 71.5385 111.342 71.7478 100.815C71.7517 100.62 71.7517 100.39 71.7517 99.929V96.453V39.1586C83.962 38.3088 95.837 36.2395 107.255 33.0717V65.7337C106.219 65.0214 105.081 64.4286 103.864 63.9744C101.097 62.9409 98.052 62.6704 95.114 63.1973C92.176 63.7242 89.478 65.0247 87.36 66.9345C85.242 68.8442 83.799 71.2773 83.215 73.9261C82.631 76.575 82.931 79.3206 84.077 81.8157C85.223 84.3109 87.164 86.444 89.655 87.944C92.145 89.444 95.073 90.245 98.069 90.245C98.53 90.245 98.76 90.245 98.955 90.241C109.482 90.032 117.966 81.5484 118.175 71.0215C118.179 70.8265 118.179 70.596 118.179 70.1349V66.6591V29.6597Z"
fill="#3313F7"
/>
</svg>
);
}

View File

@@ -3,19 +3,20 @@ import { packages } from "@/lib/packages";
import { notFound } from "next/navigation";
interface Props {
params: { package: string };
params: Promise<{ package: string }>;
}
export default function Page({ params }: Props) {
if (!packages.map((p) => p.name).includes(params.package)) {
export default async function Page({ params }: Props) {
const packageName = (await params).package;
if (!packages.map((p) => p.name).includes(packageName)) {
return notFound();
}
return <PackageDocs package={params.package} />;
return <PackageDocs package={packageName} />;
}
export async function generateMetadata({ params }: Props) {
const packageName = params.package;
const packageName = (await params).package;
return {
title: `${packageName} - jazz`,
description: `API reference for ${packageName}.`,

View File

@@ -1,4 +1,5 @@
import { CodeGroup } from '@/components/forMdx'
import { JazzIcon } from "gcmp-design-system/src/app/components/atoms/logos/JazzIcon";
# Jazz Inspector
@@ -27,7 +28,7 @@ npm install jazz-inspector
Render the component within your `JazzProvider`.
<CodeGroup>
```sh
```tsx
import { JazzInspector } from "jazz-inspector";
<JazzProvider> // old
@@ -36,4 +37,32 @@ import { JazzInspector } from "jazz-inspector";
```
</CodeGroup>
This will show the Inspector launch button on the right of your page.
### Positioning the Inspector button
You can also customize the button position with the following options:
- right (default)
- left
- bottom right
- bottom left
- top right
- top left
For example:
<CodeGroup>
```tsx
<JazzInspector position="bottom left"/>
```
</CodeGroup>
<div className="bg-stone-200 flex items-center justify-center h-72 relative dark:bg-stone-900 mt-5">
<span>Your app</span>
<button className="size-10 p-1.5 border rounded-lg left-4 bottom-4 absolute bg-white shadow-sm" type="button">
<JazzIcon className="w-full h-auto"/>
</button>
</div>
Check out the [music player app](https://github.com/garden-co/jazz/blob/main/examples/music-player/src/2_main.tsx) for a full example.

View File

@@ -7,16 +7,19 @@ import type { Toc } from "@stefanprobst/rehype-extract-toc";
import { Prose } from "gcmp-design-system/src/app/components/molecules/Prose";
async function getMdxSource(slugPath: string, framework: string) {
// Try to import the framework-specific file first
try {
return await import(`./${slugPath}.mdx`);
} catch (error) {
return await import(`./${slugPath}/${framework}.mdx`);
} catch (error) {
// Fallback to vanilla
return await import(`./${slugPath}.mdx`);
}
}
export async function generateMetadata({
params: { slug, framework },
}: { params: { slug: string[]; framework: string } }) {
params,
}: { params: Promise<{ slug: string[]; framework: string }> }) {
const { slug, framework } = await params;
const slugPath = slug.join("/");
try {
const mdxSource = await getMdxSource(slugPath, framework);
@@ -39,8 +42,9 @@ export async function generateMetadata({
}
export default async function Page({
params: { slug, framework },
}: { params: { slug: string[]; framework: string } }) {
params,
}: { params: Promise<{ slug: string[]; framework: string }> }) {
const { slug, framework } = await params;
const slugPath = slug.join("/");
const bodyClassName = "overflow-x-hidden lg:flex-1 py-10 max-w-3xl mx-auto";

View File

@@ -32,6 +32,13 @@ export class MyAppRoot extends CoMap {
myChats = co.ref(ListOfChats);
myContacts = co.ref(ListOfAccounts);
}
// Register the Account schema so `useAccount` returns our custom `MyAppAccount`
declare module "jazz-react" {
interface Register {
Account: MyAppAccount;
}
}
```
</CodeGroup>
@@ -92,6 +99,13 @@ export class MyAppProfile extends Profile {
name = co.string; // compatible with default Profile schema
avatar = co.optional.ref(ImageDefinition);
}
// Register the Account schema so `useAccount` returns our custom `MyAppAccount` // old
declare module "jazz-react" {// old
interface Register {// old
Account: MyAppAccount;// old
}// old
}// old
```
</CodeGroup>

View File

@@ -18,7 +18,7 @@ class ListOfTasks extends CoList.Of(co.ref(Task)) {}
```
</CodeGroup>
To instantiate a CoList:
To create a `CoList`:
<CodeGroup>
```ts
@@ -61,40 +61,69 @@ console.log(todoTasks.length); // 1
```
</CodeGroup>
## Writing to CoLists
## Updating CoLists
CoLists support all the standard JavaScript array mutation methods:
Update `CoList`s just like you would JavaScript arrays:
<CodeGroup>
```ts
// Add items
resources.push("Courgette"); // Add to end
resources.unshift("Lettuce"); // Add to beginning
console.log(resources);
// ["Lettuce", "Tomatoes", "Basil", "Peppers", "Courgette"]
// Add complex items to lists of references
tasks.push(Task.create({
title: "Install irrigation system",
resources.push("Tomatoes"); // Add to end
resources.unshift("Lettuce"); // Add to beginning
tasks.push(Task.create({ // Add complex items
title: "Install irrigation",
status: "todo"
}));
// Remove items
resources.pop(); // Remove last item
resources.shift(); // Remove first item
resources.splice(1, 2); // Remove items at index 1 and 2
// Replace items
resources[0] = "Cucumber"; // Replace first item
resources[0] = "Cucumber"; // Replace by index
console.log(resources); // ["Cucumber"]
// Modify items in a list of references
tasks[0].status = "in-progress"; // Modify a property of an item
// Modify nested items
tasks[0].status = "complete"; // Update properties of references
```
</CodeGroup>
### Deleting Items
Remove specific items by index with `splice`, or remove the first or last item with `pop` or `shift`:
<CodeGroup>
```ts
// Remove 2 items starting at index 1
resources.splice(1, 2);
console.log(resources); // ["Cucumber", "Peppers"]
// Remove a single item at index 0
resources.splice(0, 1);
console.log(resources); // ["Peppers"]
// Remove items
const lastItem = resources.pop(); // Remove and return last item
resources.shift(); // Remove first item
```
</CodeGroup>
### Array Methods
`CoList`s support the standard JavaScript array methods you already know:
<CodeGroup>
```ts
// Add multiple items at once
resources.push("Tomatoes", "Basil", "Peppers");
// Find items
const basil = resources.find(r => r === "Basil");
// Filter (returns regular array, not a CoList)
const tItems = resources.filter(r => r.startsWith("T"));
console.log(tItems); // ["Tomatoes"]
// Sort (modifies the CoList in-place)
resources.sort();
console.log(resources); // ["Basil", "Peppers", "Tomatoes"]
```
</CodeGroup>
### Type Safety
@@ -102,42 +131,16 @@ CoLists maintain type safety for their items:
<CodeGroup>
```ts
// TypeScript knows each item's type
// TypeScript catches type errors
resources.push("Carrots"); // ✓ Valid string
resources.push(42); // ✗ Type error: expected string
// For lists of references, TypeScript knows the referenced type
// For lists of references
tasks.forEach(task => {
console.log(task.title); // TypeScript knows 'task' has a 'title'
console.log(task.title); // TypeScript knows task has title
});
```
</CodeGroup>
### Array Methods
CoLists support many standard JavaScript array methods:
<CodeGroup>
```ts
resources.push("Tomatoes", "Basil", "Peppers");
// Filter
const springResources = resources.filter(resource => resource.includes("Tomato"));
console.log(springResources); // ["Tomatoes"]
// Map (creates a regular array, not a CoList)
const resourceNames = resources.map(resource => resource.toUpperCase());
console.log(resourceNames); // ["TOMATOES", "BASIL", "PEPPERS"]
// Find
const basil = resources.find(resource => resource === "Basil");
// Sort (modifies the CoList in-place)
resources.sort();
console.log(resources); // ["Basil", "Cucumber", "Peppers", "Tomatoes"]
```
</CodeGroup>
## Best Practices
### Common Patterns

View File

@@ -16,8 +16,6 @@ export default function Home() {
<>
<HeroSection />
<ProblemStatementSection />
<div className="container flex flex-col gap-12 mt-12 lg:gap-20 lg:mt-20">
<HowJazzWorksSection />
@@ -32,6 +30,8 @@ export default function Home() {
</p>
</Testimonial>
<ProblemStatementSection />
<ChatDemoSection />
<LocalFirstFeaturesSection />

View File

@@ -61,8 +61,8 @@ export default function Cloud() {
</div>
<div className="bg-stone-100 border-y dark:bg-stone-925 py-8 lg:py-16 dark:border-y-0 dark:bg-transparent dark:py-0">
<div className="container">
<H2 className="mb-5 sm:text-center md:text-left">Pricing</H2>
<div className="container space-y-5">
<H2>Pricing</H2>
<Pricing />
</div>

View File

@@ -1,17 +0,0 @@
#### How are sync-minutes counted?
Sync-minutes are counted on a **per-connected-device, per-minute basis.**<br/>
A device is considered syncing **only when it's actively sending or receiving data.**
#### How can I estimate my usage?
The best way to estimate your usage is to **guess how many minutes per month each user will spend actively using your app.**
Storage is mostly determined by large binary blobs (like images or videos) that you store in Jazz.
#### What happens if I exceed my plan's limits?
All limits are initially soft limits, so don't worry if you suddenly get lots of users or traffic!
Sync beyond the limit is still served, but at a lower priority.
Data beyond the storage limit is still stored and backed up, but may be significantly slower to access.
If you exceed your plan's limits consistently, we'll reach out to discuss upgrading your plan.

View File

@@ -213,6 +213,30 @@ const ImageUploadIllustration = () => (
</div>
);
const FileUploadIllustration = () => (
<div className="flex flex-col items-center justify-center h-full p-8">
<div className="p-3 w-[12rem] h-[8rem] border border-dashed border-blue dark:border-blue-500 rounded-lg flex gap-2 flex-col items-center justify-center">
<Icon
name="upload"
size="4xl"
className="stroke-blue mx-auto dark:stroke-blue-500"
/>
<p className="whitespace-nowrap text-stone-900 dark:text-white">
take-five.mp3
</p>
</div>
<div className=" w-[12rem] h-2 rounded-full overflow-hidden bg-stone-200 mt-3">
<div className="w-3/4 h-full bg-green-500"/>
</div>
<div className="w-[12rem] flex justify-between text-xs mt-1.5">
<p>Uploading...</p>
<p>76%</p>
</div>
</div>
);
const ReactionsIllustration = () => (
<div className="flex bg-stone-100 h-full flex-col items-center justify-center dark:bg-transparent">
<div className="inline-flex justify-center gap-1.5 mx-auto">
@@ -346,12 +370,21 @@ const reactExamples: Example[] = [
{
name: "Image upload",
slug: "image-upload",
description: "Learn how to upload and delete images",
description: "Learn how to upload and delete images.",
tech: [tech.react],
features: [features.imageUpload],
demoUrl: "https://image-upload-demo.jazz.tools",
illustration: <ImageUploadIllustration />,
},
{
name: "File upload",
slug: "filestream",
description: "Upload different types of files, and show upload progress, file size, and type.",
tech: [tech.react],
features: [features.fileUpload],
demoUrl: "https://file-upload-demo.jazz.tools",
illustration: <FileUploadIllustration />,
},
{
name: "Reactions",
slug: "reactions",

View File

@@ -1,3 +1,4 @@
import LatencyChart from "@/components/LatencyChart";
import { clsx } from "clsx";
import { HeroHeader } from "gcmp-design-system/src/app/components/molecules/HeroHeader";
import type { Metadata } from "next";
@@ -13,10 +14,6 @@ export const metadata: Metadata = {
},
};
const LatencyChart = dynamic(() => import("@/components/LatencyChart"), {
ssr: false,
});
interface DataRow {
up: boolean;
latencyOverTime: [number[], number[]];

View File

@@ -7,7 +7,7 @@ import { pingColorThresholds } from "../../../components/cloud/pingColorThreshol
// generated with: globalping ping cloud.jazz.tools from world --limit 500 --packets 16 --json | jq "del(.results[].result.rawOutput)" > pings.json
import pings from "../../../components/cloud/pings.json";
export const revalidate = 2 * 60 * 60; // 2 hours
export const revalidate = 7200; // 2 hours
export async function GET(req: NextRequest) {
const spacing = parseFloat(req.nextUrl.searchParams.get("spacing") || "1.5");

View File

@@ -1,20 +1,21 @@
"use client";
import { Button } from "gcmp-design-system/src/app/components/atoms/Button";
import { track } from '@vercel/analytics';
export function FakeGetStartedButton() {
export function FakeGetStartedButton({ tier }: { tier: "starter" | "indie" }) {
return (
<Button
onClick={() => {
track("FakeSignUp", { tier });
alert(
"During the public alpha, please use your email address as the API key, as shown in the docs!",
"During the public alpha, all limits are lifted. Please use your email address as the API key, as shown in the docs!",
);
window.location.pathname = "/docs";
}}
size="md"
variant="primary"
variant={tier === "starter" ? "secondary" : "primary"}
>
Get started
Get {tier === "starter" ? "Starter" : "Indie"} API Key
</Button>
);
}

View File

@@ -3,21 +3,15 @@ import { Button } from "gcmp-design-system/src/app/components/atoms/Button";
import {
CircleCheckIcon,
LucideBuilding2,
LucideCheck,
LucideChevronUp,
LucideChevronsUp,
LucideCloudDownload,
LucideCrown,
LucideDatabase,
LucideDatabaseZap,
LucideHammer,
LucideHandshake,
LucideIcon,
LucideMessageCircle,
LucideMicroscope,
LucidePhone,
LucideSearch,
LucideTicketCheck,
LucideInfinity,
LucideServer,
LucideUsers,
LucideZap,
} from "lucide-react";
import { FakeGetStartedButton } from "./FakeGetStartedButton";
import { IndieTierLogo, ProTierLogo, StarterTierLogo } from "./TierLogos";
@@ -36,11 +30,11 @@ export function ListItem({
const iconSize = 16;
const iconVariants = {
gray: <Icon size={iconSize} className="text-stone-500 shrink-0" />,
gray: <Icon size={iconSize} className="text-stone-500 shrink-0 mt-1" />,
blue: (
<Icon
size={iconSize}
className="text-blue-500 dark:text-white shrink-0"
className="text-blue dark:text-white shrink-0 mt-1"
/>
),
};
@@ -48,7 +42,7 @@ export function ListItem({
return (
<li
className={clsx(
"inline-flex items-center gap-2 text-stone-800 dark:text-stone-200 py-2",
"inline-flex gap-3 text-stone-800 dark:text-stone-200 py-2",
className,
)}
>
@@ -60,224 +54,227 @@ export function ListItem({
export function Pricing() {
return (
<div className="flex flex-col sm:max-w-lg mx-auto md:max-w-none md:flex-row md:items-start gap-4">
<div className="md:flex-1 flex flex-col gap-3 overflow-hidden rounded-xl p-6 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925">
<h3 className="flex justify-between items-center font-semibold text-stone-900 text-xl dark:text-white">
<div className="flex items-center gap-1.5">
<StarterTierLogo />
Starter
</div>
<div className="text-stone-900 dark:text-white">
<span className="text-2xl font-light tabular-nums tracking-tighter">
$0
</span>
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
/mo
</span>
</div>
</h3>
<p className="text-sm">Everything you need for brand new projects.</p>
<div>
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
Limits (lifted during public alpha)
</h4>
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
<ListItem icon={LucideUsers} variant="gray">
<s className="text-stone-500">max. 100 monthly active users</s>
</ListItem>
<ListItem icon={LucideDatabase} variant="gray">
<s className="text-stone-500">max. 10 GB storage</s>
</ListItem>
<ListItem icon={LucideCloudDownload} variant="gray">
<s className="text-stone-500">max. 2 GB egress/mo</s>
</ListItem>
</ul>
</div>
<div>
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
Cloud features
</h4>
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
<ListItem icon={LucideCheck}>Real-time sync</ListItem>
<ListItem icon={LucideDatabase}>Cloud storage</ListItem>
</ul>
</div>
<div>
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
Support
</h4>
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
<ListItem icon={LucideMessageCircle}>Community support</ListItem>
</ul>
</div>
<FakeGetStartedButton />
<p className="text-sm">No credit card required.</p>
</div>
<div className="md:flex-1 flex flex-col gap-3 overflow-hidden rounded-xl p-6 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925">
<div>
<>
<div className="flex flex-col sm:max-w-lg mx-auto md:max-w-none md:flex-row md:items-start gap-4 mb-10">
<div className="flex-1 flex flex-col gap-3 overflow-hidden rounded-xl p-6 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925">
<h3 className="flex justify-between items-center font-semibold text-stone-900 text-xl dark:text-white">
<div className="flex items-center gap-1.5">
<IndieTierLogo />
Indie
<StarterTierLogo />
Starter
</div>
<div className="text-stone-900 dark:text-white">
<span className="text-2xl font-light tabular-nums tracking-tighter">
$19
$0
</span>
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
/mo
</span>
</div>
</h3>
</div>
<p className="text-sm">
Get robust real-time infra at predictable costs.
</p>
<p className="text-sm">Everything you need to get started.</p>
<div>
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
Limits & extra usage
</h4>
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
<ListItem icon={LucideUsers}>
max. 10,000 monthly active users
</ListItem>
<ListItem icon={LucideDatabase}>
incl. 500 GB storage{" "}
<span className="text-sm text-stone-900 dark:text-white">
(then $0.02 per GB)
</span>
</ListItem>
<ListItem icon={LucideCloudDownload}>
incl. 100 GB egress/mo{" "}
<span className="text-sm text-stone-900 dark:text-white">
(then $0.1 per GB)
</span>
</ListItem>
</ul>
</div>
<div>
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
Cloud features
</h4>
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
<ListItem icon={LucideZap}>Priority real-time sync</ListItem>
<ListItem icon={LucideDatabaseZap}>
SSD cloud storage & daily backups
</ListItem>
<ListItem icon={LucideSearch}>Basic user analytics</ListItem>
</ul>
</div>
<div>
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
Support
</h4>
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
<ListItem icon={LucideMessageCircle}>Community support</ListItem>
<ListItem icon={LucideTicketCheck}>
Prioritised feature requests
</ListItem>
</ul>
</div>
<Button size="md" variant="secondary" disabled>
Coming soon
</Button>
<p className="text-sm">
We&apos;ve designed this tier to be affordable but also
self-sustaining, so you can rely on it long-term.
</p>
</div>
<div className="md:flex-1 flex flex-col gap-3 overflow-hidden rounded-xl p-6 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925 pb-6">
<h3 className="flex justify-between items-center font-semibold text-stone-900 text-xl dark:text-white">
<div className="flex items-center gap-1.5">
<ProTierLogo />
Pro
<div>
<ul className="flex flex-col my-4 text-sm lg:text-base">
<ListItem icon={LucideUsers}>
<span className="tabular-nums">100</span> monthly active users
</ListItem>
<ListItem icon={LucideDatabase}>
<span className="tabular-nums">10</span> GB storage
</ListItem>
<ListItem icon={LucideCloudDownload}>
<span className="tabular-nums">2</span> GB egress/mo
</ListItem>
</ul>
</div>
<div className="text-stone-900 dark:text-white">
<span className="text-lg font-normal">from</span>{" "}
<span className="text-2xl font-light tabular-nums tracking-tighter">
$199
</span>
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
/mo
</span>
<FakeGetStartedButton tier="starter"/>
<p className="text-sm">No credit card required. Takes 20s.</p>
</div>
<div className="flex-1 flex flex-col gap-3 overflow-hidden rounded-xl p-6 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925">
<div>
<h3 className="flex justify-between items-center font-semibold text-stone-900 text-xl dark:text-white">
<div className="flex items-center gap-1.5">
<IndieTierLogo />
Indie
</div>
<div className="text-stone-900 dark:text-white">
<span className="text-2xl font-light tabular-nums tracking-tighter">
$4
</span>
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
/mo
</span>
</div>
</h3>
</div>
</h3>
<p className="text-sm">
Get our best infra and move quickly with our help.
</p>
<p className="text-sm">
Get robust real-time infra at predictable costs.
</p>
<div>
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
Limits
</h4>
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
<ListItem icon={LucideUsers}>Custom monthly active users</ListItem>
<ListItem icon={LucideDatabase}>Custom storage</ListItem>
<ListItem icon={LucideCloudDownload}>Custom egress</ListItem>
</ul>
<div>
<ul className="flex flex-col my-4 text-sm lg:text-base">
<ListItem icon={LucideUsers}>
<span className="tabular-nums">10,000</span> monthly active
users
</ListItem>
<ListItem icon={LucideDatabase}>
<span className="tabular-nums">100</span> GB storage incl.{" "}
<span className="text-sm">
(then $0.02 per GB)
</span>
</ListItem>
<ListItem icon={LucideCloudDownload}>
<span className="tabular-nums">20</span> GB egress/mo incl.{" "}
<span className="text-sm">
(then $0.1 per GB)
</span>
</ListItem>
<hr className="my-2 border-stone-200 dark:border-stone-800" />
<ListItem icon={LucideChevronsUp}>High-priority sync</ListItem>
</ul>
</div>
<FakeGetStartedButton tier="indie"/>
<p className="text-sm">
One month free trial. Unlimited projects. Takes 1min.
</p>
</div>
<div className="flex-1 flex flex-col gap-3 overflow-hidden rounded-xl p-6 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925 pb-6">
<h3 className="flex justify-between items-center font-semibold text-stone-900 text-xl dark:text-white">
<div className="flex items-center gap-1.5">
<ProTierLogo />
Pro
</div>
<div className="text-stone-900 dark:text-white">
<span className="text-lg font-normal">from</span>{" "}
<span className="text-2xl font-light tabular-nums tracking-tighter">
$199
</span>
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
/mo
</span>
</div>
</h3>
<div>
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
Cloud features
</h4>
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
<ListItem icon={LucideCrown}>
Highest-priority real-time sync
</ListItem>
<ListItem icon={LucideDatabaseZap}>
SSD cloud storage & custom backups
</ListItem>
<ListItem icon={LucideMicroscope}>Advanced user analytics</ListItem>
</ul>
<p className="text-sm">
Get our best infra and move quickly with our help.
</p>
<div>
<ul className="flex flex-col my-4 text-sm lg:text-base">
<ListItem icon={LucideUsers}>
Custom monthly active users
</ListItem>
<ListItem icon={LucideDatabase}>
Custom storage
</ListItem>
<ListItem icon={LucideCloudDownload}>
Custom egress/mo
</ListItem>
<hr className="my-2 border-stone-200 dark:border-stone-800" />
<ListItem icon={LucideHandshake}>
Rapid integration & premium onboarding
</ListItem>
<ListItem icon={LucideBuilding2}>
SLAs, certifications, dedicated support
</ListItem>
<ListItem icon={LucideServer}>
Dedicated / on-prem infrastructure
</ListItem>
</ul>
</div>
<Button href="https://cal.com/anselm-io/cloud-pro-intro">
Schedule intro call
</Button>
<p className="text-sm">
Our engineering team will get you going for free.
</p>
</div>
<div>
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
Support
</h4>
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
<ListItem icon={LucidePhone}>Dedicated support</ListItem>
<ListItem icon={LucideHammer}>Custom feature development</ListItem>
<ListItem icon={LucideHandshake}>
Rapid integration & premium onboarding
</ListItem>
</ul>
</div>
<div>
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
Enterprise needs
</h4>
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
<ListItem icon={LucideBuilding2}>
SLAs, on-prem & certifications
</ListItem>
</ul>
</div>
<Button href="https://cal.com/anselm-io/cloud-pro-intro" size="md">
Book intro call
</Button>
<p className="text-sm">
Our team of devs & product experts will get you going for free. Then
we&apos;ll make a deal just for you.
</p>
</div>
</div>
{/* <H3>Add-ons</H3>
<div className="flex flex-col sm:max-w-lg mx-auto md:max-w-none md:flex-row md:items-start gap-4 mb-10">
<div className="md:flex-[2] flex flex-col gap-1 overflow-hidden rounded-xl px-6 py-4 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925">
<h4 className="flex justify-between items-center font-semibold text-stone-900 text-lg dark:text-white">
<div className="flex items-center gap-1.5">Simple Analytics</div>
<div className="text-stone-900 dark:text-white">
<span className="text-xl font-light tabular-nums tracking-tighter">
$10
</span>
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
/mo
</span>
</div>
</h4>
<div>
<ul className="flex flex-col text-sm lg:text-base">
<ListItem icon={LucideScanSearch}>
<span className="tabular-nums">100</span> inspected users{" "}
<span className="text-sm text-stone-900 dark:text-white">
(then $0.01 per user)
</span>
</ListItem>
</ul>
</div>
<p className="text-sm">
You can choose which subset of users to inspect.
</p>
</div>
<div className="md:flex-[2] flex flex-col gap-1 overflow-hidden rounded-xl px-6 py-4 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925">
<h4 className="flex justify-between items-center font-semibold text-stone-900 text-lg dark:text-white">
<div className="flex items-center gap-1.5">Advanced Analytics</div>
<div className="text-stone-900 dark:text-white">
<span className="text-xl font-light tabular-nums tracking-tighter">
$50
</span>
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
/mo
</span>
</div>
</h4>
<div>
<ul className="flex flex-col text-sm lg:text-base">
<ListItem icon={LucideMicroscope}>
<span className="tabular-nums">1,000</span> inspected users{" "}
<span className="text-sm text-stone-900 dark:text-white">
(then $0.05 per user)
</span>
</ListItem>
</ul>
</div>
<p className="text-sm">
You can choose which subset of users to inspect.
</p>
</div>
<div className="md:flex-[2] flex flex-col gap-1 overflow-hidden rounded-xl px-6 py-4 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925">
<h4 className="flex justify-between items-center font-semibold text-stone-900 text-lg dark:text-white">
<div className="flex items-center gap-1.5">Custom Sync Domain</div>
<div className="text-stone-900 dark:text-white">
<span className="text-xl font-light tabular-nums tracking-tighter">
$50
</span>
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
/mo
</span>
</div>
</h4>
<div>
<ul className="flex flex-col text-sm lg:text-base">
<ListItem icon={LucideGlobe}>
Sync via <code>sync.yourdomain.com</code>
</ListItem>
</ul>
</div>
<p className="text-sm">
White-labeled & friendly with complex CORS setups.
</p>
</div>
</div> */}
</>
);
}

View File

@@ -28,6 +28,10 @@ const frameworks: Record<
label: "React Native",
experimental: false,
},
[Framework.Vanilla]: {
label: "VanillaJS",
experimental: false,
},
[Framework.Svelte]: {
label: "Svelte",
experimental: true,

View File

@@ -19,8 +19,9 @@ export function DocNav({ className }: { className?: string }) {
.map((item) => {
if (!item.href?.startsWith("/docs")) return item;
const frameworkDone = (item.done as any)[framework] ?? 0;
let done =
typeof item.done === "number" ? item.done : item.done[framework];
typeof item.done === "number" ? item.done : frameworkDone;
let href = item.href.replace("/docs", `/docs/${framework}`);
return {

View File

@@ -1,7 +1,7 @@
```ts
const message = Message.create({
text: “Hello world!”
}, { owner: ... })
}, chat._owner)
chat.push(message)
```

View File

@@ -1,8 +1,6 @@
```tsx
<JazzProvider
sync={{
peer: "wss://cloud.jazz.tools/?key=you@example.com",
}}
sync={{ peer: "wss://cloud.jazz.tools/?key=you@example.com" }}
>
{children}
</JazzProvider>

View File

@@ -1,5 +1,5 @@
```tsx
const ChatScreen = (id) => {
const ChatScreen = ({ id }) => {
const chat = useCoState(Chat, id)
return chat.messages.map(msg => (

View File

@@ -1,10 +1,8 @@
```ts
export class Message extends CoMap {
class Message extends CoMap {
text = co.string;
}
export class Chat extends CoList.Of(
co.ref(Message)
) {}
class Chat extends CoList.Of(co.ref(Message)) {}
```

View File

@@ -10,18 +10,18 @@ const data = [
{
title: "Private",
description:
"Create a CoValue visible only to you by assigning your Account as an owner.",
"By default, CoValues are visible only to you.",
codeSample: CollaborationPrivate,
},
{
title: "Public",
description: "Start collaborating by giving write access to everyone.",
title: "Shared",
description: "Use Groups for precise access control.",
codeSample: CollaborationPublic,
},
{
title: "Invite-only",
title: "By Invitation",
description:
"Generate an invite link, and share only with people you want to collaborate with.",
"Create links that allow anyone to join.",
codeSample: CollaborationInvite,
},
];
@@ -34,9 +34,7 @@ export function CollaborationFeaturesSection() {
title="Making secure collaboration the default"
slogan={
<>
Every piece of data is assigned a role-based permission on creation
&mdash; reader, writer, or admin. These permissions are defined in
an <code>Account</code> or <code>Group</code>.
Every CoValue belongs to a <code>Group</code>, where you can assign roles to users to control access &mdash; all from the client.
</>
}
></SectionHeader>

View File

@@ -1,6 +1,7 @@
```tsx
// links to message, Group is inferred
createInviteLink(
chatId,
"writer", // or reader or admin
messageId,
"writer", // role that recipient gets
);
```

View File

@@ -1,8 +1,5 @@
```tsx
const { me } = useAccount();
Message.create(
{ text: ... },
{ owner: me }
);
Message.create({
text: "Private message to myself."
});
```

View File

@@ -1,9 +1,7 @@
```tsx
const group = Group.create({
owner: me
});
const group = Group.create();
group.addMember(Alice, "writer");
group.addMember("everyone", "reader");
group.addMember("everyone", "writer");
Chat.create([], { owner: group })
Message.create({ text: "..." }, group);
```

View File

@@ -1,7 +1,7 @@
import CoPlainTextDescription from "@/app/(home)/coValueDescriptions/coPlainTextDescription.mdx";
import CursorsAndCaretsDescription from "@/app/(home)/toolkit/cursorsAndCarets.mdx";
import TwoWaySyncDescription from "@/app/(home)/toolkit/twoWaySync.mdx";
import VideoPresenceCallsDescription from "@/app/(home)/toolkit/videoPresenceCalls.mdx";
import CoPlainTextDescription from "@/app/(others)/(home)/coValueDescriptions/coPlainTextDescription.mdx";
import CursorsAndCaretsDescription from "@/app/(others)/(home)/toolkit/cursorsAndCarets.mdx";
import TwoWaySyncDescription from "@/app/(others)/(home)/toolkit/twoWaySync.mdx";
import VideoPresenceCallsDescription from "@/app/(others)/(home)/toolkit/videoPresenceCalls.mdx";
import { CodeRef } from "gcmp-design-system/src/app/components/atoms/CodeRef";
import { P } from "gcmp-design-system/src/app/components/atoms/Paragraph";
import { FeatureCard } from "gcmp-design-system/src/app/components/molecules/FeatureCard";

View File

@@ -46,25 +46,23 @@ export function HeroSection() {
<div className="container grid items-center gap-x-8 gap-y-10 py-12 md:py-16 lg:py-24 lg:gap-x-10 lg:grid-cols-3">
<div className="flex flex-col justify-center gap-5 lg:col-span-2 lg:gap-8">
<p className="uppercase text-blue tracking-widest text-sm font-medium dark:text-stone-400">
Local-first development toolkit
Toolkit for cloud-synced local state
</p>
<H1>
<span className="inline-block">Ship top-tier apps</span>{" "}
<span className="inline-block">at high tempo.</span>
<span className="inline-block">Whip up an app.</span>
</H1>
<Prose size="lg" className="text-pretty max-w-2xl dark:text-stone-200">
<p>
Jazz is a framework for building local-first apps
&mdash;&nbsp;an&nbsp;architecture that lets companies like Figma and
Linear play in a league of their own.
Jazz lets you build with cloud-synced local state, completely
replacing backends and databases. You'll ship better apps, much faster.
</p>
<p>
Open source. Self-host or use{" "}
<Link className="text-reset" href="/cloud">
Jazz Cloud
</Link>{" "}
for zero-config magic.
for an &ldquo;it just works&rdquo; DX.
</p>
</Prose>
@@ -89,7 +87,7 @@ export function HeroSection() {
title="Get a Jazz app running in minutes."
/>
<div className=" overflow-hidden sm:rounded-xl sm:border h-full sm:px-8 sm:pt-6 bg-stone-50 dark:bg-stone-950">
<div className="rounded-lg bg-white dark:bg-stone-925 sm:ring-4 ring-stone-400/20 sm:shadow-xl shadow-blue/20 border relative sm:top-2 h-full w-full">
<div className="rounded-lg bg-white dark:bg-stone-925 sm:ring-4 ring-stone-400/20 sm:shadow-xl sm:shadow-blue/20 border relative sm:top-2 h-full w-full">
<div className="py-4 flex items-center gap-2.5 px-6 border-b">
<span className="rounded-full size-3 bg-stone-200 dark:bg-stone-900" />
<span className="rounded-full size-3 bg-stone-200 dark:bg-stone-900" />

View File

@@ -76,17 +76,11 @@ function Step({
}
export function HowJazzWorksSection() {
const imageProps = {
alt: "Code samples for defining a schema for Jazz, pushing data, and subscribing to changes.",
width: 1100,
height: 852,
};
return (
<div className="grid gap-8">
<div className="grid gap-3">
<p className="uppercase text-blue tracking-widest text-sm font-medium dark:text-stone-400">
Collaborative Values
State with built-in collaboration
</p>
<H2>Build entire apps using only client-side code</H2>
@@ -94,7 +88,7 @@ export function HowJazzWorksSection() {
<GappedGrid>
<Step
step={1}
description="Define your schema using Collaborative Values &mdash; your new building blocks."
description={"Describe your apps state with CoValues (\"collaborative values\"), your new cloud-synced building blocks."}
>
<Code fileName="schema.ts">
<CodeStepSchema />
@@ -110,7 +104,7 @@ export function HowJazzWorksSection() {
</Step>
<Step
step={3}
description="Create a Collaborative Value, and it will be synced and persisted automatically."
description="Create and edit CoValues, and they will be synced and persisted automatically."
>
<Code fileName="sendMessage.ts">
<CodeStepAction />
@@ -118,7 +112,7 @@ export function HowJazzWorksSection() {
</Step>
<Step
step={4}
description="Read your data like simple local state. Get instant sync and UI updates across all devices and users. 🎉"
description="Use CoValues like reactive local state. Get instant UI updates on every edit &mdash; across all devices and users. 🎉"
>
<Code fileName="ChatScreen.tsx">
<CodeStepRender />

View File

@@ -48,13 +48,11 @@ export function LocalFirstFeaturesSection() {
return (
<div>
<SectionHeader
title="Why local-first?"
title="The best of all worlds"
slogan={
<>
<p>
With local-first, your data is stored locally, then synced to the
server.
<br /> This comes with the following benefits.
With cloud-synced local state, your data is kept on-device, and synced whenever possible.
</p>
</>
}

View File

@@ -9,8 +9,8 @@ export default function ProblemStatementSection() {
<div className="container grid gap-4 lg:gap-8">
<SectionHeader
className="sm:text-center sm:mx-auto"
title="Hard things are easy now."
slogan=""
title={"Powered by the first “flat stack”"}
slogan="A perspective shift worth 10,000 hours"
/>
<div className="grid sm:grid-cols-2 border rounded-lg shadow-sm md:rounded-xl overflow-hidden dark:border-stone-900">
@@ -27,12 +27,7 @@ export default function ProblemStatementSection() {
</span>
<Prose>
<p className="font-display text-lg md:text-xl font-semibold text-stone-900 dark:text-white">
The sad truth is...
</p>
<p>
<strong>
Every stack reinvents how users and machines share state.
</strong>
Every stack is a re-invention of shared state.
</p>
</Prose>
<div className="relative flex items-center flex-1">
@@ -46,26 +41,20 @@ export default function ProblemStatementSection() {
<Prose>
<p>
For each new app you tackle a{" "}
<strong>
mess of moving parts, tech choices &amp; deployment woes.
</strong>{" "}
Your code? <strong>All over the place.</strong>
<strong>mess of moving parts and infra worries.</strong> Or, you
haven't even tried because "you're not full-stack".
</p>
<p>
<strong>Its holding you back</strong> from shipping{" "}
<strong>what your app could be.</strong>
Want to build a <strong>modern app</strong> with multiplayer or
offline-support? <strong>Figma, Notion and Linear</strong> all had
to spend <strong>years</strong> on completely custom stacks.
</p>
</Prose>
</div>
<div className="flex flex-col gap-3 p-4 pt-8 md:p-8 md:gap-5">
<Prose>
<p className="font-display text-lg md:text-xl font-semibold text-stone-900 dark:text-white">
The good news is...
</p>
<p>
<strong>
Theres a single new abstraction that does the whole job.
</strong>
What if we started from shared state?
</p>
</Prose>
<div className="flex items-center flex-1">
@@ -73,13 +62,15 @@ export default function ProblemStatementSection() {
</div>
<Prose>
<p>
Jazz gives you <strong>mutable local state</strong> thats{" "}
<strong>instantly synced.</strong> Including binary blobs.{" "}
Jazz gives you <strong>local state</strong> thats{" "}
<strong>instantly synced and stored in the cloud.</strong>{" "}
Including images and files.{" "}
<strong>With users &amp; permissions built-in.</strong>
</p>
<p>
All thats left is{" "}
<strong>building the UX that makes your app special.</strong>
With completely <strong>app-independent infra,</strong> you get to focus on{" "}
<strong>building the app your users want.</strong> You'll notice
that <strong>90% of the work is now the UI.</strong>
</p>
</Prose>
</div>

View File

@@ -3,6 +3,7 @@ export enum Framework {
ReactNative = "react-native",
Vue = "vue",
Svelte = "svelte",
Vanilla = "vanilla",
}
export const frameworks = Object.values(Framework);

View File

@@ -4,7 +4,7 @@
"private": true,
"type": "module",
"scripts": {
"dev": "NODE_OPTIONS=--max-old-space-size=8192 next dev",
"dev": "next dev",
"build:generate-docs": "pnpm run generate:docs && pnpm run generate:llm-docs",
"build": "next build",
"start": "next start",
@@ -40,7 +40,7 @@
"mdast-util-from-markdown": "^2.0.0",
"mdast-util-mdx": "^3.0.0",
"micromark-extension-mdxjs": "^3.0.0",
"next": "14.2.15",
"next": "15.2.1",
"next-themes": "^0.2.1",
"qrcode": "^1.5.4",
"react": "^18",

443
homepage/pnpm-lock.yaml generated
View File

@@ -207,10 +207,10 @@ importers:
version: 3.1.5
'@vercel/analytics':
specifier: ^1.3.1
version: 1.3.1(next@14.2.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)
version: 1.3.1(next@15.2.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)
'@vercel/speed-insights':
specifier: ^1.0.12
version: 1.0.12(next@14.2.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)
version: 1.0.12(next@15.2.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)
clsx:
specifier: ^2.1.1
version: 2.1.1
@@ -245,11 +245,11 @@ importers:
specifier: ^3.0.0
version: 3.0.0
next:
specifier: 14.2.15
version: 14.2.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
specifier: 15.2.1
version: 15.2.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
next-themes:
specifier: ^0.2.1
version: 0.2.1(next@14.2.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
version: 0.2.1(next@15.2.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
qrcode:
specifier: ^1.5.4
version: 1.5.4
@@ -414,6 +414,9 @@ packages:
peerDependencies:
postcss: ^8.4
'@emnapi/runtime@1.3.1':
resolution: {integrity: sha512-kEBmG8KyqtxJZv+ygbEim+KCGtIq1fC22Ms3S4ziXmYKm8uyoLX0MHONVKwp+9opg390VaKRNt4a7A9NwmpNhw==}
'@evilmartians/harmony@1.2.0':
resolution: {integrity: sha512-Ua8gpC+28Eo9D2/xynTrrZIrSawgtobwtRLLYq4wH8N19qoMspWZ1vqfsDDVPgQFa+iHsVAk/SbdmoPAj6OH1g==}
@@ -450,6 +453,111 @@ packages:
peerDependencies:
react: ^16.13 || ^17 || ^18
'@img/sharp-darwin-arm64@0.33.5':
resolution: {integrity: sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [arm64]
os: [darwin]
'@img/sharp-darwin-x64@0.33.5':
resolution: {integrity: sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [x64]
os: [darwin]
'@img/sharp-libvips-darwin-arm64@1.0.4':
resolution: {integrity: sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==}
cpu: [arm64]
os: [darwin]
'@img/sharp-libvips-darwin-x64@1.0.4':
resolution: {integrity: sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==}
cpu: [x64]
os: [darwin]
'@img/sharp-libvips-linux-arm64@1.0.4':
resolution: {integrity: sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==}
cpu: [arm64]
os: [linux]
'@img/sharp-libvips-linux-arm@1.0.5':
resolution: {integrity: sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==}
cpu: [arm]
os: [linux]
'@img/sharp-libvips-linux-s390x@1.0.4':
resolution: {integrity: sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==}
cpu: [s390x]
os: [linux]
'@img/sharp-libvips-linux-x64@1.0.4':
resolution: {integrity: sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==}
cpu: [x64]
os: [linux]
'@img/sharp-libvips-linuxmusl-arm64@1.0.4':
resolution: {integrity: sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==}
cpu: [arm64]
os: [linux]
'@img/sharp-libvips-linuxmusl-x64@1.0.4':
resolution: {integrity: sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==}
cpu: [x64]
os: [linux]
'@img/sharp-linux-arm64@0.33.5':
resolution: {integrity: sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [arm64]
os: [linux]
'@img/sharp-linux-arm@0.33.5':
resolution: {integrity: sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [arm]
os: [linux]
'@img/sharp-linux-s390x@0.33.5':
resolution: {integrity: sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [s390x]
os: [linux]
'@img/sharp-linux-x64@0.33.5':
resolution: {integrity: sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [x64]
os: [linux]
'@img/sharp-linuxmusl-arm64@0.33.5':
resolution: {integrity: sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [arm64]
os: [linux]
'@img/sharp-linuxmusl-x64@0.33.5':
resolution: {integrity: sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [x64]
os: [linux]
'@img/sharp-wasm32@0.33.5':
resolution: {integrity: sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [wasm32]
'@img/sharp-win32-ia32@0.33.5':
resolution: {integrity: sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [ia32]
os: [win32]
'@img/sharp-win32-x64@0.33.5':
resolution: {integrity: sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [x64]
os: [win32]
'@isaacs/cliui@8.0.2':
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
engines: {node: '>=12'}
@@ -494,6 +602,9 @@ packages:
'@next/env@14.2.7':
resolution: {integrity: sha512-OTx9y6I3xE/eih+qtthppwLytmpJVPM5PPoJxChFsbjIEFXIayG0h/xLzefHGJviAa3Q5+Fd+9uYojKkHDKxoQ==}
'@next/env@15.2.1':
resolution: {integrity: sha512-JmY0qvnPuS2NCWOz2bbby3Pe0VzdAQ7XpEB6uLIHmtXNfAsAO0KLQLkuAoc42Bxbo3/jMC3dcn9cdf+piCcG2Q==}
'@next/mdx@13.5.6':
resolution: {integrity: sha512-2AMyCrz1SxSWNUpADyLz3RbPbq0GHrchbO7Msvg7IsH8MrTw3VYaZSI1KNa6JzZIoykwtNVSEL+uBmPZi106Jw==}
peerDependencies:
@@ -517,6 +628,12 @@ packages:
cpu: [arm64]
os: [darwin]
'@next/swc-darwin-arm64@15.2.1':
resolution: {integrity: sha512-aWXT+5KEREoy3K5AKtiKwioeblmOvFFjd+F3dVleLvvLiQ/mD//jOOuUcx5hzcO9ISSw4lrqtUPntTpK32uXXQ==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
'@next/swc-darwin-x64@14.2.15':
resolution: {integrity: sha512-5TGyjFcf8ampZP3e+FyCax5zFVHi+Oe7sZyaKOngsqyaNEpOgkKB3sqmymkZfowy3ufGA/tUgDPPxpQx931lHg==}
engines: {node: '>= 10'}
@@ -529,6 +646,12 @@ packages:
cpu: [x64]
os: [darwin]
'@next/swc-darwin-x64@15.2.1':
resolution: {integrity: sha512-E/w8ervu4fcG5SkLhvn1NE/2POuDCDEy5gFbfhmnYXkyONZR68qbUlJlZwuN82o7BrBVAw+tkR8nTIjGiMW1jQ==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
'@next/swc-linux-arm64-gnu@14.2.15':
resolution: {integrity: sha512-3Bwv4oc08ONiQ3FiOLKT72Q+ndEMyLNsc/D3qnLMbtUYTQAmkx9E/JRu0DBpHxNddBmNT5hxz1mYBphJ3mfrrw==}
engines: {node: '>= 10'}
@@ -541,6 +664,12 @@ packages:
cpu: [arm64]
os: [linux]
'@next/swc-linux-arm64-gnu@15.2.1':
resolution: {integrity: sha512-gXDX5lIboebbjhiMT6kFgu4svQyjoSed6dHyjx5uZsjlvTwOAnZpn13w9XDaIMFFHw7K8CpBK7HfDKw0VZvUXQ==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
'@next/swc-linux-arm64-musl@14.2.15':
resolution: {integrity: sha512-k5xf/tg1FBv/M4CMd8S+JL3uV9BnnRmoe7F+GWC3DxkTCD9aewFRH1s5rJ1zkzDa+Do4zyN8qD0N8c84Hu96FQ==}
engines: {node: '>= 10'}
@@ -553,6 +682,12 @@ packages:
cpu: [arm64]
os: [linux]
'@next/swc-linux-arm64-musl@15.2.1':
resolution: {integrity: sha512-3v0pF/adKZkBWfUffmB/ROa+QcNTrnmYG4/SS+r52HPwAK479XcWoES2I+7F7lcbqc7mTeVXrIvb4h6rR/iDKg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
'@next/swc-linux-x64-gnu@14.2.15':
resolution: {integrity: sha512-kE6q38hbrRbKEkkVn62reLXhThLRh6/TvgSP56GkFNhU22TbIrQDEMrO7j0IcQHcew2wfykq8lZyHFabz0oBrA==}
engines: {node: '>= 10'}
@@ -565,6 +700,12 @@ packages:
cpu: [x64]
os: [linux]
'@next/swc-linux-x64-gnu@15.2.1':
resolution: {integrity: sha512-RbsVq2iB6KFJRZ2cHrU67jLVLKeuOIhnQB05ygu5fCNgg8oTewxweJE8XlLV+Ii6Y6u4EHwETdUiRNXIAfpBww==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
'@next/swc-linux-x64-musl@14.2.15':
resolution: {integrity: sha512-PZ5YE9ouy/IdO7QVJeIcyLn/Rc4ml9M2G4y3kCM9MNf1YKvFY4heg3pVa/jQbMro+tP6yc4G2o9LjAz1zxD7tQ==}
engines: {node: '>= 10'}
@@ -577,6 +718,12 @@ packages:
cpu: [x64]
os: [linux]
'@next/swc-linux-x64-musl@15.2.1':
resolution: {integrity: sha512-QHsMLAyAIu6/fWjHmkN/F78EFPKmhQlyX5C8pRIS2RwVA7z+t9cTb0IaYWC3EHLOTjsU7MNQW+n2xGXr11QPpg==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
'@next/swc-win32-arm64-msvc@14.2.15':
resolution: {integrity: sha512-2raR16703kBvYEQD9HNLyb0/394yfqzmIeyp2nDzcPV4yPjqNUG3ohX6jX00WryXz6s1FXpVhsCo3i+g4RUX+g==}
engines: {node: '>= 10'}
@@ -589,6 +736,12 @@ packages:
cpu: [arm64]
os: [win32]
'@next/swc-win32-arm64-msvc@15.2.1':
resolution: {integrity: sha512-Gk42XZXo1cE89i3hPLa/9KZ8OuupTjkDmhLaMKFohjf9brOeZVEa3BQy1J9s9TWUqPhgAEbwv6B2+ciGfe54Vw==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [win32]
'@next/swc-win32-ia32-msvc@14.2.15':
resolution: {integrity: sha512-fyTE8cklgkyR1p03kJa5zXEaZ9El+kDNM5A+66+8evQS5e/6v0Gk28LqA0Jet8gKSOyP+OTm/tJHzMlGdQerdQ==}
engines: {node: '>= 10'}
@@ -613,6 +766,12 @@ packages:
cpu: [x64]
os: [win32]
'@next/swc-win32-x64-msvc@15.2.1':
resolution: {integrity: sha512-YjqXCl8QGhVlMR8uBftWk0iTmvtntr41PhG1kvzGp0sUP/5ehTM+cwx25hKE54J0CRnHYjSGjSH3gkHEaHIN9g==}
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
'@nodelib/fs.scandir@2.1.5':
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
@@ -880,6 +1039,9 @@ packages:
'@swc/counter@0.1.3':
resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==}
'@swc/helpers@0.5.15':
resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==}
'@swc/helpers@0.5.5':
resolution: {integrity: sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==}
@@ -1576,6 +1738,13 @@ packages:
color-name@1.1.4:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
color-string@1.9.1:
resolution: {integrity: sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==}
color@4.2.3:
resolution: {integrity: sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==}
engines: {node: '>=12.5.0'}
comma-separated-tokens@2.0.3:
resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==}
@@ -1641,6 +1810,10 @@ packages:
resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
engines: {node: '>=6'}
detect-libc@2.0.3:
resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==}
engines: {node: '>=8'}
devlop@1.1.0:
resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==}
@@ -1883,6 +2056,9 @@ packages:
is-alphanumerical@2.0.1:
resolution: {integrity: sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==}
is-arrayish@0.3.2:
resolution: {integrity: sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==}
is-binary-path@2.1.0:
resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==}
engines: {node: '>=8'}
@@ -2351,6 +2527,27 @@ packages:
sass:
optional: true
next@15.2.1:
resolution: {integrity: sha512-zxbsdQv3OqWXybK5tMkPCBKyhIz63RstJ+NvlfkaLMc/m5MwXgz2e92k+hSKcyBpyADhMk2C31RIiaDjUZae7g==}
engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0}
hasBin: true
peerDependencies:
'@opentelemetry/api': ^1.1.0
'@playwright/test': ^1.41.2
babel-plugin-react-compiler: '*'
react: ^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0
react-dom: ^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0
sass: ^1.3.0
peerDependenciesMeta:
'@opentelemetry/api':
optional: true
'@playwright/test':
optional: true
babel-plugin-react-compiler:
optional: true
sass:
optional: true
node-releases@2.0.14:
resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==}
@@ -2611,6 +2808,11 @@ packages:
engines: {node: '>=10'}
hasBin: true
semver@7.7.1:
resolution: {integrity: sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==}
engines: {node: '>=10'}
hasBin: true
serialize-javascript@6.0.2:
resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==}
@@ -2620,6 +2822,10 @@ packages:
set-blocking@2.0.0:
resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
sharp@0.33.5:
resolution: {integrity: sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
shebang-command@2.0.0:
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
engines: {node: '>=8'}
@@ -2643,6 +2849,9 @@ packages:
resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
engines: {node: '>=14'}
simple-swizzle@0.2.2:
resolution: {integrity: sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==}
skmeans@0.9.7:
resolution: {integrity: sha512-hNj1/oZ7ygsfmPZ7ZfN5MUBRoGg1gtpnImuJBgLO0ljQ67DtJuiQaiYdS4lUA6s0KCwnPhGivtC/WRwIZLkHyg==}
@@ -2710,6 +2919,19 @@ packages:
babel-plugin-macros:
optional: true
styled-jsx@5.1.6:
resolution: {integrity: sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==}
engines: {node: '>= 12.0.0'}
peerDependencies:
'@babel/core': '*'
babel-plugin-macros: '*'
react: '>= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0'
peerDependenciesMeta:
'@babel/core':
optional: true
babel-plugin-macros:
optional: true
sucrase@3.35.0:
resolution: {integrity: sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==}
engines: {node: '>=16 || 14 >=14.17'}
@@ -3039,6 +3261,11 @@ snapshots:
dependencies:
postcss: 8.4.38
'@emnapi/runtime@1.3.1':
dependencies:
tslib: 2.8.1
optional: true
'@evilmartians/harmony@1.2.0': {}
'@floating-ui/core@1.6.8':
@@ -3079,6 +3306,81 @@ snapshots:
dependencies:
react: 18.3.1
'@img/sharp-darwin-arm64@0.33.5':
optionalDependencies:
'@img/sharp-libvips-darwin-arm64': 1.0.4
optional: true
'@img/sharp-darwin-x64@0.33.5':
optionalDependencies:
'@img/sharp-libvips-darwin-x64': 1.0.4
optional: true
'@img/sharp-libvips-darwin-arm64@1.0.4':
optional: true
'@img/sharp-libvips-darwin-x64@1.0.4':
optional: true
'@img/sharp-libvips-linux-arm64@1.0.4':
optional: true
'@img/sharp-libvips-linux-arm@1.0.5':
optional: true
'@img/sharp-libvips-linux-s390x@1.0.4':
optional: true
'@img/sharp-libvips-linux-x64@1.0.4':
optional: true
'@img/sharp-libvips-linuxmusl-arm64@1.0.4':
optional: true
'@img/sharp-libvips-linuxmusl-x64@1.0.4':
optional: true
'@img/sharp-linux-arm64@0.33.5':
optionalDependencies:
'@img/sharp-libvips-linux-arm64': 1.0.4
optional: true
'@img/sharp-linux-arm@0.33.5':
optionalDependencies:
'@img/sharp-libvips-linux-arm': 1.0.5
optional: true
'@img/sharp-linux-s390x@0.33.5':
optionalDependencies:
'@img/sharp-libvips-linux-s390x': 1.0.4
optional: true
'@img/sharp-linux-x64@0.33.5':
optionalDependencies:
'@img/sharp-libvips-linux-x64': 1.0.4
optional: true
'@img/sharp-linuxmusl-arm64@0.33.5':
optionalDependencies:
'@img/sharp-libvips-linuxmusl-arm64': 1.0.4
optional: true
'@img/sharp-linuxmusl-x64@0.33.5':
optionalDependencies:
'@img/sharp-libvips-linuxmusl-x64': 1.0.4
optional: true
'@img/sharp-wasm32@0.33.5':
dependencies:
'@emnapi/runtime': 1.3.1
optional: true
'@img/sharp-win32-ia32@0.33.5':
optional: true
'@img/sharp-win32-x64@0.33.5':
optional: true
'@isaacs/cliui@8.0.2':
dependencies:
string-width: 5.1.2
@@ -3150,6 +3452,8 @@ snapshots:
'@next/env@14.2.7': {}
'@next/env@15.2.1': {}
'@next/mdx@13.5.6(@mdx-js/loader@2.3.0(webpack@5.91.0))(@mdx-js/react@2.3.0(react@18.3.1))':
dependencies:
source-map: 0.7.4
@@ -3163,42 +3467,63 @@ snapshots:
'@next/swc-darwin-arm64@14.2.7':
optional: true
'@next/swc-darwin-arm64@15.2.1':
optional: true
'@next/swc-darwin-x64@14.2.15':
optional: true
'@next/swc-darwin-x64@14.2.7':
optional: true
'@next/swc-darwin-x64@15.2.1':
optional: true
'@next/swc-linux-arm64-gnu@14.2.15':
optional: true
'@next/swc-linux-arm64-gnu@14.2.7':
optional: true
'@next/swc-linux-arm64-gnu@15.2.1':
optional: true
'@next/swc-linux-arm64-musl@14.2.15':
optional: true
'@next/swc-linux-arm64-musl@14.2.7':
optional: true
'@next/swc-linux-arm64-musl@15.2.1':
optional: true
'@next/swc-linux-x64-gnu@14.2.15':
optional: true
'@next/swc-linux-x64-gnu@14.2.7':
optional: true
'@next/swc-linux-x64-gnu@15.2.1':
optional: true
'@next/swc-linux-x64-musl@14.2.15':
optional: true
'@next/swc-linux-x64-musl@14.2.7':
optional: true
'@next/swc-linux-x64-musl@15.2.1':
optional: true
'@next/swc-win32-arm64-msvc@14.2.15':
optional: true
'@next/swc-win32-arm64-msvc@14.2.7':
optional: true
'@next/swc-win32-arm64-msvc@15.2.1':
optional: true
'@next/swc-win32-ia32-msvc@14.2.15':
optional: true
@@ -3211,6 +3536,9 @@ snapshots:
'@next/swc-win32-x64-msvc@14.2.7':
optional: true
'@next/swc-win32-x64-msvc@15.2.1':
optional: true
'@nodelib/fs.scandir@2.1.5':
dependencies:
'@nodelib/fs.stat': 2.0.5
@@ -3459,6 +3787,10 @@ snapshots:
'@swc/counter@0.1.3': {}
'@swc/helpers@0.5.15':
dependencies:
tslib: 2.8.1
'@swc/helpers@0.5.5':
dependencies:
'@swc/counter': 0.1.3
@@ -4691,11 +5023,23 @@ snapshots:
next: 14.2.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
react: 18.3.1
'@vercel/analytics@1.3.1(next@15.2.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)':
dependencies:
server-only: 0.0.1
optionalDependencies:
next: 15.2.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
react: 18.3.1
'@vercel/speed-insights@1.0.12(next@14.2.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)':
optionalDependencies:
next: 14.2.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
react: 18.3.1
'@vercel/speed-insights@1.0.12(next@15.2.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)':
optionalDependencies:
next: 15.2.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
react: 18.3.1
'@webassemblyjs/ast@1.14.1':
dependencies:
'@webassemblyjs/helper-numbers': 1.13.2
@@ -4922,6 +5266,18 @@ snapshots:
color-name@1.1.4: {}
color-string@1.9.1:
dependencies:
color-name: 1.1.4
simple-swizzle: 0.2.2
optional: true
color@4.2.3:
dependencies:
color-convert: 2.0.1
color-string: 1.9.1
optional: true
comma-separated-tokens@2.0.3: {}
commander@10.0.1: {}
@@ -4974,6 +5330,9 @@ snapshots:
dequal@2.0.3: {}
detect-libc@2.0.3:
optional: true
devlop@1.1.0:
dependencies:
dequal: 2.0.3
@@ -5234,6 +5593,9 @@ snapshots:
is-alphabetical: 2.0.1
is-decimal: 2.0.1
is-arrayish@0.3.2:
optional: true
is-binary-path@2.1.0:
dependencies:
binary-extensions: 2.3.0
@@ -5997,6 +6359,12 @@ snapshots:
react: 18.3.1
react-dom: 18.3.1(react@18.3.1)
next-themes@0.2.1(next@15.2.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
dependencies:
next: 15.2.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
react: 18.3.1
react-dom: 18.3.1(react@18.3.1)
next@14.2.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
dependencies:
'@next/env': 14.2.15
@@ -6047,6 +6415,31 @@ snapshots:
- '@babel/core'
- babel-plugin-macros
next@15.2.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
dependencies:
'@next/env': 15.2.1
'@swc/counter': 0.1.3
'@swc/helpers': 0.5.15
busboy: 1.6.0
caniuse-lite: 1.0.30001683
postcss: 8.4.31
react: 18.3.1
react-dom: 18.3.1(react@18.3.1)
styled-jsx: 5.1.6(react@18.3.1)
optionalDependencies:
'@next/swc-darwin-arm64': 15.2.1
'@next/swc-darwin-x64': 15.2.1
'@next/swc-linux-arm64-gnu': 15.2.1
'@next/swc-linux-arm64-musl': 15.2.1
'@next/swc-linux-x64-gnu': 15.2.1
'@next/swc-linux-x64-musl': 15.2.1
'@next/swc-win32-arm64-msvc': 15.2.1
'@next/swc-win32-x64-msvc': 15.2.1
sharp: 0.33.5
transitivePeerDependencies:
- '@babel/core'
- babel-plugin-macros
node-releases@2.0.14: {}
node-releases@2.0.18: {}
@@ -6310,6 +6703,9 @@ snapshots:
semver@7.6.1: {}
semver@7.7.1:
optional: true
serialize-javascript@6.0.2:
dependencies:
randombytes: 2.1.0
@@ -6318,6 +6714,33 @@ snapshots:
set-blocking@2.0.0: {}
sharp@0.33.5:
dependencies:
color: 4.2.3
detect-libc: 2.0.3
semver: 7.7.1
optionalDependencies:
'@img/sharp-darwin-arm64': 0.33.5
'@img/sharp-darwin-x64': 0.33.5
'@img/sharp-libvips-darwin-arm64': 1.0.4
'@img/sharp-libvips-darwin-x64': 1.0.4
'@img/sharp-libvips-linux-arm': 1.0.5
'@img/sharp-libvips-linux-arm64': 1.0.4
'@img/sharp-libvips-linux-s390x': 1.0.4
'@img/sharp-libvips-linux-x64': 1.0.4
'@img/sharp-libvips-linuxmusl-arm64': 1.0.4
'@img/sharp-libvips-linuxmusl-x64': 1.0.4
'@img/sharp-linux-arm': 0.33.5
'@img/sharp-linux-arm64': 0.33.5
'@img/sharp-linux-s390x': 0.33.5
'@img/sharp-linux-x64': 0.33.5
'@img/sharp-linuxmusl-arm64': 0.33.5
'@img/sharp-linuxmusl-x64': 0.33.5
'@img/sharp-wasm32': 0.33.5
'@img/sharp-win32-ia32': 0.33.5
'@img/sharp-win32-x64': 0.33.5
optional: true
shebang-command@2.0.0:
dependencies:
shebang-regex: 3.0.0
@@ -6349,6 +6772,11 @@ snapshots:
signal-exit@4.1.0: {}
simple-swizzle@0.2.2:
dependencies:
is-arrayish: 0.3.2
optional: true
skmeans@0.9.7: {}
source-map-js@1.2.0: {}
@@ -6404,6 +6832,11 @@ snapshots:
client-only: 0.0.1
react: 18.3.1
styled-jsx@5.1.6(react@18.3.1):
dependencies:
client-only: 0.0.1
react: 18.3.1
sucrase@3.35.0:
dependencies:
'@jridgewell/gen-mapping': 0.3.5

View File

@@ -16,6 +16,9 @@
"preview": "vite preview"
},
"dependencies": {
"@twind/core": "^1.1.3",
"@twind/preset-autoprefix": "^1.0.7",
"@twind/preset-tailwind": "^1.1.4",
"cojson": "workspace:*",
"jazz-react-core": "workspace:*",
"jazz-tools": "workspace:*"

View File

@@ -1 +1,4 @@
// Import Twind setup
import "./twind.js";
export { JazzInspector } from "./viewer/new-app.js";

View File

@@ -0,0 +1,54 @@
import { defineConfig } from "@twind/core";
import presetAutoprefix from "@twind/preset-autoprefix";
import presetTailwind from "@twind/preset-tailwind";
const stonePalette = {
50: "oklch(0.988281 0.002 75)",
100: "oklch(0.980563 0.002 75)",
200: "oklch(0.917969 0.002 75)",
300: "oklch(0.853516 0.002 75)",
400: "oklch(0.789063 0.002 75)",
500: "oklch(0.726563 0.002 75)",
600: "oklch(0.613281 0.002 75)",
700: "oklch(0.523438 0.002 75)",
800: "oklch(0.412109 0.002 75)",
900: "oklch(0.302734 0.002 75)",
925: "oklch(0.220000 0.002 75)",
950: "oklch(0.193359 0.002 75)",
};
const stonePaletteWithAlpha = { ...stonePalette };
Object.keys(stonePalette).forEach((key) => {
// @ts-ignore
stonePaletteWithAlpha[key] = stonePaletteWithAlpha[key].replace(
")",
"/ <alpha-value>)",
);
});
export default defineConfig({
presets: [presetAutoprefix(), presetTailwind()],
theme: {
extend: {
colors: {
stone: stonePaletteWithAlpha,
gray: stonePaletteWithAlpha,
blue: {
50: "#f5f7ff",
100: "#ebf0fe",
200: "#d6e0fd",
300: "#b3c7fc",
400: "#8aa6f9",
500: "#5870F1",
600: "#3651E7",
700: "#3313F7",
800: "#2A12BE",
900: "#12046A",
950: "#1e1b4b",
DEFAULT: "#3313F7",
},
},
},
},
});

View File

@@ -0,0 +1,8 @@
import { install, tw } from "@twind/core";
import config from "./twind.config";
// Install Twind globally
install(config);
// Export the tw function for use in components
export { tw };

View File

@@ -11,41 +11,10 @@ export const Breadcrumbs: React.FC<BreadcrumbsProps> = ({
onBreadcrumbClick,
}) => {
return (
<div
style={{
position: "relative",
zIndex: 20,
backgroundColor: "rgba(129, 140, 248, 0.1)", // indigo-400/10 equivalent
backdropFilter: "blur(4px)",
borderRadius: "0.5rem",
display: "inline-flex",
paddingLeft: "0.5rem",
paddingRight: "0.5rem",
paddingTop: "0.25rem",
paddingBottom: "0.25rem",
whiteSpace: "pre",
transition: "all",
alignItems: "center",
gap: "0.25rem",
minHeight: "2.5rem",
}}
>
<div className="relative z-20 bg-blue-400/10 backdrop-blur-sm rounded-lg inline-flex px-2 py-1 whitespace-pre transition-all items-center gap-1 min-h-[2.5rem]">
<button
onClick={() => onBreadcrumbClick(-1)}
style={{
display: "flex",
alignItems: "center",
justifyContent: "center",
padding: "0.25rem",
borderRadius: "0.125rem",
transition: "colors",
}}
onMouseOver={(e) =>
(e.currentTarget.style.backgroundColor = "rgba(99, 102, 241, 0.1)")
}
onMouseOut={(e) =>
(e.currentTarget.style.backgroundColor = "transparent")
}
className="flex items-center justify-center p-1 rounded-sm transition-colors"
aria-label="Go to home"
>
Start
@@ -54,26 +23,16 @@ export const Breadcrumbs: React.FC<BreadcrumbsProps> = ({
return (
<span
key={index}
style={{
display: "inline-block",
paddingLeft: index === 0 ? "0.25rem" : "0",
paddingRight: index === path.length - 1 ? "0.25rem" : "0",
}}
className={`inline-block ${index === 0 ? "pl-1" : "pl-0"} ${
index === path.length - 1 ? "pr-1" : "pr-0"
}`}
>
{index === 0 ? null : (
<span style={{ color: "rgba(99, 102, 241, 0.3)" }}>{" / "}</span>
<span className="text-blue-600/30">{" / "}</span>
)}
<button
onClick={() => onBreadcrumbClick(index)}
style={{
color: "rgb(67, 56, 202)",
}}
onMouseOver={(e) =>
(e.currentTarget.style.textDecoration = "underline")
}
onMouseOut={(e) =>
(e.currentTarget.style.textDecoration = "none")
}
className="text-blue hover:underline dark:text-blue-400"
>
{index === 0 ? page.name || "Root" : page.name}
</button>

View File

@@ -161,7 +161,7 @@ const LabelContentPair = ({
content: React.ReactNode;
}) => {
return (
<div style={{ display: "flex", flexDirection: "column", gap: "0.375rem" }}>
<div className="flex flex-col gap-1.5">
<span>{label}</span>
<span>{content}</span>
</div>
@@ -219,34 +219,12 @@ function RenderCoBinaryStream({
const sizeInKB = (file.totalSize || 0) / 1024;
return (
<div
style={{
marginTop: "2rem",
display: "flex",
flexDirection: "column",
gap: "2rem",
}}
>
<div
style={{
display: "grid",
gridTemplateColumns: "repeat(3, 1fr)",
gap: "0.5rem",
maxWidth: "48rem",
}}
>
<div className="mt-8 flex flex-col gap-8">
<div className="grid grid-cols-3 gap-2 max-w-3xl">
<LabelContentPair
label="Mime Type"
content={
<span
style={{
fontFamily: "monospace",
backgroundColor: "rgb(243 244 246)",
borderRadius: "0.25rem",
padding: "0.25rem 0.5rem",
fontSize: "0.875rem",
}}
>
<span className="font-mono bg-gray-100 rounded px-2 py-1 text-sm dark:bg-stone-900">
{mimeType || "No mime type"}
</span>
}
@@ -275,13 +253,7 @@ function RenderCoBinaryStream({
<LabelContentPair
label="Preview"
content={
<div
style={{
backgroundColor: "rgb(249 250 251)",
padding: "0.75rem",
borderRadius: "0.125rem",
}}
>
<div className="bg-gray-50 dark:bg-gray-925 p-3 rounded">
<RenderBlobImage blob={blob} />
</div>
}
@@ -302,30 +274,10 @@ function RenderCoStream({
const userCoIds = streamPerUser.map((stream) => stream.split("_session")[0]);
return (
<div
style={{
display: "grid",
gridTemplateColumns: "repeat(3, 1fr)",
gap: "0.5rem",
}}
>
<div className="grid grid-cols-3 gap-2">
{userCoIds.map((id, idx) => (
<div
style={{
padding: "0.75rem",
borderRadius: "0.5rem",
overflow: "hidden",
backgroundColor: "white",
border: "1px solid #e5e7eb",
cursor: "pointer",
boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
transition: "background-color 0.2s",
}}
onMouseOver={(e) =>
(e.currentTarget.style.backgroundColor =
"rgba(243, 244, 246, 0.05)")
}
onMouseOut={(e) => (e.currentTarget.style.backgroundColor = "white")}
className="p-3 rounded-lg overflow-hidden border border-gray-200 cursor-pointer shadow-sm hover:bg-gray-100/5"
key={id}
>
<AccountOrGroupPreview coId={id as CoID<RawCoValue>} node={node} />

View File

@@ -16,66 +16,26 @@ export function GridView({
const entries = Object.entries(data);
return (
<div
style={{
display: "grid",
gridTemplateColumns: "1fr",
gap: "1rem",
padding: "0.5rem",
}}
>
<div className="grid grid-cols-1 gap-4 p-2">
{entries.map(([key, child], childIndex) => (
<div
key={childIndex}
style={{
padding: "0.75rem",
borderRadius: "0.5rem",
overflow: "hidden",
transition: "background-color 0.2s",
...(isCoId(child)
? {
backgroundColor: "white",
border: "1px solid #e5e7eb",
cursor: "pointer",
boxShadow: "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
":hover": {
backgroundColor: "rgba(243, 244, 246, 0.05)",
},
}
: {
backgroundColor: "rgb(249, 250, 251)",
}),
}}
className={`p-3 rounded-lg overflow-hidden transition-colors ${
isCoId(child)
? " border border-gray-200 cursor-pointer shadow-sm hover:bg-gray-100/5"
: "bg-gray-50 dark:bg-gray-925"
}`}
onClick={() =>
isCoId(child) &&
onNavigate([{ coId: child as CoID<RawCoValue>, name: key }])
}
>
<h3
style={{
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
>
<h3 className="overflow-hidden text-ellipsis whitespace-nowrap">
{isCoId(child) ? (
<span
style={{
fontWeight: 500,
display: "flex",
justifyContent: "space-between",
}}
>
<span className="font-medium flex justify-between">
{key}
<div
style={{
padding: "0.25rem 0.5rem",
fontSize: "0.75rem",
backgroundColor: "rgb(243, 244, 246)",
borderRadius: "0.25rem",
}}
>
<div className="py-1 px-2 text-xs bg-gray-100 rounded dark:bg-gray-900">
<ResolveIcon coId={child as CoID<RawCoValue>} node={node} />
</div>
</span>
@@ -83,7 +43,7 @@ export function GridView({
<span>{key}</span>
)}
</h3>
<div style={{ marginTop: "0.5rem", fontSize: "0.875rem" }}>
<div className="mt-2 text-sm">
{isCoId(child) ? (
<CoMapPreview coId={child as CoID<RawCoValue>} node={node} />
) : (

View File

@@ -5,7 +5,15 @@ import { Breadcrumbs } from "./breadcrumbs.js";
import { PageStack } from "./page-stack.js";
import { usePagePath } from "./use-page-path.js";
export function JazzInspector() {
type Position =
| "bottom right"
| "bottom left"
| "top right"
| "top left"
| "right"
| "left";
export function JazzInspector({ position = "right" }: { position?: Position }) {
const [open, setOpen] = useState(false);
const [coValueId, setCoValueId] = useState<CoID<RawCoValue> | "">("");
const { path, addPages, goToIndex, goBack, setPage } = usePagePath();
@@ -18,50 +26,67 @@ export function JazzInspector() {
if (coValueId) {
setPage(coValueId);
}
setCoValueId("");
};
const positionClasses = {
"bottom right": "bottom-0 right-0",
"bottom left": "bottom-0 left-0",
"top right": "top-0 right-0",
"top left": "top-0 left-0",
right: "right-0 top-1/2 -translate-y-1/2",
left: "left-0 top-1/2 -translate-y-1/2",
};
if (!open) {
return (
<button
onClick={() => setOpen(true)}
style={{
position: "fixed",
bottom: 0,
right: 0,
margin: "1rem",
backgroundColor: "white",
border: "1px solid #e5e7eb",
borderRadius: "0.5rem",
padding: "6px",
}}
className={`fixed w-10 h-10 inline-block bottom-0 right-0 m-4 bg-white border rounded-md shadow-md p-1.5 ${positionClasses[position]}`}
>
Jazz Inspector
<svg
className="w-full h-auto relative -left-px text-blue"
xmlns="http://www.w3.org/2000/svg"
width="119"
height="115"
viewBox="0 0 119 115"
fill="none"
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M118.179 23.8277V0.167999C99.931 7.5527 79.9854 11.6192 59.0897 11.6192C47.1466 11.6192 35.5138 10.2908 24.331 7.7737V30.4076V60.1508C23.2955 59.4385 22.1568 58.8458 20.9405 58.3915C18.1732 57.358 15.128 57.0876 12.1902 57.6145C9.2524 58.1414 6.5539 59.4419 4.4358 61.3516C2.3178 63.2613 0.875401 65.6944 0.291001 68.3433C-0.293399 70.9921 0.00659978 73.7377 1.1528 76.2329C2.2991 78.728 4.2403 80.861 6.7308 82.361C9.2214 83.862 12.1495 84.662 15.1448 84.662C15.6054 84.662 15.8365 84.662 16.0314 84.659C26.5583 84.449 35.042 75.9656 35.2513 65.4386C35.2534 65.3306 35.2544 65.2116 35.2548 65.0486L35.2552 64.7149V64.5521V61.0762V32.1993C43.0533 33.2324 51.0092 33.7656 59.0897 33.7656C59.6696 33.7656 60.2489 33.7629 60.8276 33.7574V89.696C59.792 88.983 58.6533 88.391 57.437 87.936C54.6697 86.903 51.6246 86.632 48.6867 87.159C45.7489 87.686 43.0504 88.987 40.9323 90.896C38.8143 92.806 37.3719 95.239 36.7875 97.888C36.2032 100.537 36.5031 103.283 37.6494 105.778C38.7956 108.273 40.7368 110.405 43.2273 111.906C45.7179 113.406 48.646 114.207 51.6414 114.207C52.1024 114.207 52.3329 114.207 52.5279 114.203C63.0548 113.994 71.5385 105.51 71.7478 94.983C71.7517 94.788 71.7517 94.558 71.7517 94.097V90.621V33.3266C83.962 32.4768 95.837 30.4075 107.255 27.2397V59.9017C106.219 59.1894 105.081 58.5966 103.864 58.1424C101.097 57.1089 98.052 56.8384 95.114 57.3653C92.176 57.8922 89.478 59.1927 87.36 61.1025C85.242 63.0122 83.799 65.4453 83.215 68.0941C82.631 70.743 82.931 73.4886 84.077 75.9837C85.223 78.4789 87.164 80.612 89.655 82.112C92.145 83.612 95.073 84.413 98.069 84.413C98.53 84.413 98.76 84.413 98.955 84.409C109.482 84.2 117.966 75.7164 118.175 65.1895C118.179 64.9945 118.179 64.764 118.179 64.3029V60.8271V23.8277Z"
fill="currentColor"
/>
</svg>
<span className="sr-only">Open Jazz Inspector</span>
</button>
);
}
return (
<div
style={{
position: "fixed",
bottom: 0,
left: 0,
width: "100%",
backgroundColor: "white",
borderTop: "1px solid #e5e7eb",
padding: "1rem",
}}
>
<div
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
marginBottom: "1rem",
}}
>
<div className="fixed bottom-0 left-0 w-full bg-white border-t border-gray-200 p-4 dark:border-stone-900 dark:bg-stone-925">
<div className="flex items-center gap-4 mb-4">
<Breadcrumbs path={path} onBreadcrumbClick={goToIndex} />
<button onClick={() => setOpen(false)}>Close</button>
<div className="flex-1">
<form onSubmit={handleCoValueIdSubmit}>
{path.length !== 0 && (
<input
className="border p-2 rounded-lg min-w-[21rem] font-mono"
placeholder="co_z1234567890abcdef123456789"
value={coValueId}
onChange={(e) =>
setCoValueId(e.target.value as CoID<RawCoValue>)
}
/>
)}
</form>
</div>
<button
className="ml-auto"
type="button"
onClick={() => setOpen(false)}
>
Close
</button>
</div>
<PageStack
@@ -73,80 +98,32 @@ export function JazzInspector() {
<form
onSubmit={handleCoValueIdSubmit}
aria-hidden={path.length !== 0}
style={{
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
gap: "0.5rem",
height: "100%",
width: "100%",
marginBottom: "5rem",
transition: "all 150ms",
opacity: path.length > 0 ? 0 : 1,
transform:
path.length > 0 ? "translateY(-0.5rem) scale(0.95)" : "none",
}}
className={`flex flex-col justify-center items-center gap-2 h-full w-full mb-20 transition-all duration-150 ${
path.length > 0
? "opacity-0 translate-y-[-0.5rem] scale-95"
: "opacity-100"
}`}
>
<fieldset
style={{
display: "flex",
flexDirection: "column",
gap: "0.5rem",
fontSize: "0.875rem",
}}
>
<h2
style={{
fontSize: "1.875rem",
fontWeight: 500,
color: "#030712",
textAlign: "center",
marginBottom: "1rem",
}}
>
<fieldset className="flex flex-col gap-2 text-sm">
<h2 className="text-lg font-medium mb-4 text-stone-900 dark:text-white">
Jazz CoValue Inspector
</h2>
<input
style={{
border: "1px solid #e5e7eb",
padding: "1rem",
borderRadius: "0.5rem",
minWidth: "21rem",
fontFamily: "monospace",
}}
className="border border-gray-200 p-4 rounded-lg min-w-[21rem] font-mono"
placeholder="co_z1234567890abcdef123456789"
value={coValueId}
onChange={(e) => setCoValueId(e.target.value as CoID<RawCoValue>)}
/>
<button
type="submit"
style={{
backgroundColor: "rgb(99 102 241)",
color: "white",
padding: "0.5rem 1rem",
borderRadius: "0.375rem",
}}
onMouseOver={(e) =>
(e.currentTarget.style.backgroundColor =
"rgba(99 102 241, 0.8)")
}
onMouseOut={(e) =>
(e.currentTarget.style.backgroundColor = "rgb(99 102 241)")
}
className="bg-blue text-white py-2 px-4 rounded-md hover:bg-blue-800"
>
Inspect
</button>
<hr />
<button
type="button"
style={{
border: "1px solid #e5e7eb",
display: "inline-block",
padding: "0.375rem 0.5rem",
color: "black",
borderRadius: "0.375rem",
}}
className="border border-gray-200 inline-block py-1.5 px-2 rounded-md"
onClick={() => {
setCoValueId(me._raw.id);
setPage(me._raw.id);

View File

@@ -27,28 +27,8 @@ export function PageStack({
const index = path.length - 1;
return (
<div
style={{
position: "relative",
marginTop: "1rem",
height: "40vh",
overflowY: "auto",
}}
>
{children && (
<div
style={{
position: "absolute",
top: 0,
right: 0,
bottom: 0,
left: 0,
paddingBottom: "5rem",
}}
>
{children}
</div>
)}
<div className="relative mt-4 h-[40vh] overflow-y-auto">
{children && <div className="absolute inset-0 pb-20">{children}</div>}
{node && page && (
<Page
coId={page.coId}
@@ -57,15 +37,13 @@ export function PageStack({
onHeaderClick={goBack}
onNavigate={addPages}
isTopLevel={index === path.length - 1}
className="transition-transform transition-opacity duration-300 ease-out"
style={{
transform: `translateZ(${(index - path.length + 1) * 200}px) scale(${
1 - (path.length - index - 1) * 0.05
}) translateY(${-(index - path.length + 1) * -4}%)`,
opacity: 1 - (path.length - index - 1) * 0.05,
zIndex: index,
transitionProperty: "transform, opacity",
transitionDuration: "0.3s",
transitionTimingFunction: "ease-out",
}}
/>
)}

View File

@@ -16,6 +16,7 @@ type PageProps = {
onHeaderClick?: () => void;
isTopLevel?: boolean;
style: React.CSSProperties;
className?: string;
};
export function Page({
@@ -25,6 +26,7 @@ export function Page({
onNavigate,
onHeaderClick,
style,
className = "",
isTopLevel,
}: PageProps) {
const { value, snapshot, type, extendedType } = useResolvedCoValue(
@@ -52,30 +54,15 @@ export function Page({
return (
<div
style={{
position: "absolute",
inset: 0,
backgroundColor: "white",
borderWidth: "1px",
borderColor: "rgba(0, 0, 0, 0.05)",
borderRadius: "0.75rem",
boxShadow:
"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",
padding: "1.5rem",
width: "100%",
height: "100%",
backgroundClip: "padding-box",
}}
style={style}
className={
className +
" absolute z-10 inset-0 border rounded-xl shadow-lg p-6 w-full h-full bg-clip-padding"
}
>
{!isTopLevel && (
<div
style={{
position: "absolute",
left: 0,
right: 0,
top: 0,
height: "2.5rem",
}}
className="absolute left-0 right-0 top-0 h-10"
aria-label="Back"
onClick={() => {
onHeaderClick?.();
@@ -83,72 +70,30 @@ export function Page({
aria-hidden="true"
></div>
)}
<div
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
marginBottom: "1rem",
}}
>
<div
style={{ display: "flex", flexDirection: "column", gap: "0.5rem" }}
>
<h2
style={{
fontSize: "1.5rem",
fontWeight: "700",
display: "flex",
alignItems: "flex-start",
flexDirection: "column",
gap: "0.25rem",
}}
>
<div className="flex justify-between items-center mb-4">
<div className="flex flex-col gap-2">
<h2 className="text-2xl font-bold flex flex-col items-start gap-1">
<span>
{name}
{typeof snapshot === "object" && "name" in snapshot ? (
<span style={{ color: "rgb(75, 85, 99)", fontWeight: "500" }}>
<span className="text-gray-600 font-medium">
{" "}
{(snapshot as { name: string }).name}
</span>
) : null}
</span>
</h2>
<div style={{ display: "flex", alignItems: "center", gap: "0.5rem" }}>
<span
style={{
fontSize: "0.75rem",
color: "rgb(55, 65, 81)",
fontWeight: "500",
padding: "0.125rem 0.25rem",
marginLeft: "-0.125rem",
borderRadius: "0.25rem",
backgroundColor: "rgba(55, 65, 81, 0.05)",
display: "inline-block",
fontFamily: "monospace",
}}
>
<div className="flex items-center gap-2">
<span className="text-xs text-gray-700 font-medium py-0.5 px-1 -ml-0.5 rounded bg-gray-700/5 inline-block font-mono">
{type && <TypeIcon type={type} extendedType={extendedType} />}
</span>
<span
style={{
fontSize: "0.75rem",
color: "rgb(55, 65, 81)",
fontWeight: "500",
padding: "0.125rem 0.25rem",
marginLeft: "-0.125rem",
borderRadius: "0.25rem",
backgroundColor: "rgba(55, 65, 81, 0.05)",
display: "inline-block",
fontFamily: "monospace",
}}
>
<span className="text-xs text-gray-700 font-medium py-0.5 px-1 -ml-0.5 rounded bg-gray-700/5 inline-block font-mono">
{coId}
</span>
</div>
</div>
</div>
<div style={{ overflow: "auto", maxHeight: "calc(100% - 4rem)" }}>
<div className="overflow-auto max-h-[calc(100%-4rem)]">
{type === "costream" ? (
<CoStreamView
data={snapshot}
@@ -162,13 +107,7 @@ export function Page({
<TableView data={snapshot} node={node} onNavigate={onNavigate} />
)}
{extendedType !== "account" && extendedType !== "group" && (
<div
style={{
fontSize: "0.75rem",
color: "rgb(107, 114, 128)",
marginTop: "1rem",
}}
>
<div className="text-xs text-gray-500 mt-4">
Owned by{" "}
<AccountOrGroupPreview
coId={value.group.id}

View File

@@ -51,45 +51,23 @@ export function TableView({
return (
<div>
<table
style={{
minWidth: "100%",
borderSpacing: 0,
borderCollapse: "collapse",
}}
>
<thead
style={{
position: "sticky",
top: 0,
borderBottom: "1px solid #e5e7eb",
}}
>
<table className="min-w-full border-spacing-0 border-collapse">
<thead className="sticky top-0 border-b border-gray-200">
<tr>
{["", ...keys].map((key) => (
<th
key={key}
style={{
padding: "0.75rem 1rem",
backgroundColor: "#f9fafb",
textAlign: "left",
fontSize: "0.75rem",
fontWeight: 500,
color: "#6b7280",
borderRadius: "0.25rem",
}}
className="p-3 bg-gray-50 dark:bg-gray-925 text-left text-xs font-medium text-gray-500 rounded"
>
{key}
</th>
))}
</tr>
</thead>
<tbody
style={{ backgroundColor: "white", borderTop: "1px solid #e5e7eb" }}
>
<tbody className=" border-t border-gray-200">
{resolvedRows.slice(0, visibleRowsCount).map((item, index) => (
<tr key={index}>
<td style={{ padding: "0.25rem 0.25rem" }}>
<td className="p-1">
<button
onClick={() =>
onNavigate([
@@ -99,21 +77,7 @@ export function TableView({
},
])
}
style={{
padding: "1rem",
whiteSpace: "nowrap",
fontSize: "0.875rem",
color: "#6b7280",
borderRadius: "0.25rem",
}}
onMouseOver={(e) => {
e.currentTarget.style.backgroundColor = "#f3f4f6";
e.currentTarget.style.color = "#3b82f6";
}}
onMouseOut={(e) => {
e.currentTarget.style.backgroundColor = "transparent";
e.currentTarget.style.color = "#6b7280";
}}
className="p-4 whitespace-nowrap text-sm text-gray-500 rounded hover:bg-gray-100 hover:text-blue-500"
>
<LinkIcon />
</button>
@@ -121,12 +85,7 @@ export function TableView({
{keys.map((key) => (
<td
key={key}
style={{
padding: "1rem",
whiteSpace: "nowrap",
fontSize: "0.875rem",
color: "#6b7280",
}}
className="p-4 whitespace-nowrap text-sm text-gray-500"
>
<ValueRenderer
json={(item.snapshot as JsonObject)[key]}
@@ -153,38 +112,18 @@ export function TableView({
))}
</tbody>
</table>
<div
style={{
padding: "1rem 0",
color: "#6b7280",
display: "flex",
alignItems: "center",
justifyContent: "space-between",
gap: "0.5rem",
}}
>
<div className="py-4 text-gray-500 flex items-center justify-between gap-2">
<span>
Showing {Math.min(visibleRowsCount, coIdArray.length)} of{" "}
{coIdArray.length}
</span>
{hasMore && (
<div style={{ textAlign: "center" }}>
<div className="text-center">
<button
onClick={loadMore}
style={{
padding: "0.5rem 1rem",
backgroundColor: "#3b82f6",
color: "white",
borderRadius: "0.25rem",
}}
onMouseOver={(e) => {
e.currentTarget.style.backgroundColor = "#2563eb";
}}
onMouseOut={(e) => {
e.currentTarget.style.backgroundColor = "#3b82f6";
}}
className="px-4 py-2 bg-blue text-white rounded hover:bg-blue-800"
>
Load More
Load more
</button>
</div>
)}

View File

@@ -25,7 +25,7 @@ export const TypeIcon = ({
const iconKey = extendedType || type;
const icon = iconMap[iconKey as keyof typeof iconMap];
return icon ? <span style={{ fontFamily: "monospace" }}>{icon}</span> : null;
return icon ? <span className="font-mono">{icon}</span> : null;
};
export const ResolveIcon = ({
@@ -38,17 +38,10 @@ export const ResolveIcon = ({
const { type, extendedType, snapshot } = useResolvedCoValue(coId, node);
if (snapshot === "unavailable" && !type) {
return <div style={{ color: "#4B5563", fontWeight: 500 }}>Unavailable</div>;
return <div className="text-gray-600 font-medium">Unavailable</div>;
}
if (!type)
return (
<div
style={{ whiteSpace: "pre", width: "3.5rem", fontFamily: "monospace" }}
>
{" "}
</div>
);
if (!type) return <div className="whitespace-pre w-14 font-mono"> </div>;
return <TypeIcon type={type} extendedType={extendedType} />;
};

View File

@@ -17,32 +17,24 @@ export function ValueRenderer({
compact?: boolean;
onCoIDClick?: (childNode: CoID<RawCoValue>) => void;
}) {
const [isExpanded, setIsExpanded] = useState(false);
if (typeof json === "undefined" || json === undefined) {
return <span style={{ color: "#9CA3AF" }}>undefined</span>;
return <span className="text-gray-400">undefined</span>;
}
if (json === null) {
return <span style={{ color: "#9CA3AF" }}>null</span>;
return <span className="text-gray-400">null</span>;
}
if (typeof json === "string" && json.startsWith("co_")) {
const linkStyle = onCoIDClick
? {
color: "#3B82F6",
cursor: "pointer",
display: "inline-flex",
gap: "0.25rem",
alignItems: "center",
}
: {
display: "inline-flex",
gap: "0.25rem",
alignItems: "center",
};
const linkClasses = onCoIDClick
? "text-blue-500 cursor-pointer inline-flex gap-1 items-center"
: "inline-flex gap-1 items-center";
return (
<span
style={linkStyle}
className={linkClasses}
onClick={() => {
onCoIDClick?.(json as CoID<RawCoValue>);
}}
@@ -55,33 +47,22 @@ export function ValueRenderer({
if (typeof json === "string") {
return (
<span style={{ color: "#064E3B", fontFamily: "monospace" }}>{json}</span>
<span className="text-teal-900 font-mono dark:text-teal-200">{json}</span>
);
}
if (typeof json === "number") {
return <span style={{ color: "#A855F7" }}>{json}</span>;
return <span className="text-purple-500 dark:text-purple-200">{json}</span>;
}
if (typeof json === "boolean") {
const booleanStyle = {
color: json ? "#15803D" : "#B45309",
backgroundColor: json
? "rgba(34, 197, 94, 0.05)"
: "rgba(245, 158, 11, 0.05)",
fontFamily: "monospace",
display: "inline-block",
padding: "0.125rem 0.25rem",
borderRadius: "0.25rem",
};
return <span style={booleanStyle}>{json.toString()}</span>;
}
if (Array.isArray(json)) {
return (
<span title={JSON.stringify(json)}>
Array <span style={{ color: "#6B7280" }}>({json.length})</span>
<span
className={`inline-block py-0.5 px-1 rounded ${
json ? "text-green-700 bg-green-50" : "text-amber-700 bg-amber-50"
} font-mono`}
>
{json.toString()}
</span>
);
}
@@ -90,23 +71,31 @@ export function ValueRenderer({
return (
<span
title={JSON.stringify(json, null, 2)}
style={{
display: "inline-block",
maxWidth: "16rem",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
className="inline-block max-w-64"
>
{compact ? (
<span>
Object{" "}
<span style={{ color: "#6B7280" }}>
({Object.keys(json).length})
</span>
<span className="text-gray-500">({Object.keys(json).length})</span>
<pre className="mt-1 text-sm whitespace-pre-wrap">
{isExpanded
? JSON.stringify(json, null, 2)
: JSON.stringify(json, null, 2)
.split("\n")
.slice(0, 3)
.join("\n") + (Object.keys(json).length > 2 ? "\n..." : "")}
</pre>
<button
onClick={() => setIsExpanded(!isExpanded)}
className="text-xs text-gray-500 hover:text-gray-700"
>
{isExpanded ? "Show less" : "Show more"}
</button>
</span>
) : (
JSON.stringify(json, null, 2)
<pre className="whitespace-pre-wrap">
{JSON.stringify(json, null, 2)}
</pre>
)}
</span>
);
@@ -131,22 +120,14 @@ export const CoMapPreview = ({
if (!snapshot) {
return (
<div
style={{
borderRadius: "0.25rem",
backgroundColor: "#F3F4F6",
animation: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
whiteSpace: "pre",
width: "6rem",
}}
>
<div className="rounded bg-gray-100 animate-pulse whitespace-pre w-24">
{" "}
</div>
);
}
if (snapshot === "unavailable" && !value) {
return <div style={{ color: "#6B7280" }}>Unavailable</div>;
return <div className="text-gray-500">Unavailable</div>;
}
if (extendedType === "image" && isBrowserImage(snapshot)) {
@@ -154,16 +135,9 @@ export const CoMapPreview = ({
<div>
<img
src={snapshot.placeholderDataURL}
style={{
width: "2rem",
height: "2rem",
border: "2px solid white",
boxShadow:
"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
margin: "0.5rem 0",
}}
className="w-8 h-8 border-2 border-white shadow my-2"
/>
<span style={{ color: "#6B7280", fontSize: "0.875rem" }}>
<span className="text-gray-500 text-sm">
{snapshot.originalSize[0]} x {snapshot.originalSize[1]}
</span>
</div>
@@ -174,9 +148,7 @@ export const CoMapPreview = ({
return (
<div>
Record{" "}
<span style={{ color: "#6B7280" }}>
({Object.keys(snapshot).length})
</span>
<span className="text-gray-500">({Object.keys(snapshot).length})</span>
</div>
);
}
@@ -185,7 +157,7 @@ export const CoMapPreview = ({
return (
<div>
List{" "}
<span style={{ color: "#6B7280" }}>
<span className="text-gray-500">
({(snapshot as unknown as []).length})
</span>
</div>
@@ -193,19 +165,13 @@ export const CoMapPreview = ({
}
return (
<div style={{ display: "flex", flexDirection: "column", gap: "0.5rem" }}>
<div
style={{
display: "grid",
gridTemplateColumns: "auto 1fr",
gap: "0.5rem",
}}
>
<div className="flex flex-col gap-2">
<div className="grid grid-cols-[auto_1fr] gap-2">
{Object.entries(snapshot)
.slice(0, limit)
.map(([key, value]) => (
<React.Fragment key={key}>
<span style={{ fontWeight: "bold" }}>{key}: </span>
<span className="font-bold">{key}: </span>
<span>
<ValueRenderer json={value} />
</span>
@@ -213,9 +179,7 @@ export const CoMapPreview = ({
))}
</div>
{Object.entries(snapshot).length > limit && (
<div
style={{ textAlign: "left", fontSize: "0.875rem", color: "#6B7280" }}
>
<div className="text-left text-sm text-gray-500">
{Object.entries(snapshot).length - limit} more
</div>
)}
@@ -262,18 +226,13 @@ export function AccountOrGroupPreview({
const displayName = extendedType === "account" ? name || "Account" : "Group";
const displayText = showId ? `${displayName} (${coId})` : displayName;
const props = onClick
? {
onClick: () => onClick(displayName),
style: {
color: "#3B82F6",
cursor: "pointer",
textDecoration: "underline",
},
}
: {
style: { color: "#6B7280" },
};
const className = onClick
? "text-blue cursor-pointer underline dark:text-blue-400"
: "text-gray-500";
return <span {...props}>{displayText}</span>;
return (
<span className={className} onClick={() => onClick?.(displayName)}>
{displayText}
</span>
);
}

View File

@@ -16,7 +16,7 @@ export default defineConfig({
entry: path.resolve(__dirname, "src/app.tsx"),
name: "JazzInspector",
// the proper extensions will be added
fileName: "jazz-inspector",
fileName: "app",
formats: ["es"],
},
},

View File

@@ -39,6 +39,7 @@ import {
subscribeToCoValueWithoutMe,
subscribeToExistingCoValue,
} from "../internal.js";
import { RegisteredAccount } from "../types.js";
import { type Account } from "./account.js";
import { type Group } from "./group.js";
import { RegisteredSchemas } from "./registeredSchemas.js";
@@ -56,7 +57,7 @@ export type SingleCoStreamEntry<Item> = SingleCoFeedEntry<Item>;
export type SingleCoFeedEntry<Item> = {
value: NonNullable<Item> extends CoValue ? NonNullable<Item> | null : Item;
ref: NonNullable<Item> extends CoValue ? Ref<NonNullable<Item>> : never;
by?: Account | null;
by?: RegisteredAccount | null;
madeAt: Date;
tx: CojsonInternalTypes.TransactionID;
};

View File

@@ -30,6 +30,7 @@ import {
subscriptionsScopes,
} from "../internal.js";
import { coValuesCache } from "../lib/cache.js";
import { RegisteredAccount } from "../types.js";
import { type Account } from "./account.js";
import { type Group } from "./group.js";
import { RegisteredSchemas } from "./registeredSchemas.js";
@@ -154,7 +155,7 @@ export class CoList<Item = any> extends Array<Item> implements CoValue {
[idx: number]: {
value?: Item;
ref?: Item extends CoValue ? Ref<Item> : never;
by?: Account;
by?: RegisteredAccount;
madeAt: Date;
};
} {
@@ -275,6 +276,13 @@ export class CoList<Item = any> extends Array<Item> implements CoValue {
return first;
}
/**
* Splice the `CoList` at a given index.
*
* @param start - The index to start the splice.
* @param deleteCount - The number of items to delete.
* @param items - The items to insert.
*/
splice(start: number, deleteCount: number, ...items: Item[]): Item[] {
const deleted = this.slice(start, start + deleteCount);
@@ -286,24 +294,62 @@ export class CoList<Item = any> extends Array<Item> implements CoValue {
this._raw.delete(idxToDelete);
}
let appendAfter = Math.max(start - 1, 0);
for (const item of toRawItems(items as Item[], this._schema[ItemsSym])) {
this._raw.append(item, appendAfter);
appendAfter++;
const rawItems = toRawItems(items as Item[], this._schema[ItemsSym]);
// If there are no items to insert, return the deleted items
if (rawItems.length === 0) {
return deleted;
}
// Fast path for single item insertion
if (rawItems.length === 1) {
const item = rawItems[0];
if (item === undefined) return deleted;
if (start === 0) {
this._raw.prepend(item);
} else {
this._raw.append(item, Math.max(start - 1, 0));
}
return deleted;
}
// Handle multiple items
if (start === 0) {
// Iterate in reverse order without creating a new array
for (let i = rawItems.length - 1; i >= 0; i--) {
const item = rawItems[i];
if (item === undefined) continue;
this._raw.prepend(item);
}
} else {
let appendAfter = Math.max(start - 1, 0);
for (const item of rawItems) {
if (item === undefined) continue;
this._raw.append(item, appendAfter);
appendAfter++;
}
}
return deleted;
}
applyDiff(other: Item[]) {
/**
* Modify the `CoList` to match another list, where the changes are managed internally.
*
* @param result - The resolved list of items.
*/
applyDiff(result: Item[]) {
const current = this._raw.asArray() as Item[];
const cmp = isRefEncoded(this._schema[ItemsSym])
? (aIdx: number, bIdx: number) =>
(current[aIdx] as CoValue).id === (other[bIdx] as CoValue).id
const comparator = isRefEncoded(this._schema[ItemsSym])
? (aIdx: number, bIdx: number) => {
return (
(current[aIdx] as CoValue)?.id === (result[bIdx] as CoValue)?.id
);
}
: undefined;
for (const [from, to, insert] of [
...calcPatch(current, other, cmp),
].reverse()) {
const patches = [...calcPatch(current, result, comparator)];
for (const [from, to, insert] of patches.reverse()) {
this.splice(from, to - from, ...insert);
}
}
@@ -505,6 +551,12 @@ export class CoList<Item = any> extends Array<Item> implements CoValue {
}
}
/**
* Convert an array of items to a raw array of items.
* @param items - The array of items to convert.
* @param itemDescriptor - The descriptor of the items.
* @returns The raw array of items.
*/
function toRawItems<Item>(items: Item[], itemDescriptor: Schema) {
const rawItems =
itemDescriptor === "json"
@@ -560,7 +612,19 @@ const CoListProxyHandler: ProxyHandler<CoList> = {
} else if ("encoded" in itemDescriptor) {
rawValue = itemDescriptor.encoded.encode(value);
} else if (isRefEncoded(itemDescriptor)) {
rawValue = value.id;
if (value === null) {
if (itemDescriptor.optional) {
rawValue = null;
} else {
throw new Error(`Cannot set required reference ${key} to null`);
}
} else if (value?.id) {
rawValue = value.id;
} else {
throw new Error(
`Cannot set reference ${key} to a non-CoValue. Got ${value}`,
);
}
}
target._raw.replace(Number(key), rawValue);
return true;

View File

@@ -36,6 +36,7 @@ import {
subscribeToExistingCoValue,
subscriptionsScopes,
} from "../internal.js";
import { RegisteredAccount } from "../types.js";
import { type Account } from "./account.js";
import { type Group } from "./group.js";
import { RegisteredSchemas } from "./registeredSchemas.js";
@@ -43,7 +44,7 @@ import { RegisteredSchemas } from "./registeredSchemas.js";
type CoMapEdit<V> = {
value?: V;
ref?: RefIfCoValue<V>;
by?: Account;
by?: RegisteredAccount;
madeAt: Date;
key?: string;
};
@@ -710,11 +711,15 @@ const CoMapProxyHandler: ProxyHandler<CoMap> = {
} else {
throw new Error(`Cannot set required reference ${key} to null`);
}
} else {
} else if (value?.id) {
target._raw.set(key, value.id);
subscriptionsScopes
.get(target)
?.onRefAccessedOrSet(target.id, value.id);
} else {
throw new Error(
`Cannot set reference ${key} to a non-CoValue. Got ${value}`,
);
}
}
return true;

View File

@@ -4,6 +4,7 @@ import { describe, expect, test } from "vitest";
import {
Account,
CoList,
CoMap,
Group,
co,
createJazzContextFromExistingCredentials,
@@ -61,6 +62,69 @@ describe("Simple CoList operations", async () => {
expect(list[1]).toBe("margarine");
});
test("assignment with ref", () => {
class Ingredient extends CoMap {
name = co.string;
}
class Recipe extends CoList.Of(co.ref(Ingredient)) {}
const recipe = Recipe.create(
[
Ingredient.create({ name: "bread" }, me),
Ingredient.create({ name: "butter" }, me),
Ingredient.create({ name: "onion" }, me),
],
{ owner: me },
);
recipe[1] = Ingredient.create({ name: "margarine" }, me);
expect(recipe[1]?.name).toBe("margarine");
});
test("assign null on a required ref", () => {
class Ingredient extends CoMap {
name = co.string;
}
class Recipe extends CoList.Of(co.ref(Ingredient)) {}
const recipe = Recipe.create(
[
Ingredient.create({ name: "bread" }, me),
Ingredient.create({ name: "butter" }, me),
Ingredient.create({ name: "onion" }, me),
],
{ owner: me },
);
expect(() => {
recipe[1] = null;
}).toThrow("Cannot set required reference 1 to null");
expect(recipe[1]?.name).toBe("butter");
});
test("assign null on an optional ref", () => {
class Ingredient extends CoMap {
name = co.string;
}
class Recipe extends CoList.Of(co.optional.ref(Ingredient)) {}
const recipe = Recipe.create(
[
Ingredient.create({ name: "bread" }, me),
Ingredient.create({ name: "butter" }, me),
Ingredient.create({ name: "onion" }, me),
],
{ owner: me },
);
recipe[1] = null;
expect(recipe[1]).toBe(null);
});
test("push", () => {
const list = TestList.create(["bread", "butter", "onion"], {
owner: me,
@@ -107,13 +171,115 @@ describe("Simple CoList operations", async () => {
expect(list._raw.asArray()).toEqual(["butter", "onion"]);
});
test("splice", () => {
const list = TestList.create(["bread", "butter", "onion"], {
owner: me,
describe("splice", () => {
test("insert after 1st item with 1 item removed", () => {
const list = TestList.create(["bread", "butter", "onion"], {
owner: me,
});
list.splice(1, 1, "salt", "pepper");
expect(list.length).toBe(4);
expect(list._raw.asArray()).toEqual([
"bread",
"salt",
"pepper",
"onion",
]);
});
list.splice(1, 1, "salt", "pepper");
expect(list.length).toBe(4);
expect(list._raw.asArray()).toEqual(["bread", "salt", "pepper", "onion"]);
test("insert before 1st item", () => {
const list = TestList.create(["bread", "butter", "onion"], {
owner: me,
});
list.splice(0, 0, "salt", "pepper");
expect(list.length).toBe(5);
expect(list._raw.asArray()).toEqual([
"salt",
"pepper",
"bread",
"butter",
"onion",
]);
});
test("insert after 1st item", () => {
const list = TestList.create(["bread", "butter", "onion"], {
owner: me,
});
list.splice(1, 0, "salt", "pepper");
expect(list.length).toBe(5);
expect(list._raw.asArray()).toEqual([
"bread",
"salt",
"pepper",
"butter",
"onion",
]);
});
test("insert after 2nd item", () => {
const list = TestList.create(["bread", "butter", "onion"], {
owner: me,
});
list.splice(2, 0, "salt", "pepper");
expect(list.length).toBe(5);
expect(list._raw.asArray()).toEqual([
"bread",
"butter",
"salt",
"pepper",
"onion",
]);
});
});
test("sort", () => {
const list = TestList.create(
["hedgehog", "giraffe", "iguana", "flamingo"],
{ owner: me },
);
list.sort();
expect(list._raw.asArray()).toEqual([
"flamingo",
"giraffe",
"hedgehog",
"iguana",
]);
list.sort((a, b) => b.localeCompare(a));
expect(list._raw.asArray()).toEqual([
"iguana",
"hedgehog",
"giraffe",
"flamingo",
]);
});
test("sort list of refs", async () => {
class Message extends CoMap {
text = co.string;
}
class Chat extends CoList.Of(co.ref(Message)) {}
const chat = Chat.create(
[
Message.create({ text: "world" }, { owner: me }),
Message.create({ text: "hello" }, { owner: me }),
],
{ owner: me },
);
chat.sort((a, b) => a!.text.localeCompare(b!.text));
expect(chat.map((m) => m!.text)).toEqual(["hello", "world"]);
chat.push(Message.create({ text: "beans on toast" }, { owner: me }));
chat.sort((a, b) => a!.text.localeCompare(b!.text));
expect(chat.map((m) => m!.text)).toEqual([
"beans on toast",
"hello",
"world",
]);
});
test("applyDiff", () => {
@@ -135,6 +301,147 @@ describe("Simple CoList operations", async () => {
"cheese",
]);
});
test("filter + assign to coMap", () => {
class TestMap extends CoMap {
list = co.ref(TestList);
}
const map = TestMap.create(
{
list: TestList.create(["bread", "butter", "onion"], {
owner: me,
}),
},
{ owner: me },
);
expect(() => {
// @ts-expect-error
map.list = map.list?.filter((item) => item !== "butter");
}).toThrow("Cannot set reference list to a non-CoValue. Got bread,onion");
expect(map.list?._raw.asArray()).toEqual(["bread", "butter", "onion"]);
});
test("filter + assign to CoList", () => {
class TestListOfLists extends CoList.Of(co.ref(TestList)) {}
const list = TestListOfLists.create(
[
TestList.create(["bread", "butter", "onion"], {
owner: me,
}),
],
{ owner: me },
);
expect(() => {
// @ts-expect-error
list[0] = list[0]?.filter((item) => item !== "butter");
}).toThrow("Cannot set reference 0 to a non-CoValue. Got bread,onion");
expect(list[0]?._raw.asArray()).toEqual(["bread", "butter", "onion"]);
});
});
});
describe("CoList applyDiff operations", async () => {
const me = await Account.create({
creationProps: { name: "Hermes Puggington" },
crypto: Crypto,
});
test("applyDiff with primitive values", () => {
class StringList extends CoList.Of(co.string) {}
const list = StringList.create(["a", "b", "c"], { owner: me });
// Test adding items
list.applyDiff(["a", "b", "c", "d", "e"]);
expect(list._raw.asArray()).toEqual(["a", "b", "c", "d", "e"]);
// Test removing items
list.applyDiff(["a", "c", "e"]);
expect(list._raw.asArray()).toEqual(["a", "c", "e"]);
// Test replacing items
list.applyDiff(["x", "y", "z"]);
expect(list._raw.asArray()).toEqual(["x", "y", "z"]);
// Test empty list
list.applyDiff([]);
expect(list._raw.asArray()).toEqual([]);
});
test("applyDiff with reference values", () => {
class NestedItem extends CoList.Of(co.string) {
get value() {
return this[0];
}
}
class RefList extends CoList.Of(co.ref(NestedItem)) {}
const item1 = NestedItem.create(["item1"], { owner: me });
const item2 = NestedItem.create(["item2"], { owner: me });
const item3 = NestedItem.create(["item3"], { owner: me });
const item4 = NestedItem.create(["item4"], { owner: me });
const list = RefList.create([item1, item2], { owner: me });
// Test adding reference items
list.applyDiff([item1, item2, item3]);
expect(list.length).toBe(3);
expect(list[2]?.value).toBe("item3");
// Test removing reference items
list.applyDiff([item1, item3]);
expect(list.length).toBe(2);
expect(list[0]?.value).toBe("item1");
expect(list[1]?.value).toBe("item3");
// Test replacing reference items
list.applyDiff([item4]);
expect(list.length).toBe(1);
expect(list[0]?.value).toBe("item4");
// Test empty list
list.applyDiff([]);
expect(list._raw.asArray()).toEqual([]);
});
test("applyDiff with refs + filter", () => {
class TestMap extends CoMap {
type = co.string;
}
class TestList extends CoList.Of(co.ref(TestMap)) {}
const bread = TestMap.create({ type: "bread" }, me);
const butter = TestMap.create({ type: "butter" }, me);
const onion = TestMap.create({ type: "onion" }, me);
const list = TestList.create([bread, butter, onion], me);
list.applyDiff(list.filter((item) => item?.type !== "butter"));
expect(list._raw.asArray()).toEqual([bread.id, onion.id]);
});
test("applyDiff with mixed operations", () => {
class StringList extends CoList.Of(co.string) {}
const list = StringList.create(["a", "b", "c", "d", "e"], { owner: me });
// Test multiple operations at once
list.applyDiff(["a", "x", "c", "y", "e"]);
expect(list._raw.asArray()).toEqual(["a", "x", "c", "y", "e"]);
// Test reordering
list.applyDiff(["e", "c", "a", "y", "x"]);
expect(list._raw.asArray()).toEqual(["e", "c", "a", "y", "x"]);
// Test partial update
list.applyDiff(["e", "c", "new", "y", "x"]);
expect(list._raw.asArray()).toEqual(["e", "c", "new", "y", "x"]);
});
});

212
pnpm-lock.yaml generated
View File

@@ -67,6 +67,9 @@ importers:
jazz-browser-media-images:
specifier: workspace:*
version: link:../../packages/jazz-browser-media-images
jazz-inspector:
specifier: workspace:*
version: link:../../packages/jazz-inspector
jazz-react:
specifier: workspace:*
version: link:../../packages/jazz-react
@@ -510,7 +513,7 @@ importers:
version: 3.0.4
autoprefixer:
specifier: ^10.4.20
version: 10.4.20(postcss@8.4.49)
version: 10.4.20(postcss@8.5.3)
eslint:
specifier: ^9.7.0
version: 9.17.0(jiti@2.4.2)
@@ -554,6 +557,55 @@ importers:
specifier: ^6.0.11
version: 6.0.11(@types/node@22.10.2)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.6.1)
examples/filestream:
dependencies:
jazz-react:
specifier: workspace:*
version: link:../../packages/jazz-react
jazz-tools:
specifier: workspace:*
version: link:../../packages/jazz-tools
react:
specifier: 18.3.1
version: 18.3.1
react-dom:
specifier: 18.3.1
version: 18.3.1(react@18.3.1)
devDependencies:
'@biomejs/biome':
specifier: 1.9.4
version: 1.9.4
'@types/react':
specifier: ^18.3.12
version: 18.3.18
'@types/react-dom':
specifier: ^18.3.1
version: 18.3.5(@types/react@18.3.18)
'@vitejs/plugin-react':
specifier: ^4.3.3
version: 4.3.4(vite@6.0.11(@types/node@22.10.2)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.6.1))
autoprefixer:
specifier: ^10.4.20
version: 10.4.20(postcss@8.5.3)
globals:
specifier: ^15.11.0
version: 15.14.0
is-ci:
specifier: ^3.0.1
version: 3.0.1
postcss:
specifier: ^8.5.3
version: 8.5.3
tailwindcss:
specifier: ^3.4.17
version: 3.4.17(ts-node@10.9.2(@swc/core@1.10.1(@swc/helpers@0.5.15))(@types/node@22.10.2)(typescript@5.6.3))
typescript:
specifier: ~5.6.2
version: 5.6.3
vite:
specifier: ^6.0.11
version: 6.0.11(@types/node@22.10.2)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.6.1)
examples/form:
dependencies:
hash-slash:
@@ -1389,6 +1441,9 @@ importers:
'@tailwindcss/forms':
specifier: ^0.5.9
version: 0.5.9(tailwindcss@3.4.17(ts-node@10.9.2(@swc/core@1.10.1(@swc/helpers@0.5.15))(@types/node@22.10.2)(typescript@5.6.3)))
jazz-inspector:
specifier: workspace:*
version: link:../../packages/jazz-inspector
jazz-react:
specifier: workspace:*
version: link:../../packages/jazz-react
@@ -1660,6 +1715,15 @@ importers:
packages/jazz-inspector:
dependencies:
'@twind/core':
specifier: ^1.1.3
version: 1.1.3(typescript@5.6.3)
'@twind/preset-autoprefix':
specifier: ^1.0.7
version: 1.0.7(@twind/core@1.1.3(typescript@5.6.3))(typescript@5.6.3)
'@twind/preset-tailwind':
specifier: ^1.1.4
version: 1.1.4(@twind/core@1.1.3(typescript@5.6.3))(typescript@5.6.3)
cojson:
specifier: workspace:*
version: link:../cojson
@@ -2036,7 +2100,7 @@ importers:
devDependencies:
tsup:
specifier: 8.3.5
version: 8.3.5(@microsoft/api-extractor@7.48.1(@types/node@22.10.2))(@swc/core@1.10.1(@swc/helpers@0.5.15))(jiti@2.4.2)(postcss@8.4.49)(typescript@5.6.3)(yaml@2.6.1)
version: 8.3.5(@microsoft/api-extractor@7.48.1(@types/node@22.10.2))(@swc/core@1.10.1(@swc/helpers@0.5.15))(jiti@2.4.2)(postcss@8.5.3)(typescript@5.6.3)(yaml@2.6.1)
typescript:
specifier: ~5.6.2
version: 5.6.3
@@ -5186,6 +5250,35 @@ packages:
'@tsconfig/node22@22.0.0':
resolution: {integrity: sha512-twLQ77zevtxobBOD4ToAtVmuYrpeYUh3qh+TEp+08IWhpsrIflVHqQ1F1CiPxQGL7doCdBIOOCF+1Tm833faNg==}
'@twind/core@1.1.3':
resolution: {integrity: sha512-/B/aNFerMb2IeyjSJy3SJxqVxhrT77gBDknLMiZqXIRr4vNJqiuhx7KqUSRzDCwUmyGuogkamz+aOLzN6MeSLw==}
engines: {node: '>=14.15.0'}
peerDependencies:
typescript: ^4.8.4
peerDependenciesMeta:
typescript:
optional: true
'@twind/preset-autoprefix@1.0.7':
resolution: {integrity: sha512-3wmHO0pG/CVxYBNZUV0tWcL7CP0wD5KpyWAQE/KOalWmOVBj+nH6j3v6Y3I3pRuMFaG5DC78qbYbhA1O11uG3w==}
engines: {node: '>=14.15.0'}
peerDependencies:
'@twind/core': ^1.1.0
typescript: ^4.8.4
peerDependenciesMeta:
typescript:
optional: true
'@twind/preset-tailwind@1.1.4':
resolution: {integrity: sha512-zv85wrP/DW4AxgWrLfH7kyGn/KJF3K04FMLVl2AjoxZGYdCaoZDkL8ma3hzaKQ+WGgBFRubuB/Ku2Rtv/wjzVw==}
engines: {node: '>=14.15.0'}
peerDependencies:
'@twind/core': ^1.1.0
typescript: ^4.8.4
peerDependenciesMeta:
typescript:
optional: true
'@types/argparse@1.0.38':
resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==}
@@ -9695,6 +9788,10 @@ packages:
resolution: {integrity: sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==}
engines: {node: ^10 || ^12 || >=14}
postcss@8.5.3:
resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==}
engines: {node: ^10 || ^12 || >=14}
preact@10.25.3:
resolution: {integrity: sha512-dzQmIFtM970z+fP9ziQ3yG4e3ULIbwZzJ734vaMVUTaKQ2+Ru1Ou/gjshOYVHCcd1rpAelC6ngjvjDXph98unQ==}
@@ -10777,6 +10874,9 @@ packages:
structured-headers@0.4.1:
resolution: {integrity: sha512-0MP/Cxx5SzeeZ10p/bZI0S6MpgD+yxAhi1BOQ34jgnMXsCq3j1t6tQnZu+KdlL7dvJTLT3g9xN8tl10TqgFMcg==}
style-vendorizer@2.2.3:
resolution: {integrity: sha512-/VDRsWvQAgspVy9eATN3z6itKTuyg+jW1q6UoTCQCFRqPDw8bi3E1hXIKnGw5LvXS2AQPuJ7Af4auTLYeBOLEg==}
styleq@0.1.3:
resolution: {integrity: sha512-3ZUifmCDCQanjeej1f6kyl/BeP/Vae5EYkQ9iJfUm/QwZvlgnZzyflqAsAWYURdtea8Vkvswu2GrC57h3qffcA==}
@@ -15384,6 +15484,25 @@ snapshots:
'@tsconfig/node22@22.0.0': {}
'@twind/core@1.1.3(typescript@5.6.3)':
dependencies:
csstype: 3.1.3
optionalDependencies:
typescript: 5.6.3
'@twind/preset-autoprefix@1.0.7(@twind/core@1.1.3(typescript@5.6.3))(typescript@5.6.3)':
dependencies:
'@twind/core': 1.1.3(typescript@5.6.3)
style-vendorizer: 2.2.3
optionalDependencies:
typescript: 5.6.3
'@twind/preset-tailwind@1.1.4(@twind/core@1.1.3(typescript@5.6.3))(typescript@5.6.3)':
dependencies:
'@twind/core': 1.1.3(typescript@5.6.3)
optionalDependencies:
typescript: 5.6.3
'@types/argparse@1.0.38': {}
'@types/aria-query@5.0.4': {}
@@ -15863,7 +15982,7 @@ snapshots:
'@vue/shared': 3.5.13
estree-walker: 2.0.2
magic-string: 0.30.17
postcss: 8.4.49
postcss: 8.5.3
source-map-js: 1.2.1
'@vue/compiler-ssr@3.5.13':
@@ -16322,6 +16441,16 @@ snapshots:
postcss: 8.4.49
postcss-value-parser: 4.2.0
autoprefixer@10.4.20(postcss@8.5.3):
dependencies:
browserslist: 4.24.3
caniuse-lite: 1.0.30001690
fraction.js: 4.3.7
normalize-range: 0.1.2
picocolors: 1.1.1
postcss: 8.5.3
postcss-value-parser: 4.2.0
available-typed-arrays@1.0.7:
dependencies:
possible-typed-array-names: 1.0.0
@@ -17382,9 +17511,9 @@ snapshots:
eslint-compat-utils: 0.5.1(eslint@9.17.0(jiti@2.4.2))
esutils: 2.0.3
known-css-properties: 0.35.0
postcss: 8.4.49
postcss-load-config: 3.1.4(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.10.1(@swc/helpers@0.5.15))(@types/node@22.10.2)(typescript@5.6.3))
postcss-safe-parser: 6.0.0(postcss@8.4.49)
postcss: 8.5.3
postcss-load-config: 3.1.4(postcss@8.5.3)(ts-node@10.9.2(@swc/core@1.10.1(@swc/helpers@0.5.15))(@types/node@22.10.2)(typescript@5.6.3))
postcss-safe-parser: 6.0.0(postcss@8.5.3)
postcss-selector-parser: 6.1.2
semver: 7.6.3
svelte-eslint-parser: 0.43.0(svelte@5.15.0)
@@ -20392,17 +20521,29 @@ snapshots:
read-cache: 1.0.0
resolve: 1.22.10
postcss-import@15.1.0(postcss@8.5.3):
dependencies:
postcss: 8.5.3
postcss-value-parser: 4.2.0
read-cache: 1.0.0
resolve: 1.22.10
postcss-js@4.0.1(postcss@8.4.49):
dependencies:
camelcase-css: 2.0.1
postcss: 8.4.49
postcss-load-config@3.1.4(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.10.1(@swc/helpers@0.5.15))(@types/node@22.10.2)(typescript@5.6.3)):
postcss-js@4.0.1(postcss@8.5.3):
dependencies:
camelcase-css: 2.0.1
postcss: 8.5.3
postcss-load-config@3.1.4(postcss@8.5.3)(ts-node@10.9.2(@swc/core@1.10.1(@swc/helpers@0.5.15))(@types/node@22.10.2)(typescript@5.6.3)):
dependencies:
lilconfig: 2.1.0
yaml: 1.10.2
optionalDependencies:
postcss: 8.4.49
postcss: 8.5.3
ts-node: 10.9.2(@swc/core@1.10.1(@swc/helpers@0.5.15))(@types/node@22.10.2)(typescript@5.6.3)
postcss-load-config@4.0.2(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.10.1(@swc/helpers@0.5.15))(@types/node@22.10.2)(typescript@5.6.3)):
@@ -20413,12 +20554,20 @@ snapshots:
postcss: 8.4.49
ts-node: 10.9.2(@swc/core@1.10.1(@swc/helpers@0.5.15))(@types/node@22.10.2)(typescript@5.6.3)
postcss-load-config@6.0.1(jiti@2.4.2)(postcss@8.4.49)(yaml@2.6.1):
postcss-load-config@4.0.2(postcss@8.5.3)(ts-node@10.9.2(@swc/core@1.10.1(@swc/helpers@0.5.15))(@types/node@22.10.2)(typescript@5.6.3)):
dependencies:
lilconfig: 3.1.3
yaml: 2.6.1
optionalDependencies:
postcss: 8.5.3
ts-node: 10.9.2(@swc/core@1.10.1(@swc/helpers@0.5.15))(@types/node@22.10.2)(typescript@5.6.3)
postcss-load-config@6.0.1(jiti@2.4.2)(postcss@8.5.3)(yaml@2.6.1):
dependencies:
lilconfig: 3.1.3
optionalDependencies:
jiti: 2.4.2
postcss: 8.4.49
postcss: 8.5.3
yaml: 2.6.1
postcss-nested@6.2.0(postcss@8.4.49):
@@ -20426,13 +20575,18 @@ snapshots:
postcss: 8.4.49
postcss-selector-parser: 6.1.2
postcss-safe-parser@6.0.0(postcss@8.4.49):
postcss-nested@6.2.0(postcss@8.5.3):
dependencies:
postcss: 8.4.49
postcss: 8.5.3
postcss-selector-parser: 6.1.2
postcss-scss@4.0.9(postcss@8.4.49):
postcss-safe-parser@6.0.0(postcss@8.5.3):
dependencies:
postcss: 8.4.49
postcss: 8.5.3
postcss-scss@4.0.9(postcss@8.5.3):
dependencies:
postcss: 8.5.3
postcss-selector-parser@6.0.10:
dependencies:
@@ -20452,6 +20606,12 @@ snapshots:
picocolors: 1.1.1
source-map-js: 1.2.1
postcss@8.5.3:
dependencies:
nanoid: 3.3.8
picocolors: 1.1.1
source-map-js: 1.2.1
preact@10.25.3: {}
prebuild-install@7.1.2:
@@ -21636,6 +21796,8 @@ snapshots:
structured-headers@0.4.1: {}
style-vendorizer@2.2.3: {}
styleq@0.1.3: {}
stylis@4.2.0: {}
@@ -21696,8 +21858,8 @@ snapshots:
eslint-scope: 7.2.2
eslint-visitor-keys: 3.4.3
espree: 9.6.1
postcss: 8.4.49
postcss-scss: 4.0.9(postcss@8.4.49)
postcss: 8.5.3
postcss-scss: 4.0.9(postcss@8.5.3)
optionalDependencies:
svelte: 5.15.0
@@ -21762,11 +21924,11 @@ snapshots:
normalize-path: 3.0.0
object-hash: 3.0.0
picocolors: 1.1.1
postcss: 8.4.49
postcss-import: 15.1.0(postcss@8.4.49)
postcss-js: 4.0.1(postcss@8.4.49)
postcss-load-config: 4.0.2(postcss@8.4.49)(ts-node@10.9.2(@swc/core@1.10.1(@swc/helpers@0.5.15))(@types/node@22.10.2)(typescript@5.6.3))
postcss-nested: 6.2.0(postcss@8.4.49)
postcss: 8.5.3
postcss-import: 15.1.0(postcss@8.5.3)
postcss-js: 4.0.1(postcss@8.5.3)
postcss-load-config: 4.0.2(postcss@8.5.3)(ts-node@10.9.2(@swc/core@1.10.1(@swc/helpers@0.5.15))(@types/node@22.10.2)(typescript@5.6.3))
postcss-nested: 6.2.0(postcss@8.5.3)
postcss-selector-parser: 6.1.2
postcss-value-parser: 4.2.0
resolve: 1.22.10
@@ -22033,7 +22195,7 @@ snapshots:
tslib@2.8.1: {}
tsup@8.3.5(@microsoft/api-extractor@7.48.1(@types/node@22.10.2))(@swc/core@1.10.1(@swc/helpers@0.5.15))(jiti@2.4.2)(postcss@8.4.49)(typescript@5.6.3)(yaml@2.6.1):
tsup@8.3.5(@microsoft/api-extractor@7.48.1(@types/node@22.10.2))(@swc/core@1.10.1(@swc/helpers@0.5.15))(jiti@2.4.2)(postcss@8.5.3)(typescript@5.6.3)(yaml@2.6.1):
dependencies:
bundle-require: 5.0.0(esbuild@0.24.0)
cac: 6.7.14
@@ -22043,7 +22205,7 @@ snapshots:
esbuild: 0.24.0
joycon: 3.1.1
picocolors: 1.1.1
postcss-load-config: 6.0.1(jiti@2.4.2)(postcss@8.4.49)(yaml@2.6.1)
postcss-load-config: 6.0.1(jiti@2.4.2)(postcss@8.5.3)(yaml@2.6.1)
resolve-from: 5.0.0
rollup: 4.28.1
source-map: 0.8.0-beta.0
@@ -22054,7 +22216,7 @@ snapshots:
optionalDependencies:
'@microsoft/api-extractor': 7.48.1(@types/node@22.10.2)
'@swc/core': 1.10.1(@swc/helpers@0.5.15)
postcss: 8.4.49
postcss: 8.5.3
typescript: 5.6.3
transitivePeerDependencies:
- jiti
@@ -22395,7 +22557,7 @@ snapshots:
vite@5.4.11(@types/node@22.10.2)(lightningcss@1.29.1)(terser@5.37.0):
dependencies:
esbuild: 0.24.0
postcss: 8.4.49
postcss: 8.5.3
rollup: 4.28.1
optionalDependencies:
'@types/node': 22.10.2