create-obsidian-arrow 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/cli/create.mjs +65 -0
- package/cli/detect-pm.mjs +20 -0
- package/cli/lib.mjs +117 -0
- package/cli/refresh.mjs +65 -0
- package/index.mjs +47 -204
- package/package.json +11 -2
- package/template/.husky/pre-commit +3 -2
- package/template/AGENTS.md +58 -12
- package/template/README.md +67 -31
- package/template/_gitignore +4 -1
- package/template/biome.json +7 -1
- package/template/docs/prompts/agent-setup.md +24 -20
- package/template/docs/prompts/update-existing.md +3 -3
- package/template/docs/workflow.md +11 -7
- package/template/package.json +15 -14
- package/template/src/components/DiffViewer/DiffViewer.css +41 -0
- package/template/src/components/DiffViewer/DiffViewer.ts +55 -0
- package/template/src/components/EmptyState/EmptyState.css +5 -5
- package/template/src/components/EmptyState/EmptyState.ts +5 -9
- package/template/src/utilities.css +259 -1
- package/template/src/views/DiffViewer/DiffViewerView.css +42 -0
- package/template/src/views/DiffViewer/DiffViewerView.ts +53 -0
- package/template/src/views/ExampleView/ExampleView.ts +92 -0
- package/template/stories/components/ComponentShell.stories.ts +28 -0
- package/template/stories/components/EmptyState.stories.ts +1 -0
- package/template/stories/components/LoadingState.stories.ts +1 -0
- package/template/stories/components/Toggle.stories.ts +50 -0
- package/template/stories/views/DiffViewer/DiffViewer.stories.ts +94 -0
- package/template/stories/views/EditorView.stories.ts +55 -0
- package/template/stories/views/ExampleView/ExampleView.stories.ts +15 -0
- package/template/stories/views/PanelView.stories.ts +61 -0
- package/template/stories/views/SettingsPanel/SettingsPanel.stories.ts +14 -0
- package/template/test/css-structure.test.mjs +112 -0
- package/template/test/template-footguns.test.mjs +85 -6
- package/template/test/viewer-stories.test.mjs +12 -0
- package/template/tools/router/client.ts +26 -4
- package/template/tools/router/routeToPage.ts +29 -13
- package/template/tools/sandbox/frame.ts +7 -27
- package/template/tools/sandbox/home.ts +6 -11
- package/template/tools/sandbox/layout.ts +24 -2
- package/template/tools/sandbox/sandbox.css +188 -226
- package/template/tools/sandbox/shell.ts +2 -2
- package/template/tools/sandbox/toolbar.ts +20 -9
- package/template/tools/viewer/ClassesPage.ts +7 -7
- package/template/tools/viewer/ComponentsIndex.ts +3 -3
- package/template/tools/viewer/StoryPage.ts +53 -40
- package/template/tools/viewer/TokensPage.ts +10 -10
- package/template/tools/viewer/ViewsIndex.ts +66 -0
- package/template/tools/viewer/discovery.ts +2 -0
- package/template/tools/viewer/obsidian-classes.ts +1 -1
- package/template/tools/viewer/sidebar.ts +27 -38
- package/template/tools/viewer/stories.ts +16 -2
- package/template/.github/workflows/ci.yml +0 -36
- package/template/pnpm-lock.yaml +0 -1608
- package/template/scripts/create-component.mjs +0 -101
- package/template/scripts/create-view.mjs +0 -75
- package/template/src/components/DiffViewer.ts +0 -42
- package/template/stories/DiffViewer.stories.ts +0 -75
- package/template/stories/SettingsPanel.stories.ts +0 -11
- package/template/stories/Toggle.stories.ts +0 -28
|
@@ -1,35 +1,15 @@
|
|
|
1
1
|
import { html } from "@arrow-js/core";
|
|
2
2
|
import type { ArrowExpression, ArrowTemplate } from "@arrow-js/core";
|
|
3
|
-
import { layoutState, startResize } from "./layout";
|
|
4
|
-
import { themeState, toggleTheme } from "./theme";
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* (.workspace-leaf, .view-header, .view-content) so the chrome is styled by
|
|
10
|
-
* app.css. Width is driven by reactive layout state (toolbar slider / presets /
|
|
11
|
-
* the edge drag handle); height fills the stage.
|
|
5
|
+
* Story details frame — fixed-width left panel showing story metadata
|
|
6
|
+
* (REFERENCES, VARIANTS, etc.). This is sandbox chrome, not an Obsidian leaf.
|
|
12
7
|
*
|
|
13
|
-
*
|
|
8
|
+
* No view-header here: the breadcrumb lives in the top toolbar, and the right
|
|
9
|
+
* canvas shows whatever view-header the story component defines.
|
|
14
10
|
*/
|
|
15
|
-
export const Frame = (
|
|
16
|
-
<div class="
|
|
17
|
-
<div class="
|
|
18
|
-
<div class="view-header">
|
|
19
|
-
<div class="oas-view-header-left">
|
|
20
|
-
<a class="clickable-icon oas-home" href="/" aria-label="Examples">⌂</a>
|
|
21
|
-
<div class="view-header-title">${title}</div>
|
|
22
|
-
</div>
|
|
23
|
-
<div class="view-actions">
|
|
24
|
-
<button
|
|
25
|
-
class="clickable-icon oas-theme-toggle"
|
|
26
|
-
aria-label="Toggle theme"
|
|
27
|
-
@click="${toggleTheme}"
|
|
28
|
-
>${() => (themeState.theme === "theme-dark" ? "☾" : "☀")}</button>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
<div class="view-content oas-view-content">${content}</div>
|
|
32
|
-
</div>
|
|
33
|
-
<div class="oas-resize-handle" aria-hidden="true" @mousedown="${startResize}"></div>
|
|
11
|
+
export const Frame = (content: ArrowExpression): ArrowTemplate => html`
|
|
12
|
+
<div class="oasbox-frame">
|
|
13
|
+
<div class="oasbox-view-content">${content}</div>
|
|
34
14
|
</div>
|
|
35
15
|
`;
|
|
@@ -30,6 +30,7 @@ const GETTING_STARTED = [
|
|
|
30
30
|
|
|
31
31
|
const VIEWS = [
|
|
32
32
|
{ label: "Components", path: "/components", note: "Component story viewer" },
|
|
33
|
+
{ label: "Views", path: "/views", note: "Full-pane view stories" },
|
|
33
34
|
{ label: "Tokens", path: "/reference", note: "CSS custom property reference" },
|
|
34
35
|
{ label: "Classes", path: "/reference/classes", note: "Obsidian class catalog" },
|
|
35
36
|
];
|
|
@@ -38,7 +39,7 @@ export const Home = component((): ArrowTemplate => {
|
|
|
38
39
|
setTimeout(recheck, 250);
|
|
39
40
|
|
|
40
41
|
return html`
|
|
41
|
-
<div class="
|
|
42
|
+
<div class="oasbox-settings">
|
|
42
43
|
<div class="setting-item setting-item-heading">
|
|
43
44
|
<div class="setting-item-info">
|
|
44
45
|
<div class="setting-item-name">Obsidian Arrow Sandbox</div>
|
|
@@ -63,7 +64,7 @@ export const Home = component((): ArrowTemplate => {
|
|
|
63
64
|
style="${() =>
|
|
64
65
|
`color: ${stylingLoaded() ? "var(--text-success)" : "var(--text-error)"}; font-weight: var(--font-semibold);`}"
|
|
65
66
|
>${() => (stylingLoaded() ? "READY" : "MISSING")}</span>
|
|
66
|
-
<button class="
|
|
67
|
+
<button class="oasbox-recheck" @click="${recheck}">Re-check</button>
|
|
67
68
|
</div>
|
|
68
69
|
</div>
|
|
69
70
|
|
|
@@ -88,7 +89,7 @@ export const Home = component((): ArrowTemplate => {
|
|
|
88
89
|
<span class="oas-card-chevron">›</span>
|
|
89
90
|
</div>
|
|
90
91
|
<div class="oas-card-body">
|
|
91
|
-
<div class="
|
|
92
|
+
<div class="oasbox-settings">
|
|
92
93
|
${GETTING_STARTED.map((step) =>
|
|
93
94
|
html`
|
|
94
95
|
<div class="setting-item">
|
|
@@ -108,13 +109,7 @@ export const Home = component((): ArrowTemplate => {
|
|
|
108
109
|
</div>
|
|
109
110
|
</div>
|
|
110
111
|
|
|
111
|
-
<div class="
|
|
112
|
-
<div class="setting-item setting-item-heading">
|
|
113
|
-
<div class="setting-item-info">
|
|
114
|
-
<div class="setting-item-name">Views</div>
|
|
115
|
-
<div class="setting-item-description">Main pages in this sandbox.</div>
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
112
|
+
<div class="oasbox-settings">
|
|
118
113
|
${VIEWS.map((view) =>
|
|
119
114
|
html`
|
|
120
115
|
<div class="setting-item">
|
|
@@ -125,7 +120,7 @@ export const Home = component((): ArrowTemplate => {
|
|
|
125
120
|
<div class="setting-item-description">${view.note}</div>
|
|
126
121
|
</div>
|
|
127
122
|
<div class="setting-item-control">
|
|
128
|
-
<a class="mod-cta
|
|
123
|
+
<a class="mod-cta oasbox-open-link" href="${view.path}">Open</a>
|
|
129
124
|
</div>
|
|
130
125
|
</div>
|
|
131
126
|
`.key(view.label)
|
|
@@ -6,9 +6,30 @@ import { reactive } from "@arrow-js/core";
|
|
|
6
6
|
* chrome — not ported into the plugin.
|
|
7
7
|
*/
|
|
8
8
|
export const MIN_WIDTH = 240;
|
|
9
|
-
export const WIDTH_PRESETS = [280, 360, 480, 640];
|
|
9
|
+
export const WIDTH_PRESETS = [280, 360, 480, 640, 800];
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/** Sensible starting pane width per view chrome. Editor (readable-line-width)
|
|
12
|
+
* views need a pane wider than --file-line-width (700px) for the centering to
|
|
13
|
+
* be visible; panels open at the standard side-panel width. */
|
|
14
|
+
export const PANEL_DEFAULT_WIDTH = 420;
|
|
15
|
+
export const EDITOR_DEFAULT_WIDTH = 820;
|
|
16
|
+
|
|
17
|
+
/** `userAdjusted` flips true the first time the tester drags the handle; after
|
|
18
|
+
* that we stop applying per-page defaults so their chosen width sticks. */
|
|
19
|
+
export const layoutState = reactive<{ width: number; userAdjusted: boolean }>({
|
|
20
|
+
width: PANEL_DEFAULT_WIDTH,
|
|
21
|
+
userAdjusted: false,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/** Apply a route's preferred default width, unless the tester has taken over. */
|
|
25
|
+
export function applyDefaultWidth(px: number): void {
|
|
26
|
+
if (!layoutState.userAdjusted) {
|
|
27
|
+
setWidth(px);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Current page breadcrumb shown in the toolbar. Updated by the client router. */
|
|
32
|
+
export const pageState = reactive<{ breadcrumb: string }>({ breadcrumb: "" });
|
|
12
33
|
|
|
13
34
|
function maxWidth(): number {
|
|
14
35
|
return Math.max(MIN_WIDTH, window.innerWidth);
|
|
@@ -22,6 +43,7 @@ export function setWidth(px: number): void {
|
|
|
22
43
|
* binds directly to Arrow's `@mousedown` handler signature. */
|
|
23
44
|
export function startResize(event: Event): void {
|
|
24
45
|
event.preventDefault();
|
|
46
|
+
layoutState.userAdjusted = true;
|
|
25
47
|
const startX = (event as MouseEvent).clientX;
|
|
26
48
|
const startWidth = layoutState.width;
|
|
27
49
|
|