@dexhq/canvas 0.13.0 → 0.15.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/CHANGELOG.md +53 -0
- package/README.md +21 -18
- package/app/canvas/activity.tsx +8 -15
- package/app/canvas/anchoring.ts +3 -5
- package/app/canvas/canvas-input.ts +151 -14
- package/app/canvas/canvas-keys.ts +9 -0
- package/app/canvas/canvas-model.ts +5 -42
- package/app/canvas/canvas-panels.ts +1 -17
- package/app/canvas/canvas-scene.ts +7 -3
- package/app/canvas/canvas-ui.ts +2 -1
- package/app/canvas/canvas.css +61 -26
- package/app/canvas/change-notice.tsx +10 -1
- package/app/canvas/comment-layer.tsx +2 -1
- package/app/canvas/comments.tsx +204 -82
- package/app/canvas/element-picker.ts +200 -27
- package/app/canvas/engine/canvas-gestures.ts +72 -17
- package/app/canvas/engine/canvas-store.ts +17 -1
- package/app/canvas/engine/engine.css +6 -3
- package/app/canvas/find-bar.tsx +817 -0
- package/app/canvas/find-model.ts +135 -0
- package/app/canvas/flow-canvas.tsx +18 -2
- package/app/canvas/follow-pin.ts +26 -6
- package/app/canvas/frame-node.tsx +43 -26
- package/app/canvas/imported-reviews.tsx +12 -22
- package/app/canvas/layout.ts +27 -0
- package/app/canvas/live-page.ts +142 -19
- package/app/canvas/page-find.ts +220 -0
- package/app/canvas/page-style.ts +23 -0
- package/app/canvas/section-node.tsx +2 -0
- package/app/canvas/spec-threads.ts +24 -23
- package/app/canvas/thread-focus.tsx +14 -12
- package/app/canvas/tool-cursors.ts +16 -16
- package/app/canvas/use-activity.ts +0 -8
- package/app/canvas/use-agent-changes.tsx +34 -40
- package/app/canvas/use-canvas-clipboard.tsx +11 -14
- package/app/canvas/xray.ts +3 -12
- package/app/frame.tsx +5 -0
- package/app/i18n/locales/en/messages.po +114 -12
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +114 -12
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/{sets/lucide.tsx → glyphs.tsx} +7 -5
- package/app/icons/index.tsx +3 -3
- package/app/icons/types.ts +3 -10
- package/app/index.html +3 -3
- package/app/main.tsx +3 -0
- package/app/pages/canvas-settings.tsx +35 -0
- package/app/pages/canvas.tsx +27 -8
- package/app/pages/commands-settings.tsx +16 -2
- package/app/shell/about.tsx +5 -4
- package/app/shell/feedback-details.ts +0 -3
- package/app/shell/feedback-form.tsx +10 -21
- package/app/shell/feedback-link.tsx +2 -1
- package/app/shell/instructions-editor.tsx +1 -1
- package/app/shell/presence-style.ts +59 -0
- package/app/shell/presence.tsx +6 -3
- package/app/shell/scaled-frame.tsx +21 -9
- package/app/shell/settings-sections.ts +12 -0
- package/app/shell/sidebar.tsx +1 -1
- package/app/studio-ui.d.ts +0 -9
- package/app/types.ts +21 -205
- package/app/ui/file-drop.ts +128 -0
- package/app/ui/prompt-editor.tsx +1 -1
- package/app/ui/shadcn/input-group.tsx +2 -2
- package/dist/cli/banner.d.mts +4 -2
- package/dist/cli/banner.mjs +34 -11
- package/dist/cli/commands/app.mjs +19 -11
- package/dist/cli/commands/create.d.mts +26 -14
- package/dist/cli/commands/create.mjs +13 -7
- package/dist/cli/commands/dev.mjs +2 -3
- package/dist/cli/commands/hook.mjs +2 -1
- package/dist/cli/commands/init.d.mts +11 -6
- package/dist/cli/help.d.mts +1 -1
- package/dist/cli/help.mjs +3 -3
- package/dist/cli/main.d.mts +22 -12
- package/dist/config/index.d.mts +6 -5
- package/dist/config/project-files.d.mts +6 -3
- package/dist/config/project-files.mjs +14 -5
- package/dist/config/renamed.d.mts +0 -2
- package/dist/config/renamed.mjs +1 -3
- package/dist/config/schema.d.mts +0 -5
- package/dist/config/schema.mjs +0 -5
- package/dist/content/capture.d.mts +2 -2
- package/dist/content/capture.mjs +2 -2
- package/dist/content/content.d.mts +3 -141
- package/dist/content/content.mjs +7 -65
- package/dist/content/flow-specs.mjs +1 -1
- package/dist/content/prototype-summary.d.mts +3 -39
- package/dist/content/prototype-summary.mjs +2 -3
- package/dist/content/prototypes.mjs +1 -1
- package/dist/content/snapshot-client.mjs +1 -1
- package/dist/content/text-replace.d.mts +30 -0
- package/dist/content/text-replace.mjs +309 -0
- package/dist/content/thread-module.mjs +1 -1
- package/dist/content/threads.mjs +1 -1
- package/dist/paths.d.mts +0 -2
- package/dist/paths.mjs +1 -3
- package/dist/server/agent-env.d.mts +5 -1
- package/dist/server/agent-env.mjs +7 -2
- package/dist/server/agent-session.d.mts +14 -1
- package/dist/server/agent-session.mjs +84 -19
- package/dist/server/brief.mjs +3 -3
- package/dist/server/build-pictures.mjs +1 -1
- package/dist/server/channel.d.mts +19 -24
- package/dist/server/channel.mjs +70 -37
- package/dist/server/claimed-presence.d.mts +18 -0
- package/dist/server/claimed-presence.mjs +58 -0
- package/dist/server/close-check.mjs +2 -2
- package/dist/server/comments/actions.d.mts +153 -0
- package/dist/server/comments/actions.mjs +154 -0
- package/dist/server/comments/routes.d.mts +25 -0
- package/dist/server/comments/routes.mjs +88 -0
- package/dist/server/comments/tools.d.mts +6 -0
- package/dist/server/comments/tools.mjs +154 -0
- package/dist/server/dev-server.mjs +36 -13
- package/dist/server/file-errors.d.mts +7 -2
- package/dist/server/file-errors.mjs +31 -8
- package/dist/server/file-lock.d.mts +2 -2
- package/dist/server/file-lock.mjs +130 -36
- package/dist/server/mcp.d.mts +0 -2
- package/dist/server/mcp.mjs +7 -8
- package/dist/server/me.d.mts +1 -1
- package/dist/server/open-page.d.mts +22 -0
- package/dist/server/open-page.mjs +20 -2
- package/dist/server/outcome.d.mts +22 -0
- package/dist/server/outcome.mjs +8 -0
- package/dist/server/own-copies.mjs +2 -2
- package/dist/server/people.d.mts +1 -1
- package/dist/server/port.d.mts +12 -0
- package/dist/server/port.mjs +66 -14
- package/dist/server/presence.d.mts +4 -1
- package/dist/server/presence.mjs +2 -2
- package/dist/server/requests.d.mts +5 -1
- package/dist/server/requests.mjs +32 -47
- package/dist/server/studio-for.d.mts +5 -0
- package/dist/server/studio-for.mjs +18 -4
- package/dist/server/sync-install.d.mts +8 -12
- package/dist/server/sync-install.mjs +12 -30
- package/dist/server/thread-source.mjs +2 -2
- package/dist/server/tools/describe.d.mts +1 -1
- package/dist/server/tools/describe.mjs +1 -1
- package/dist/server/tools/feedback.d.mts +1 -1
- package/dist/server/tools/reading.mjs +13 -4
- package/dist/server/tools/show.d.mts +1 -1
- package/dist/server/tools/snapshot.d.mts +1 -1
- package/dist/server/tools/thread-list.mjs +1 -1
- package/dist/server/tools/watch.mjs +5 -3
- package/dist/server/vite.mjs +28 -31
- package/dist/server/web-app.mjs +7 -10
- package/dist/server/work-groups.mjs +1 -1
- package/dist/setup/apply.mjs +8 -14
- package/dist/setup/create.d.mts +4 -2
- package/dist/setup/create.mjs +118 -36
- package/dist/setup/design-system-checks.mjs +3 -12
- package/dist/setup/desktop-app-script.mjs +4 -3
- package/dist/setup/desktop-app-start.d.mts +8 -2
- package/dist/setup/desktop-app-start.mjs +64 -29
- package/dist/setup/desktop-app.d.mts +8 -0
- package/dist/setup/desktop-app.mjs +20 -4
- package/dist/setup/detect.d.mts +14 -7
- package/dist/setup/detect.mjs +56 -10
- package/dist/setup/doctor.mjs +2 -4
- package/dist/setup/existing-setup.d.mts +1 -3
- package/dist/setup/existing-setup.mjs +10 -11
- package/dist/setup/migrate/row-titles.mjs +1 -1
- package/dist/setup/own-app.d.mts +1 -2
- package/dist/setup/own-app.mjs +4 -5
- package/dist/setup/plan.d.mts +8 -6
- package/dist/setup/plan.mjs +64 -48
- package/dist/setup/project.d.mts +6 -17
- package/dist/setup/project.mjs +17 -61
- package/dist/setup/prompts.d.mts +5 -5
- package/dist/setup/prompts.mjs +28 -61
- package/dist/setup/questions.d.mts +12 -4
- package/dist/setup/questions.mjs +10 -25
- package/dist/setup/starters.d.mts +2 -0
- package/dist/setup/starters.mjs +26 -9
- package/dist/setup/workspace-setup.d.mts +1 -2
- package/dist/setup/workspace-setup.mjs +4 -6
- package/dist/setup/write.d.mts +15 -5
- package/dist/setup/write.mjs +35 -9
- package/dist/shared/annotations-core.mjs +1 -1
- package/dist/shared/canvas-core.mjs +1 -1
- package/dist/shared/canvas-file.d.mts +201 -0
- package/dist/shared/canvas-file.mjs +1 -0
- package/dist/shared/comments/routes.d.mts +53 -0
- package/dist/shared/comments/routes.mjs +37 -0
- package/dist/shared/feedback.d.mts +8 -0
- package/dist/shared/feedback.mjs +10 -2
- package/dist/shared/page-review.d.mts +2 -11
- package/dist/shared/page-review.mjs +4 -13
- package/dist/shared/presence-core.d.mts +11 -0
- package/dist/shared/presence-core.mjs +11 -2
- package/dist/shared/review-file.d.mts +5 -0
- package/dist/shared/review-file.mjs +23 -13
- package/dist/shared/server-page.mjs +7 -1
- package/dist/shared/signup.d.mts +2 -5
- package/dist/shared/signup.mjs +2 -35
- package/dist/shared/studio-events.d.mts +0 -6
- package/dist/shared/studio-events.mjs +1 -5
- package/dist/shared/studio-files.d.mts +12 -0
- package/dist/shared/studio-files.mjs +6 -1
- package/dist/shared/studio-routes.d.mts +16 -62
- package/dist/shared/studio-routes.mjs +1 -69
- package/dist/shared/threads-core.d.mts +2 -2
- package/dist/shared/threads-core.mjs +1 -1
- package/extension/dist/feedback.js +148 -138
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/picker.js +146 -136
- package/package.json +3 -20
- package/src/cli/banner.ts +45 -11
- package/src/cli/commands/app.ts +23 -8
- package/src/cli/commands/create.ts +17 -9
- package/src/cli/commands/dev.ts +0 -3
- package/src/cli/commands/hook.ts +4 -1
- package/src/cli/help.ts +3 -3
- package/src/config/index.ts +6 -5
- package/src/config/project-files.ts +21 -11
- package/src/config/renamed.ts +0 -3
- package/src/config/schema.ts +0 -1
- package/src/content/capture.ts +6 -12
- package/src/content/content.ts +7 -244
- package/src/content/flow-specs.ts +2 -1
- package/src/content/prototype-summary.ts +4 -44
- package/src/content/review-pages.ts +2 -1
- package/src/content/snapshot-client.ts +1 -1
- package/src/content/text-replace.ts +449 -0
- package/src/paths.ts +0 -8
- package/src/server/agent-env.ts +12 -2
- package/src/server/agent-session.ts +124 -34
- package/src/server/brief.ts +8 -3
- package/src/server/channel.ts +121 -52
- package/src/server/claimed-presence.ts +93 -0
- package/src/server/comments/actions.ts +352 -0
- package/src/server/comments/routes.ts +176 -0
- package/src/server/comments/tools.ts +317 -0
- package/src/server/dev-server.ts +49 -15
- package/src/server/file-errors.ts +47 -13
- package/src/server/file-lock.ts +205 -54
- package/src/server/mcp.ts +13 -14
- package/src/server/me.ts +2 -5
- package/src/server/open-page.ts +54 -4
- package/src/server/outcome.ts +26 -0
- package/src/server/people.ts +2 -1
- package/src/server/port.ts +94 -20
- package/src/server/presence.ts +11 -3
- package/src/server/requests.ts +60 -70
- package/src/server/studio-for.ts +27 -3
- package/src/server/sync-install.ts +35 -26
- package/src/server/thread-place.ts +2 -4
- package/src/server/tools/reading.ts +16 -3
- package/src/server/tools/watch.ts +7 -7
- package/src/server/vite.ts +37 -40
- package/src/server/web-app.ts +14 -12
- package/src/setup/apply.ts +10 -16
- package/src/setup/create.ts +143 -37
- package/src/setup/design-system-checks.ts +7 -15
- package/src/setup/desktop-app-script.ts +4 -3
- package/src/setup/desktop-app-start.ts +94 -26
- package/src/setup/desktop-app.ts +24 -3
- package/src/setup/detect.ts +56 -14
- package/src/setup/doctor.ts +4 -4
- package/src/setup/existing-setup.ts +10 -12
- package/src/setup/own-app.ts +2 -5
- package/src/setup/plan.ts +93 -84
- package/src/setup/project.ts +25 -118
- package/src/setup/prompts.ts +44 -127
- package/src/setup/questions.ts +27 -29
- package/src/setup/starters.ts +35 -10
- package/src/setup/workspace-setup.ts +8 -18
- package/src/setup/write.ts +52 -9
- package/src/shared/canvas-file.ts +205 -0
- package/src/shared/comments/routes.ts +79 -0
- package/src/shared/feedback.ts +14 -4
- package/src/shared/page-review.ts +11 -16
- package/src/shared/presence-core.ts +16 -2
- package/src/shared/review-file.ts +28 -12
- package/src/shared/server-page.ts +11 -1
- package/src/shared/signup.ts +4 -28
- package/src/shared/studio-events.ts +0 -13
- package/src/shared/studio-files.ts +14 -0
- package/src/shared/studio-routes.ts +21 -64
- package/src/shared/threads-core.ts +2 -2
- package/templates/methods/review.md +2 -2
- package/templates/rules/canvas-frames.md +104 -0
- package/templates/rules/canvas.md +8 -142
- package/templates/rules/prototypes.md +1 -1
- package/templates/rules/snapshots.md +52 -0
- package/templates/starters/standalone/README.md +7 -7
- package/templates/starters/standalone/components.json +1 -1
- package/templates/starters/standalone/package.json +1 -2
- package/templates/starters/turborepo/README.md +6 -6
- package/templates/starters/turborepo/apps/web/components.json +1 -1
- package/templates/starters/turborepo/apps/web/package.json +1 -2
- package/templates/starters/turborepo/apps/web/src/app.tsx +4 -5
- package/templates/starters/turborepo/packages/ui/components.json +1 -1
- package/templates/starters/turborepo/packages/ui/package.json +1 -2
- package/templates/starters/vite/README.md +7 -6
- package/templates/starters/vite/components.json +1 -1
- package/templates/starters/vite/package.json +1 -2
- package/templates/starters/vite/src/app.tsx +3 -4
- package/templates/starters/vite/src/components/ui/accordion.tsx +71 -0
- package/templates/starters/vite/src/components/ui/attachment.tsx +1 -1
- package/templates/starters/vite/src/components/ui/badge.tsx +2 -2
- package/templates/starters/vite/src/components/ui/button.tsx +17 -12
- package/templates/starters/vite/src/components/ui/card.tsx +1 -1
- package/templates/starters/vite/src/components/ui/checkbox.tsx +28 -0
- package/templates/starters/vite/src/components/ui/dialog.tsx +5 -5
- package/templates/starters/vite/src/components/ui/dropdown-menu.tsx +17 -14
- package/templates/starters/vite/src/components/ui/field.tsx +3 -1
- package/templates/starters/vite/src/components/ui/input-group.tsx +5 -3
- package/templates/starters/vite/src/components/ui/input.tsx +1 -1
- package/templates/starters/vite/src/components/ui/label.tsx +2 -0
- package/templates/starters/vite/src/components/ui/native-select.tsx +3 -4
- package/templates/starters/vite/src/components/ui/popover.tsx +1 -1
- package/templates/starters/vite/src/components/ui/separator.tsx +2 -0
- package/templates/starters/vite/src/components/ui/spinner.tsx +3 -7
- package/templates/starters/vite/src/components/ui/switch.tsx +1 -1
- package/templates/starters/vite/src/components/ui/textarea.tsx +1 -1
- package/templates/starters/vite/src/components/ui/toggle.tsx +4 -2
- package/templates/starters/vite/src/index.css +533 -111
- package/app/icons/sets/hugeicons.tsx +0 -259
- package/app/icons/sets/phosphor.tsx +0 -251
- package/dist/server/icon-set.d.mts +0 -15
- package/dist/server/icon-set.mjs +0 -31
- package/dist/server/tools/close-reply.d.mts +0 -6
- package/dist/server/tools/close-reply.mjs +0 -138
- package/dist/server/tools/comment.d.mts +0 -6
- package/dist/server/tools/comment.mjs +0 -49
- package/dist/shared/icon-sets.d.mts +0 -9
- package/dist/shared/icon-sets.mjs +0 -21
- package/src/server/icon-set.ts +0 -56
- package/src/server/tools/close-reply.ts +0 -271
- package/src/server/tools/comment.ts +0 -96
- package/src/shared/icon-sets.ts +0 -23
- /package/app/public/{sudio-192.png → dex-192.png} +0 -0
- /package/app/public/{sudio-512.png → dex-512.png} +0 -0
- /package/app/public/{apple-touch-icon.png → dex-apple-touch-icon.png} +0 -0
- /package/app/public/{favicon-32.png → dex-icon-32.png} +0 -0
- /package/app/public/{favicon.svg → dex-icon.svg} +0 -0
- /package/app/public/{sudio-maskable-512.png → dex-maskable-512.png} +0 -0
package/src/server/vite.ts
CHANGED
|
@@ -60,7 +60,6 @@ import type {
|
|
|
60
60
|
DesignComponent,
|
|
61
61
|
StudioDesignSystemGuide,
|
|
62
62
|
} from "../shared/design-system.ts";
|
|
63
|
-
import type { InterfaceIcons } from "../shared/icon-sets.ts";
|
|
64
63
|
import { ME_META } from "../shared/studio-routes.ts";
|
|
65
64
|
import {
|
|
66
65
|
publicThreads,
|
|
@@ -76,7 +75,6 @@ import { CloudError } from "./cloud.ts";
|
|
|
76
75
|
import { studioDev } from "./dev-server.ts";
|
|
77
76
|
import { type Feature, features } from "./features.ts";
|
|
78
77
|
import { fileErrors } from "./file-errors.ts";
|
|
79
|
-
import { interfaceIconSet } from "./icon-set.ts";
|
|
80
78
|
import { type Me, readMe } from "./me.ts";
|
|
81
79
|
import { lacksNext, next } from "./next.ts";
|
|
82
80
|
import { projectPublic } from "./project-public.ts";
|
|
@@ -279,6 +277,35 @@ const interfaceTakesDesignSystem = (project: StudioProject): boolean =>
|
|
|
279
277
|
project.ui?.theme === "design-system" ||
|
|
280
278
|
Boolean(project.ui?.components || project.ui?.primitives);
|
|
281
279
|
|
|
280
|
+
/**
|
|
281
|
+
* Where views import the project's components from: the top folder of the
|
|
282
|
+
* package they are in ("src" for src/components/ui), which holds what views
|
|
283
|
+
* import beside them too, such as a block shadcn adds to src/components.
|
|
284
|
+
* Vite's root is Dex's own, so neither Tailwind nor Vite's watcher finds any
|
|
285
|
+
* of it on their own, as they do in the project: views' Tailwind scans it,
|
|
286
|
+
* and the watcher sees a file appear in it (file-errors.ts). Never the
|
|
287
|
+
* package itself, which for an app is the whole repository, its node_modules
|
|
288
|
+
* and Dex's output with it; a package in node_modules gives its components'
|
|
289
|
+
* folder alone.
|
|
290
|
+
*/
|
|
291
|
+
function componentsRoot(project: StudioProject): string | undefined {
|
|
292
|
+
const folder = project.designSystem?.componentSource?.folder;
|
|
293
|
+
if (!folder) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const home = project.designSystem?.componentPackage ?? project.root;
|
|
297
|
+
const path = relative(home, folder);
|
|
298
|
+
if (
|
|
299
|
+
!path ||
|
|
300
|
+
path.startsWith("..") ||
|
|
301
|
+
isAbsolute(path) ||
|
|
302
|
+
folder.split(sep).includes("node_modules")
|
|
303
|
+
) {
|
|
304
|
+
return folder;
|
|
305
|
+
}
|
|
306
|
+
return join(home, path.split(sep)[0] ?? "");
|
|
307
|
+
}
|
|
308
|
+
|
|
282
309
|
/**
|
|
283
310
|
* Two stylesheets per project, one for each page. The frame page's is what
|
|
284
311
|
* the real product would have: the design system's CSS (it brings Tailwind
|
|
@@ -306,7 +333,6 @@ export async function writeEntries(
|
|
|
306
333
|
.map((folder) => `@source "${from(folder)}";`)
|
|
307
334
|
),
|
|
308
335
|
];
|
|
309
|
-
const componentFolder = project.designSystem?.componentSource?.folder;
|
|
310
336
|
const tailwind = tailwindSetup(project.root);
|
|
311
337
|
// Tailwind 3's config, for Tailwind 4 wherever the design system's theme is
|
|
312
338
|
// used: the one beside the components views render (Dub's packages/ui, for
|
|
@@ -324,7 +350,7 @@ export async function writeEntries(
|
|
|
324
350
|
`@import "${from(join(APP_DIR, "frame.css"))}";`,
|
|
325
351
|
...config,
|
|
326
352
|
`@source "${from(prototypesDir(project.content))}";`,
|
|
327
|
-
...sources([
|
|
353
|
+
...sources([componentsRoot(project)]),
|
|
328
354
|
"",
|
|
329
355
|
].join("\n");
|
|
330
356
|
const own = [
|
|
@@ -386,22 +412,14 @@ async function sourceFiles(dir: string): Promise<string[]> {
|
|
|
386
412
|
return files;
|
|
387
413
|
}
|
|
388
414
|
|
|
389
|
-
const ICON_SETS_DIR = join(APP_DIR, "icons", "sets");
|
|
390
|
-
const iconSetFile = (set: InterfaceIcons): string =>
|
|
391
|
-
join(ICON_SETS_DIR, `${set}.tsx`);
|
|
392
|
-
|
|
393
415
|
/**
|
|
394
|
-
* Every library the studio's own interface imports
|
|
395
|
-
* it draws with: the others may not be installed. Installed from npm, the
|
|
416
|
+
* Every library the studio's own interface imports. Installed from npm, the
|
|
396
417
|
* interface lives in node_modules, where Vite neither crawls imports nor
|
|
397
418
|
* converts CommonJS for the browser, so they are listed for it to prepare.
|
|
398
419
|
*/
|
|
399
|
-
async function interfaceDependencies(
|
|
420
|
+
async function interfaceDependencies(): Promise<string[]> {
|
|
400
421
|
const found = new Set<string>();
|
|
401
|
-
const
|
|
402
|
-
(file) => dirname(file) !== ICON_SETS_DIR || file === iconSetFile(icons)
|
|
403
|
-
);
|
|
404
|
-
for (const file of files) {
|
|
422
|
+
for (const file of await sourceFiles(APP_DIR)) {
|
|
405
423
|
for (const specifier of importsIn(await readFile(file, "utf8"))) {
|
|
406
424
|
// Macros compile away (studioMacros); bundled, they throw at runtime.
|
|
407
425
|
if (!MACRO_IMPORT_RE.test(specifier)) {
|
|
@@ -468,26 +486,6 @@ const studioMacros = (): Plugin => {
|
|
|
468
486
|
};
|
|
469
487
|
};
|
|
470
488
|
|
|
471
|
-
const ICONS_MODULE = "virtual:studio-icons";
|
|
472
|
-
const RESOLVED_ICONS_MODULE = `\0${ICONS_MODULE}`;
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
* `virtual:studio-icons`: the glyphs of the icon set the interface draws
|
|
476
|
-
* with (interfaceIconSet). Only that set is bundled.
|
|
477
|
-
*/
|
|
478
|
-
const studioIcons = (project: StudioProject): Plugin => {
|
|
479
|
-
const set = interfaceIconSet(project);
|
|
480
|
-
return {
|
|
481
|
-
name: "studio-icons",
|
|
482
|
-
resolveId: (id) =>
|
|
483
|
-
id === ICONS_MODULE ? RESOLVED_ICONS_MODULE : undefined,
|
|
484
|
-
load: (id) =>
|
|
485
|
-
id === RESOLVED_ICONS_MODULE
|
|
486
|
-
? `export { glyphs } from ${JSON.stringify(iconSetFile(set))};\n`
|
|
487
|
-
: undefined,
|
|
488
|
-
};
|
|
489
|
-
};
|
|
490
|
-
|
|
491
489
|
/**
|
|
492
490
|
* While serving, what a module made from `build` in dex.config.ts has is
|
|
493
491
|
* made again once the file changes (Settings → Deployment writes it), so a
|
|
@@ -630,9 +628,9 @@ const studioInterface = (project: StudioProject): Plugin => {
|
|
|
630
628
|
const build = serving
|
|
631
629
|
? await readBuildSettings(project.root)
|
|
632
630
|
: project.build;
|
|
633
|
-
const { title, subtitle, theme, locale, chromeTheme, components
|
|
631
|
+
const { title, subtitle, theme, locale, chromeTheme, components } =
|
|
634
632
|
project.ui ?? {};
|
|
635
|
-
const settings = `export const ui = ${JSON.stringify({ title: workspaceName(title), subtitle, theme, locale, chromeTheme,
|
|
633
|
+
const settings = `export const ui = ${JSON.stringify({ title: workspaceName(title), subtitle, theme, locale, chromeTheme, workspaceIcon })};`;
|
|
636
634
|
const slots = components
|
|
637
635
|
? `export * as slots from ${JSON.stringify(resolve(project.root, components))};`
|
|
638
636
|
: "export const slots = {};";
|
|
@@ -1114,7 +1112,6 @@ export async function viteConfig(
|
|
|
1114
1112
|
reactFromStudio(),
|
|
1115
1113
|
tailwindcss(),
|
|
1116
1114
|
studioInterface(project),
|
|
1117
|
-
studioIcons(project),
|
|
1118
1115
|
studioThreads(project),
|
|
1119
1116
|
studioDesignSystem(project),
|
|
1120
1117
|
studioComponents(project),
|
|
@@ -1125,7 +1122,7 @@ export async function viteConfig(
|
|
|
1125
1122
|
...((await lacksNext(project)) ? [next()] : []),
|
|
1126
1123
|
studioDev(project),
|
|
1127
1124
|
// A broken file in the content folder breaks only what loads it.
|
|
1128
|
-
fileErrors(project.content),
|
|
1125
|
+
fileErrors(project.content, componentsRoot(project)),
|
|
1129
1126
|
studioWebApp(project),
|
|
1130
1127
|
projectPublic(project.root),
|
|
1131
1128
|
],
|
|
@@ -1164,7 +1161,7 @@ export async function viteConfig(
|
|
|
1164
1161
|
},
|
|
1165
1162
|
},
|
|
1166
1163
|
optimizeDeps: {
|
|
1167
|
-
include: await interfaceDependencies(
|
|
1164
|
+
include: await interfaceDependencies(),
|
|
1168
1165
|
},
|
|
1169
1166
|
preview: { port: project.port },
|
|
1170
1167
|
// The instructions editor is a large chunk on purpose: it loads only
|
package/src/server/web-app.ts
CHANGED
|
@@ -11,14 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
import { homedir } from "node:os";
|
|
13
13
|
import { basename, sep } from "node:path";
|
|
14
|
-
import type { Plugin } from "vite";
|
|
14
|
+
import type { Plugin, ViteDevServer } from "vite";
|
|
15
15
|
import { runningVersion } from "../paths.ts";
|
|
16
16
|
import {
|
|
17
17
|
APP_NAME,
|
|
18
|
-
type DesktopApp,
|
|
19
|
-
desktopApp,
|
|
20
18
|
desktopAppState,
|
|
21
19
|
desktopAppUnavailable,
|
|
20
|
+
servedApp,
|
|
22
21
|
urlScheme,
|
|
23
22
|
} from "../setup/desktop-app.ts";
|
|
24
23
|
import { serverPage, shownPath } from "../shared/server-page.ts";
|
|
@@ -71,10 +70,10 @@ const webAppManifest = (name: string): WebAppManifest => ({
|
|
|
71
70
|
background_color: LIGHT,
|
|
72
71
|
theme_color: LIGHT,
|
|
73
72
|
icons: [
|
|
74
|
-
{ src: "
|
|
75
|
-
{ src: "
|
|
73
|
+
{ src: "dex-192.png", sizes: "192x192", type: "image/png" },
|
|
74
|
+
{ src: "dex-512.png", sizes: "512x512", type: "image/png" },
|
|
76
75
|
{
|
|
77
|
-
src: "
|
|
76
|
+
src: "dex-maskable-512.png",
|
|
78
77
|
sizes: "512x512",
|
|
79
78
|
type: "image/png",
|
|
80
79
|
purpose: "maskable",
|
|
@@ -155,8 +154,8 @@ const rememberAppScript = (startsHere: boolean): string => {
|
|
|
155
154
|
export function studioWebApp(project: { root: string }): Plugin {
|
|
156
155
|
let base = "/";
|
|
157
156
|
let serving = false;
|
|
158
|
-
//
|
|
159
|
-
let
|
|
157
|
+
// `dex dev`'s server: the app it makes opens the port it is served on.
|
|
158
|
+
let devServer: ViteDevServer | undefined;
|
|
160
159
|
const name = APP_NAME;
|
|
161
160
|
const manifest = JSON.stringify(webAppManifest(name), null, 2);
|
|
162
161
|
return {
|
|
@@ -164,12 +163,9 @@ export function studioWebApp(project: { root: string }): Plugin {
|
|
|
164
163
|
configResolved(config) {
|
|
165
164
|
base = config.base;
|
|
166
165
|
serving = config.command === "serve";
|
|
167
|
-
app =
|
|
168
|
-
serving && desktopAppUnavailable() === undefined
|
|
169
|
-
? desktopApp({ root: project.root, port: config.server.port, base })
|
|
170
|
-
: undefined;
|
|
171
166
|
},
|
|
172
167
|
configureServer(server) {
|
|
168
|
+
devServer = server;
|
|
173
169
|
const worker = serviceWorker(project.root);
|
|
174
170
|
const id = projectId(project.root);
|
|
175
171
|
server.middlewares.use((request, response, next) => {
|
|
@@ -218,6 +214,12 @@ export function studioWebApp(project: { root: string }): Plugin {
|
|
|
218
214
|
return tags;
|
|
219
215
|
}
|
|
220
216
|
tags.push(head("script", { type: "module" }, registration(base)));
|
|
217
|
+
// The app as `dex dev` would make it here, on a Mac: a page is
|
|
218
|
+
// served only once the server listens, so on the port it took.
|
|
219
|
+
const app =
|
|
220
|
+
devServer && desktopAppUnavailable() === undefined
|
|
221
|
+
? servedApp(project.root, devServer)
|
|
222
|
+
: undefined;
|
|
221
223
|
if (app) {
|
|
222
224
|
const { startsHere } = await desktopAppState(app);
|
|
223
225
|
tags.push(
|
package/src/setup/apply.ts
CHANGED
|
@@ -28,7 +28,6 @@ import { type AgentsSetUp, addAgent, setUpAgents } from "../server/agents.ts";
|
|
|
28
28
|
import { nextPackage } from "../server/next.ts";
|
|
29
29
|
import { STATE_FOLDER } from "../server/state.ts";
|
|
30
30
|
import type { StylingApproach } from "../shared/design-system.ts";
|
|
31
|
-
import { ICON_SET_NAMES } from "../shared/icon-sets.ts";
|
|
32
31
|
import { jsonLike } from "../shared/json-style.ts";
|
|
33
32
|
import { STUDIO_FILES } from "../shared/studio-files.ts";
|
|
34
33
|
import { choicesOnly, type DesignSystemChoices } from "./config-choices.ts";
|
|
@@ -75,8 +74,10 @@ import {
|
|
|
75
74
|
ignoreFile,
|
|
76
75
|
missingIgnoreLines,
|
|
77
76
|
missingScripts,
|
|
77
|
+
pnpmDecidesEsbuild,
|
|
78
78
|
STUDIO_TYPES,
|
|
79
79
|
tsconfigJson,
|
|
80
|
+
withEsbuildBuilds,
|
|
80
81
|
withIgnoreLines,
|
|
81
82
|
withPointer,
|
|
82
83
|
} from "./write.ts";
|
|
@@ -292,18 +293,9 @@ function afterShadcn(root: string, decisions: SetupDecisions): SetupDecisions {
|
|
|
292
293
|
}
|
|
293
294
|
const choice = componentsChoice(library, root);
|
|
294
295
|
const value: ComponentsDecision = { kind: "folder", choice };
|
|
295
|
-
const icons = choice.icons ?? decisions.icons.value;
|
|
296
296
|
return {
|
|
297
297
|
...decisions,
|
|
298
298
|
components: { ...decisions.components, value },
|
|
299
|
-
icons:
|
|
300
|
-
decisions.icons.source === "--icons"
|
|
301
|
-
? decisions.icons
|
|
302
|
-
: {
|
|
303
|
-
...decisions.icons,
|
|
304
|
-
value: icons,
|
|
305
|
-
shown: ICON_SET_NAMES[icons],
|
|
306
|
-
},
|
|
307
299
|
// A stylesheet given or left out with --styles stays as it was.
|
|
308
300
|
styles:
|
|
309
301
|
decisions.styles.value || decisions.styles.source === NO_STYLES
|
|
@@ -419,7 +411,6 @@ async function writeStep(
|
|
|
419
411
|
configSource(written, {
|
|
420
412
|
studio: posix(relative(packageDir, content)) || ".",
|
|
421
413
|
primitives: decisions.primitives.value,
|
|
422
|
-
icons: decisions.icons.value,
|
|
423
414
|
next:
|
|
424
415
|
nextPackage(
|
|
425
416
|
nextFolders(packageDir, decisions, resolved?.componentPackage)
|
|
@@ -439,7 +430,6 @@ async function writeStep(
|
|
|
439
430
|
await write(file, STUDIO_TYPES);
|
|
440
431
|
} else if (step.write === "scripts") {
|
|
441
432
|
const spec = plan.workspace?.studioSpec;
|
|
442
|
-
const icons = plan.workspace ? plan.iconPackages : {};
|
|
443
433
|
// Its own app's dev is the studio: it gets no script of its own.
|
|
444
434
|
const own = plan.target.kind === "own-app";
|
|
445
435
|
await editManifest(file, (manifest) => {
|
|
@@ -448,11 +438,10 @@ async function writeStep(
|
|
|
448
438
|
manifest.scripts = { ...scripts, ...missingScripts(scripts) };
|
|
449
439
|
}
|
|
450
440
|
// In a workspace the package asks for the studio; the root installs.
|
|
451
|
-
if (spec
|
|
441
|
+
if (spec) {
|
|
452
442
|
manifest.devDependencies = {
|
|
453
443
|
...recordAt(manifest, "devDependencies"),
|
|
454
|
-
|
|
455
|
-
...icons,
|
|
444
|
+
[PACKAGE_NAME]: spec,
|
|
456
445
|
};
|
|
457
446
|
}
|
|
458
447
|
});
|
|
@@ -460,7 +449,7 @@ async function writeStep(
|
|
|
460
449
|
const script = plan.workspace.studioScript;
|
|
461
450
|
await editManifest(file, (manifest) => {
|
|
462
451
|
const scripts = recordAt(manifest, "scripts");
|
|
463
|
-
manifest.scripts = { ...scripts,
|
|
452
|
+
manifest.scripts = { ...scripts, dex: scripts.dex ?? script };
|
|
464
453
|
});
|
|
465
454
|
} else {
|
|
466
455
|
await editProjectFile(step, file, plan);
|
|
@@ -486,6 +475,11 @@ async function editProjectFile(
|
|
|
486
475
|
await writeFile(file, withIgnoreLines(text, missing));
|
|
487
476
|
} else if (step.write === "pointer") {
|
|
488
477
|
await writeFile(file, withPointer(text, studio));
|
|
478
|
+
} else if (step.write === "pnpm-builds") {
|
|
479
|
+
const edited = withEsbuildBuilds(text);
|
|
480
|
+
if (edited !== undefined && !pnpmDecidesEsbuild(text)) {
|
|
481
|
+
await writeFile(file, edited);
|
|
482
|
+
}
|
|
489
483
|
}
|
|
490
484
|
}
|
|
491
485
|
|