@rtzll/create-reflow 0.0.0-stage → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Christian Rotzoll
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,15 @@
1
- # Temporary Holding Version
1
+ # create-reflow
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Creates a Remix 3 app that uses [Reflow](https://github.com/rtzll/reflow) components.
4
+
5
+ ```sh
6
+ pnpm create @rtzll/reflow my-app
7
+ cd my-app
8
+ pnpm dev
9
+ ```
10
+
11
+ `npm create @rtzll/reflow my-app` works too. The app is a pnpm project, so the installer needs pnpm 12 and Node 26. Pass `--no-install` to copy the files without installing.
12
+
13
+ The app is a small settings page with a Sidebar, theme selector, switch, form, and dialog. Each release of this package creates apps for the Reflow version with the same number.
14
+
15
+ MIT. See LICENSE.
package/dist/create.js ADDED
@@ -0,0 +1,74 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync, } from 'node:fs';
3
+ import { basename, join, resolve } from 'node:path';
4
+ import { parseArgs } from 'node:util';
5
+ export const usage = `Usage: create-reflow <directory> [--no-install]
6
+
7
+ Creates a Remix 3 app that uses Reflow components.
8
+
9
+ --no-install Copy the files without running pnpm install
10
+ --help Show this message`;
11
+ export function readOptions(args) {
12
+ const { values, positionals } = parseArgs({
13
+ args,
14
+ allowPositionals: true,
15
+ allowNegative: true,
16
+ options: {
17
+ install: { type: 'boolean', default: true },
18
+ tarball: { type: 'string' },
19
+ help: { type: 'boolean', short: 'h' },
20
+ },
21
+ });
22
+ if (values.help)
23
+ return 'help';
24
+ if (positionals.length !== 1)
25
+ throw new Error('Name one directory to create.');
26
+ return {
27
+ directory: positionals[0],
28
+ install: values.install,
29
+ tarball: values.tarball && resolve(values.tarball),
30
+ };
31
+ }
32
+ // A valid npm package name from the directory, such as "my-app".
33
+ export function packageName(directory) {
34
+ const name = basename(resolve(directory))
35
+ .toLowerCase()
36
+ .replace(/[^a-z0-9._~-]+/g, '-')
37
+ .replace(/^[._-]+|[-]+$/g, '');
38
+ return name || 'reflow-app';
39
+ }
40
+ const pnpmInstall = (cwd) => {
41
+ const result = spawnSync('pnpm', ['install'], { cwd, stdio: 'inherit' });
42
+ if (result.error?.code === 'ENOENT')
43
+ return 'missing';
44
+ if (result.error)
45
+ throw result.error;
46
+ if (result.status !== 0)
47
+ throw new Error('pnpm install failed.');
48
+ return 'installed';
49
+ };
50
+ export function create(options, template, installer = pnpmInstall) {
51
+ const destination = resolve(options.directory);
52
+ if (existsSync(destination)) {
53
+ if (!statSync(destination).isDirectory() || readdirSync(destination).length > 0) {
54
+ throw new Error(`${options.directory} already exists. Choose a new or empty directory.`);
55
+ }
56
+ }
57
+ if (options.tarball && !existsSync(options.tarball)) {
58
+ throw new Error(`${options.tarball} does not exist.`);
59
+ }
60
+ mkdirSync(destination, { recursive: true });
61
+ cpSync(template, destination, { recursive: true });
62
+ renameSync(join(destination, '_gitignore'), join(destination, '.gitignore'));
63
+ const file = join(destination, 'package.json');
64
+ const manifest = JSON.parse(readFileSync(file, 'utf8'));
65
+ manifest.name = packageName(destination);
66
+ if (options.tarball) {
67
+ mkdirSync(join(destination, 'vendor'));
68
+ cpSync(options.tarball, join(destination, 'vendor/rtzll-reflow.tgz'));
69
+ manifest.dependencies['@rtzll/reflow'] = 'file:vendor/rtzll-reflow.tgz';
70
+ }
71
+ writeFileSync(file, JSON.stringify(manifest, null, 2) + '\n');
72
+ const installed = options.install && installer(destination) === 'installed';
73
+ return { destination, installed };
74
+ }
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ import { isAbsolute, relative, sep } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { create, readOptions, usage } from './create.js';
5
+ const template = fileURLToPath(new URL('../template/', import.meta.url));
6
+ try {
7
+ const options = readOptions(process.argv.slice(2));
8
+ if (options === 'help') {
9
+ console.log(usage);
10
+ }
11
+ else {
12
+ const { destination, installed } = create(options, template);
13
+ const nearby = relative(process.cwd(), destination);
14
+ const path = nearby === '..' || nearby.startsWith(`..${sep}`) || isAbsolute(nearby)
15
+ ? destination
16
+ : nearby || '.';
17
+ console.log(`\nCreated a Reflow app in ${path}.\n\nNext:`);
18
+ if (path !== '.')
19
+ console.log(` cd ${path}`);
20
+ if (!installed) {
21
+ if (options.install) {
22
+ console.log(' corepack enable pnpm # pnpm was not found; or install it another way');
23
+ }
24
+ console.log(' pnpm install');
25
+ }
26
+ console.log(' pnpm dev');
27
+ }
28
+ }
29
+ catch (error) {
30
+ console.error(`${error instanceof Error ? error.message : error}\n\n${usage}`);
31
+ process.exitCode = 1;
32
+ }
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "@rtzll/create-reflow",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.11.0",
4
+ "type": "module",
5
+ "bin": {
6
+ "create-reflow": "./dist/index.js"
7
+ },
8
+ "files": [
9
+ "dist",
10
+ "template",
11
+ "LICENSE",
12
+ "README.md"
13
+ ],
14
+ "engines": {
15
+ "node": "^26.13.0"
16
+ },
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/rtzll/reflow.git",
21
+ "directory": "packages/create-reflow"
22
+ },
23
+ "description": "Create a Remix 3 app that uses Reflow components.",
24
+ "author": "Christian Rotzoll",
25
+ "keywords": [
26
+ "remix",
27
+ "reflow",
28
+ "create",
29
+ "starter",
30
+ "template"
31
+ ],
32
+ "homepage": "https://github.com/rtzll/reflow#readme",
33
+ "bugs": {
34
+ "url": "https://github.com/rtzll/reflow/issues"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public",
38
+ "registry": "https://registry.npmjs.org/"
39
+ },
40
+ "scripts": {
41
+ "build": "rm -rf dist template && tsc -p tsconfig.build.json && node scripts/template.ts",
42
+ "check": "tsc -p tsconfig.json"
43
+ }
6
44
  }
@@ -0,0 +1,12 @@
1
+ # Reflow Starter
2
+
3
+ A small Remix workspace settings page. The Sidebar, theme selector, compact layout switch, notification form, and preview dialog use the installed Reflow package.
4
+
5
+ ```sh
6
+ pnpm check
7
+ pnpm dev
8
+ ```
9
+
10
+ Open the address printed in the terminal. Set `PORT` to use a different port, for example `PORT=3000 pnpm dev`.
11
+
12
+ Edit `app/public/settings.tsx` to change the settings page. `app/actions/controller.tsx` serves the document and resolves the package stylesheet. Appearance controls update the page immediately. Apply settings keeps the appearance and notification choices in the URL, including when all notification choices are cleared.
@@ -0,0 +1 @@
1
+ node_modules/
@@ -0,0 +1,58 @@
1
+ import { ImportMap } from 'remix/component/server'
2
+ import { createController } from 'remix/router'
3
+ import type { RouterContext } from 'remix/router'
4
+ import { assets } from '../assets.ts'
5
+ import { Settings, notificationOptions, themes } from '../public/settings.tsx'
6
+ import type { router } from '../router.ts'
7
+ import { routes } from '../routes.ts'
8
+
9
+ export default createController<typeof routes, RouterContext<typeof router>>(routes, {
10
+ actions: {
11
+ async assets({ request }) {
12
+ return (await assets.fetch(request)) ?? new Response('Not found', { status: 404 })
13
+ },
14
+ async home(context) {
15
+ const [entry, libraryStyles, appStyles] = await Promise.all([
16
+ assets.getScriptEntry('app/public/entry.ts'),
17
+ assets.getHref(import.meta.resolve('@rtzll/reflow/styles.css')),
18
+ assets.getHref('app/public/starter.css'),
19
+ ])
20
+ const params = new URL(context.request.url).searchParams
21
+ const applied = params.has('preferences')
22
+ const theme = themes.find(({ value }) => value === params.get('theme'))?.value ?? 'system'
23
+ const compact = params.get('density') === 'compact'
24
+ const selected = params.getAll('notification')
25
+ const notifications = applied
26
+ ? notificationOptions
27
+ .filter(({ value }) => selected.includes(value))
28
+ .map(({ value }) => value)
29
+ : ['mentions']
30
+
31
+ return context.render(
32
+ <html lang="en">
33
+ <head>
34
+ <meta charSet="utf-8" />
35
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
36
+ <meta name="color-scheme" content="light dark" />
37
+ <title>Workspace settings · Reflow Starter</title>
38
+ <link rel="stylesheet" href={libraryStyles} />
39
+ <link rel="stylesheet" href={appStyles} />
40
+ <ImportMap value={entry.importMap} />
41
+ {entry.preloads.map((href) => (
42
+ <link key={href} rel="modulepreload" href={href} />
43
+ ))}
44
+ <script type="module" src={entry.href} />
45
+ </head>
46
+ <body>
47
+ <Settings
48
+ theme={theme}
49
+ compact={compact}
50
+ notifications={notifications}
51
+ applied={applied}
52
+ />
53
+ </body>
54
+ </html>,
55
+ )
56
+ },
57
+ },
58
+ })
@@ -0,0 +1,14 @@
1
+ import { fileURLToPath } from 'node:url'
2
+ import { createAssetServer } from 'remix/assets'
3
+ import { loadConfig } from 'remix/cli'
4
+
5
+ const rootDir = fileURLToPath(new URL('../', import.meta.url))
6
+ const config = await loadConfig(rootDir)
7
+ if (!config.assets?.allowFiles) throw new Error('Missing asset allowlist in remix.json')
8
+
9
+ export const assets = createAssetServer({
10
+ ...config.assets,
11
+ rootDir,
12
+ allowFiles: config.assets.allowFiles,
13
+ watch: process.env.NODE_ENV !== 'production',
14
+ })
@@ -0,0 +1,15 @@
1
+ import { run } from 'remix/component'
2
+
3
+ const app = run({
4
+ async loadModule(url, name) {
5
+ const module = await import(url)
6
+ const component = module[name]
7
+ if (typeof component !== 'function') throw new Error(`Missing client entry ${url}#${name}`)
8
+ return component
9
+ },
10
+ })
11
+
12
+ app.addEventListener('error', (event) => console.error(event.error))
13
+
14
+ await app.ready()
15
+ document.documentElement.dataset.starterReady = 'true'
@@ -0,0 +1,137 @@
1
+ import { Badge, Button, CheckboxGroup, Dialog, Icon, Select, Sidebar, Switch } from '@rtzll/reflow'
2
+ import { clientEntry, type Handle } from 'remix/component'
3
+
4
+ export const themes = [
5
+ { value: 'system', label: 'System' },
6
+ { value: 'light', label: 'Light' },
7
+ { value: 'dark', label: 'Dark' },
8
+ ]
9
+
10
+ export const notificationOptions = [
11
+ { value: 'mentions', label: 'Mentions' },
12
+ { value: 'replies', label: 'Replies' },
13
+ { value: 'digest', label: 'Weekly digest' },
14
+ ]
15
+
16
+ const navigation = [
17
+ { label: 'Appearance', href: '#appearance', icon: 'palette' },
18
+ { label: 'Notifications', href: '#notifications', icon: 'bell' },
19
+ ] as const
20
+
21
+ export const Settings = clientEntry(
22
+ import.meta.url,
23
+ function Settings(
24
+ handle: Handle<{ theme: string; compact: boolean; notifications: string[]; applied: boolean }>,
25
+ ) {
26
+ let { theme, compact } = handle.props
27
+ let activeHref = '#appearance'
28
+
29
+ return () => (
30
+ <div class="starter" data-theme={theme} data-density={compact ? 'compact' : 'default'}>
31
+ <Sidebar
32
+ label="Workspace navigation"
33
+ variant="inset"
34
+ defaultWidth={216}
35
+ header={
36
+ <div class="starter-brand">
37
+ <Icon name="square-library" /> Reflow Starter
38
+ </div>
39
+ }
40
+ toolbar={<Badge>Local workspace</Badge>}
41
+ activeHref={activeHref}
42
+ sections={[
43
+ {
44
+ label: 'Settings',
45
+ collapsible: false,
46
+ items: navigation.map(({ label, href, icon }) => ({
47
+ label,
48
+ href,
49
+ icon: <Icon name={icon} />,
50
+ onClick() {
51
+ activeHref = href
52
+ handle.update()
53
+ },
54
+ })),
55
+ },
56
+ ]}
57
+ >
58
+ <main class="starter-content">
59
+ <header>
60
+ <h1>Workspace settings</h1>
61
+ <p>Try a few Reflow components in a fresh Remix app.</p>
62
+ </header>
63
+
64
+ <section id="appearance" class="starter-section" aria-labelledby="appearance-heading">
65
+ <h2 id="appearance-heading">Appearance</h2>
66
+ <div class="starter-setting">
67
+ <div>
68
+ <label for="theme">Theme</label>
69
+ <p>Follow your device or choose light or dark.</p>
70
+ </div>
71
+ <Select
72
+ id="theme"
73
+ label="Theme"
74
+ options={themes}
75
+ value={theme}
76
+ onValueChange={(value) => {
77
+ if (value === null) return
78
+ theme = value
79
+ handle.update()
80
+ }}
81
+ />
82
+ </div>
83
+ <div class="starter-setting">
84
+ <p>Use smaller controls and tighter spacing.</p>
85
+ <Switch
86
+ label="Compact layout"
87
+ checked={compact}
88
+ onCheckedChange={(value) => {
89
+ compact = value
90
+ handle.update()
91
+ }}
92
+ />
93
+ </div>
94
+ </section>
95
+
96
+ <section
97
+ id="notifications"
98
+ class="starter-section"
99
+ aria-labelledby="notifications-heading"
100
+ >
101
+ <h2 id="notifications-heading">Notifications</h2>
102
+ <p>Apply your settings to keep them in this page’s URL.</p>
103
+ <form action="/#notifications" method="get">
104
+ <input type="hidden" name="preferences" value="1" />
105
+ <input type="hidden" name="theme" value={theme} />
106
+ <input type="hidden" name="density" value={compact ? 'compact' : 'default'} />
107
+ <CheckboxGroup
108
+ label="Notification types"
109
+ hideLabel
110
+ name="notification"
111
+ options={notificationOptions}
112
+ defaultValue={handle.props.notifications}
113
+ />
114
+ {handle.props.applied && (
115
+ <p role="status">
116
+ {handle.props.notifications.length === 0
117
+ ? 'Notifications are off.'
118
+ : 'Notification settings applied.'}
119
+ </p>
120
+ )}
121
+ <div class="starter-actions">
122
+ <Button type="submit">Apply settings</Button>
123
+ <Button type="reset" variant="ghost">
124
+ Reset
125
+ </Button>
126
+ </div>
127
+ </form>
128
+ <Dialog title="Notification preview" trigger="Preview alert">
129
+ <p>You were mentioned in a workspace update.</p>
130
+ </Dialog>
131
+ </section>
132
+ </main>
133
+ </Sidebar>
134
+ </div>
135
+ )
136
+ },
137
+ )
@@ -0,0 +1,101 @@
1
+ body {
2
+ margin: 0;
3
+ font: 14px/1.5 var(--rf-font);
4
+ }
5
+
6
+ .starter {
7
+ box-sizing: border-box;
8
+ min-block-size: 100dvh;
9
+ padding: clamp(12px, 4vw, 48px);
10
+ background: var(--rf-bg);
11
+ color: var(--rf-fg);
12
+ }
13
+
14
+ .starter > .rf-sidebar-layout {
15
+ max-inline-size: 940px;
16
+ min-block-size: 640px;
17
+ margin-inline: auto;
18
+ }
19
+
20
+ .starter-brand {
21
+ display: flex;
22
+ align-items: center;
23
+ gap: 8px;
24
+ min-block-size: 36px;
25
+ padding-inline: 8px;
26
+ font-weight: 600;
27
+ }
28
+
29
+ .starter-content {
30
+ display: grid;
31
+ gap: 24px;
32
+ max-inline-size: 560px;
33
+ padding: 16px clamp(12px, 4vw, 32px) 32px;
34
+ }
35
+
36
+ .starter-content h1,
37
+ .starter-content h2,
38
+ .starter-content p {
39
+ margin: 0;
40
+ }
41
+
42
+ .starter-content h1 {
43
+ font-size: clamp(24px, 4vw, 32px);
44
+ line-height: 1.15;
45
+ letter-spacing: -0.025em;
46
+ }
47
+
48
+ .starter-content h2 {
49
+ font-size: 16px;
50
+ }
51
+
52
+ .starter-content p {
53
+ color: var(--rf-muted);
54
+ }
55
+
56
+ .starter-content header {
57
+ display: grid;
58
+ gap: 8px;
59
+ }
60
+
61
+ .starter-section {
62
+ display: grid;
63
+ justify-items: start;
64
+ gap: 10px;
65
+ padding-block-start: 16px;
66
+ border-block-start: 1px solid var(--rf-border);
67
+ }
68
+
69
+ .starter-section > form,
70
+ .starter-setting {
71
+ inline-size: 100%;
72
+ }
73
+
74
+ .starter-setting,
75
+ .starter-actions {
76
+ display: flex;
77
+ flex-wrap: wrap;
78
+ align-items: center;
79
+ gap: 12px;
80
+ }
81
+
82
+ .starter-setting {
83
+ justify-content: space-between;
84
+ padding-block: 6px;
85
+ }
86
+
87
+ .starter-setting label[for] {
88
+ font-weight: 550;
89
+ }
90
+
91
+ .starter-setting .rf-select {
92
+ min-inline-size: 108px;
93
+ }
94
+
95
+ .starter-actions {
96
+ margin-block-start: 12px;
97
+ }
98
+
99
+ .starter-section [role='status'] {
100
+ margin-block-start: 8px;
101
+ }
@@ -0,0 +1,9 @@
1
+ import { render } from 'remix/middleware/render'
2
+ import { createRouter } from 'remix/router'
3
+ import controller from './actions/controller.tsx'
4
+ import { assets } from './assets.ts'
5
+ import { routes } from './routes.ts'
6
+
7
+ export const router = createRouter({ middleware: [render({ assets })] })
8
+
9
+ router.map(routes, controller)
@@ -0,0 +1,6 @@
1
+ import { get, route } from 'remix/routes'
2
+
3
+ export const routes = route({
4
+ home: get('/'),
5
+ assets: get('/assets/*path'),
6
+ })
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "reflow-starter",
3
+ "private": true,
4
+ "type": "module",
5
+ "packageManager": "pnpm@12.21.0",
6
+ "engines": {
7
+ "node": "^26.13.0"
8
+ },
9
+ "scripts": {
10
+ "dev": "node --watch --import remix/node-tsx server.ts",
11
+ "start": "node --import remix/node-tsx server.ts",
12
+ "check": "tsc --noEmit"
13
+ },
14
+ "dependencies": {
15
+ "@rtzll/reflow": "0.11.0",
16
+ "remix": "3.3.0"
17
+ },
18
+ "devDependencies": {
19
+ "@types/node": "26.6.6",
20
+ "typescript": "7.0.2"
21
+ }
22
+ }
@@ -0,0 +1,7 @@
1
+ autoInstallPeers: false
2
+
3
+ overrides:
4
+ '@remix-run/test>esbuild': 0.28.2
5
+
6
+ allowBuilds:
7
+ esbuild@0.28.2: true
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "./node_modules/remix/schema/remix.json",
3
+ "assets": {
4
+ "basePath": "/assets",
5
+ "allowFiles": ["app/public/**"],
6
+ "allowPackages": ["remix", "@rtzll/reflow"],
7
+ "denyFiles": ["**/*.d.ts"]
8
+ }
9
+ }
@@ -0,0 +1,22 @@
1
+ import { createServer } from 'node:http'
2
+ import { createRequestListener } from 'remix/node-fetch-server'
3
+ import { assets } from './app/assets.ts'
4
+ import { router } from './app/router.ts'
5
+
6
+ const host = process.env.HOST ?? '127.0.0.1'
7
+ const port = Number(process.env.PORT ?? 44103)
8
+ const server = createServer(createRequestListener(router.fetch))
9
+
10
+ server.listen(port, host, () => {
11
+ const address = server.address()
12
+ const listeningPort = address && typeof address === 'object' ? address.port : port
13
+ console.log(`Reflow starter is listening on http://${host}:${listeningPort}`)
14
+ })
15
+
16
+ function stop() {
17
+ server.close(() => void assets.close())
18
+ server.closeAllConnections()
19
+ }
20
+
21
+ process.once('SIGINT', stop)
22
+ process.once('SIGTERM', stop)
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2024",
4
+ "lib": ["ES2024", "DOM", "DOM.Iterable"],
5
+ "module": "NodeNext",
6
+ "jsx": "react-jsx",
7
+ "jsxImportSource": "remix/component",
8
+ "strict": true,
9
+ "skipLibCheck": true,
10
+ "verbatimModuleSyntax": true,
11
+ "rewriteRelativeImportExtensions": true,
12
+ "types": ["node"],
13
+ "noEmit": true
14
+ },
15
+ "include": ["app/**/*.ts", "app/**/*.tsx", "server.ts"]
16
+ }