@velocity-astro/cms-ui 0.1.0-beta.3 → 0.1.0-beta.5
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/component-registry.json +10 -1
- package/dist/components/Spotlight/Spotlight.d.ts +16 -0
- package/dist/components/Spotlight/Spotlight.d.ts.map +1 -0
- package/dist/components/Spotlight/Spotlight.js +28 -0
- package/dist/components/Spotlight/Spotlight.js.map +1 -0
- package/dist/components/Spotlight/Spotlight.variants.d.ts +4 -0
- package/dist/components/Spotlight/Spotlight.variants.d.ts.map +1 -0
- package/dist/components/Spotlight/Spotlight.variants.js +11 -0
- package/dist/components/Spotlight/Spotlight.variants.js.map +1 -0
- package/dist/components/Spotlight/index.d.ts +2 -0
- package/dist/components/Spotlight/index.d.ts.map +1 -0
- package/dist/components/Spotlight/index.js +2 -0
- package/dist/components/Spotlight/index.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/patterns/PagePreview/PagePreview.d.ts +19 -4
- package/dist/patterns/PagePreview/PagePreview.d.ts.map +1 -1
- package/dist/patterns/PagePreview/PagePreview.js +34 -8
- package/dist/patterns/PagePreview/PagePreview.js.map +1 -1
- package/dist/patterns/PagePreview/PagePreview.variants.d.ts +4 -1
- package/dist/patterns/PagePreview/PagePreview.variants.d.ts.map +1 -1
- package/dist/patterns/PagePreview/PagePreview.variants.js +5 -1
- package/dist/patterns/PagePreview/PagePreview.variants.js.map +1 -1
- package/dist/patterns/SaveBar/SaveBar.d.ts +7 -2
- package/dist/patterns/SaveBar/SaveBar.d.ts.map +1 -1
- package/dist/patterns/SaveBar/SaveBar.js +4 -4
- package/dist/patterns/SaveBar/SaveBar.js.map +1 -1
- package/dist/patterns/SaveBar/SaveBar.variants.d.ts +4 -1
- package/dist/patterns/SaveBar/SaveBar.variants.d.ts.map +1 -1
- package/dist/patterns/SaveBar/SaveBar.variants.js +11 -1
- package/dist/patterns/SaveBar/SaveBar.variants.js.map +1 -1
- package/dist/patterns/Workbench/Workbench.d.ts +13 -3
- package/dist/patterns/Workbench/Workbench.d.ts.map +1 -1
- package/dist/patterns/Workbench/Workbench.js +13 -4
- package/dist/patterns/Workbench/Workbench.js.map +1 -1
- package/dist/patterns/Workbench/Workbench.variants.d.ts +18 -4
- package/dist/patterns/Workbench/Workbench.variants.d.ts.map +1 -1
- package/dist/patterns/Workbench/Workbench.variants.js +42 -4
- package/dist/patterns/Workbench/Workbench.variants.js.map +1 -1
- package/package.json +2 -1
- package/src/styles.css +5 -0
package/component-registry.json
CHANGED
|
@@ -224,7 +224,7 @@
|
|
|
224
224
|
"name": "Workbench",
|
|
225
225
|
"layer": "pattern",
|
|
226
226
|
"group": "Layout",
|
|
227
|
-
"description": "A form with what it makes shown large beside it and kept in view: the sections of a page, and the page.",
|
|
227
|
+
"description": "A form with what it makes shown large beside it and kept in view: the sections of a page, and the page. With view=\"whole\" the two take the whole window, the form a panel at the side that can be put away.",
|
|
228
228
|
"example": "<Workbench paneLabel=\"The page\" pane={<PagePreview … />}>…</Workbench>",
|
|
229
229
|
"useInstead": "Split for a form with a few settings beside it; Grid for things of equal weight.",
|
|
230
230
|
"uses": []
|
|
@@ -420,6 +420,15 @@
|
|
|
420
420
|
"example": "<DateField label=\"Listed on\" value={listedOn} onChange={setListedOn} />",
|
|
421
421
|
"uses": []
|
|
422
422
|
},
|
|
423
|
+
{
|
|
424
|
+
"name": "Spotlight",
|
|
425
|
+
"layer": "component",
|
|
426
|
+
"group": "Feedback",
|
|
427
|
+
"description": "Brings what it holds into view and marks it for a moment, when something elsewhere on the screen pointed at it.",
|
|
428
|
+
"example": "<Spotlight at={pressed?.at}>\n <TextField label=\"Title\" />\n</Spotlight>",
|
|
429
|
+
"useInstead": "SectionList's revealId for a row that opens; Toast for news.",
|
|
430
|
+
"uses": []
|
|
431
|
+
},
|
|
423
432
|
{
|
|
424
433
|
"name": "Fieldset",
|
|
425
434
|
"layer": "component",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface SpotlightProps {
|
|
3
|
+
/**
|
|
4
|
+
* Changes each time what is inside is pointed at from elsewhere on the screen, such as a count
|
|
5
|
+
* of the times. Left out, nothing happens.
|
|
6
|
+
*/
|
|
7
|
+
readonly at?: number | undefined;
|
|
8
|
+
/** What is pointed at: a field, usually. */
|
|
9
|
+
readonly children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Brings what it holds into view and marks it for a moment, when something elsewhere on the
|
|
13
|
+
* screen pointed at it. It moves no focus: the person is still where they were.
|
|
14
|
+
*/
|
|
15
|
+
export declare function Spotlight({ at, children }: SpotlightProps): import("react").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=Spotlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spotlight.d.ts","sourceRoot":"","sources":["../../../src/components/Spotlight/Spotlight.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMpE,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,cAAc,+BAoBzD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { spotlightVariants } from './Spotlight.variants.js';
|
|
4
|
+
/** How long what was pointed at stays marked, in milliseconds. */
|
|
5
|
+
const SHOWN_FOR = 1600;
|
|
6
|
+
/**
|
|
7
|
+
* Brings what it holds into view and marks it for a moment, when something elsewhere on the
|
|
8
|
+
* screen pointed at it. It moves no focus: the person is still where they were.
|
|
9
|
+
*/
|
|
10
|
+
export function Spotlight({ at, children }) {
|
|
11
|
+
const element = useRef(null);
|
|
12
|
+
const [isLit, setLit] = useState(false);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (at === undefined) {
|
|
15
|
+
// Something else is pointed at now.
|
|
16
|
+
setLit(false);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
// Not every browser-like place tests run in can scroll.
|
|
20
|
+
if (typeof element.current?.scrollIntoView === 'function')
|
|
21
|
+
element.current.scrollIntoView({ block: 'nearest' });
|
|
22
|
+
setLit(true);
|
|
23
|
+
const waiting = setTimeout(() => setLit(false), SHOWN_FOR);
|
|
24
|
+
return () => clearTimeout(waiting);
|
|
25
|
+
}, [at]);
|
|
26
|
+
return (_jsx("div", { ref: element, className: spotlightVariants({ lit: isLit }), ...(isLit && { 'data-lit': '' }), children: children }));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=Spotlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spotlight.js","sourceRoot":"","sources":["../../../src/components/Spotlight/Spotlight.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,kEAAkE;AAClE,MAAM,SAAS,GAAG,IAAI,CAAC;AAYvB;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAkB;IACxD,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;YACrB,oCAAoC;YACpC,MAAM,CAAC,KAAK,CAAC,CAAC;YACd,OAAO;QACT,CAAC;QACD,wDAAwD;QACxD,IAAI,OAAO,OAAO,CAAC,OAAO,EAAE,cAAc,KAAK,UAAU;YAAE,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAChH,MAAM,CAAC,IAAI,CAAC,CAAC;QACb,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;QAC3D,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACT,OAAO,CACL,cAAK,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,KAAM,CAAC,KAAK,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,YAC/F,QAAQ,GACL,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spotlight.variants.d.ts","sourceRoot":"","sources":["../../../src/components/Spotlight/Spotlight.variants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB;;8EAQ5B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
export const spotlightVariants = cva('min-w-0 rounded-md ring-offset-4 ring-offset-background transition-shadow motion-base', {
|
|
3
|
+
variants: {
|
|
4
|
+
lit: {
|
|
5
|
+
true: 'ring-2 ring-ring',
|
|
6
|
+
false: 'ring-0 ring-transparent',
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
defaultVariants: { lit: false },
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=Spotlight.variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spotlight.variants.js","sourceRoot":"","sources":["../../../src/components/Spotlight/Spotlight.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC,uFAAuF,EAAE;IAC5H,QAAQ,EAAE;QACR,GAAG,EAAE;YACH,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,yBAAyB;SACjC;KACF;IACD,eAAe,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE;CAChC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Spotlight/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Spotlight/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuB,MAAM,gBAAgB,CAAC"}
|
|
@@ -20,6 +20,7 @@ export * from './Segmented/index.js';
|
|
|
20
20
|
export * from './Select/index.js';
|
|
21
21
|
export * from './Skeleton/index.js';
|
|
22
22
|
export * from './Spinner/index.js';
|
|
23
|
+
export * from './Spotlight/index.js';
|
|
23
24
|
export * from './Stack/index.js';
|
|
24
25
|
export * from './Stat/index.js';
|
|
25
26
|
export * from './Switch/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAA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AAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export * from './Segmented/index.js';
|
|
|
20
20
|
export * from './Select/index.js';
|
|
21
21
|
export * from './Skeleton/index.js';
|
|
22
22
|
export * from './Spinner/index.js';
|
|
23
|
+
export * from './Spotlight/index.js';
|
|
23
24
|
export * from './Stack/index.js';
|
|
24
25
|
export * from './Stat/index.js';
|
|
25
26
|
export * from './Switch/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
|
@@ -16,14 +16,29 @@ export interface PagePreviewProps extends PagePreviewVariants {
|
|
|
16
16
|
readonly toolbar?: ReactNode;
|
|
17
17
|
/** Shown in place of the page when there is no `address`. */
|
|
18
18
|
readonly emptyText: string;
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Called with a section's id when it is pressed on the page, and with the field that was
|
|
21
|
+
* pressed, as keys (`title`, `items.0.text`), where the page marks its fields.
|
|
22
|
+
*/
|
|
23
|
+
readonly onSectionPress?: (id: string, field?: string) => void;
|
|
24
|
+
/** The section the page should have in view, and outlined. */
|
|
22
25
|
readonly shownSectionId?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Where words may be typed on the page itself: for each section's id, the fields of it, as keys
|
|
28
|
+
* (`title`, `items.0.text`). Left out, the page is only looked at and pressed.
|
|
29
|
+
*/
|
|
30
|
+
readonly typable?: Readonly<Record<string, readonly string[]>>;
|
|
31
|
+
/**
|
|
32
|
+
* Called as words are typed into a field on the page, with all the field now says. The page
|
|
33
|
+
* already shows them, so the change of `draft` that follows asks for no new page.
|
|
34
|
+
*/
|
|
35
|
+
readonly onWords?: (id: string, field: string, words: string) => void;
|
|
36
|
+
/** No border of its own, for a place that frames it already, such as a whole window. */
|
|
37
|
+
readonly isBare?: boolean;
|
|
23
38
|
}
|
|
24
39
|
/**
|
|
25
40
|
* A page of the site as it would look with what is in a form now, in a frame. The page is drawn
|
|
26
41
|
* by the site itself, so it looks exactly as it will; nothing of it is drawn here.
|
|
27
42
|
*/
|
|
28
|
-
export declare function PagePreview({ label, address, draft, note, toolbar, emptyText, onSectionPress, shownSectionId, width }: PagePreviewProps): import("react").JSX.Element;
|
|
43
|
+
export declare function PagePreview({ label, address, draft, note, toolbar, emptyText, onSectionPress, shownSectionId, typable, onWords, isBare, width }: PagePreviewProps): import("react").JSX.Element;
|
|
29
44
|
//# sourceMappingURL=PagePreview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PagePreview.d.ts","sourceRoot":"","sources":["../../../src/patterns/PagePreview/PagePreview.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAOL,KAAK,mBAAmB,EACzB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"PagePreview.d.ts","sourceRoot":"","sources":["../../../src/patterns/PagePreview/PagePreview.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAOL,KAAK,mBAAmB,EACzB,MAAM,2BAA2B,CAAC;AAiBnC,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB;IAC3D,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,kFAAkF;IAClF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,6DAA6D;IAC7D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,8DAA8D;IAC9D,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IAC/D;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,wFAAwF;IACxF,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,MAAc,EAAE,KAAK,EAAE,EAAE,gBAAgB,+BA6FzK"}
|
|
@@ -1,36 +1,47 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useId, useRef } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
|
-
import { pagePreviewBarClass,
|
|
4
|
+
import { pagePreviewBarClass, pagePreviewVariants, pagePreviewEmptyClass, pagePreviewFrameVariants, pagePreviewNoteClass, pagePreviewStageClass, } from './PagePreview.variants.js';
|
|
5
5
|
/** How long the page waits after the last change before it is drawn again, in milliseconds. */
|
|
6
6
|
const PAUSE = 500;
|
|
7
7
|
/** The name both sides put on what they say to each other, so nothing else is taken for it. */
|
|
8
8
|
const SOURCE = 'velocity-cms';
|
|
9
|
+
/** How long after words were typed on the page a change of the draft is taken to be those words, in milliseconds. */
|
|
10
|
+
const OWN = 250;
|
|
9
11
|
/**
|
|
10
12
|
* A page of the site as it would look with what is in a form now, in a frame. The page is drawn
|
|
11
13
|
* by the site itself, so it looks exactly as it will; nothing of it is drawn here.
|
|
12
14
|
*/
|
|
13
|
-
export function PagePreview({ label, address, draft, note, toolbar, emptyText, onSectionPress, shownSectionId, width }) {
|
|
15
|
+
export function PagePreview({ label, address, draft, note, toolbar, emptyText, onSectionPress, shownSectionId, typable, onWords, isBare = false, width }) {
|
|
14
16
|
const name = `preview-${useId().replaceAll(':', '')}`;
|
|
15
17
|
const form = useRef(null);
|
|
16
18
|
const frame = useRef(null);
|
|
17
19
|
const hasSent = useRef(false);
|
|
18
|
-
const
|
|
20
|
+
const places = typable === undefined ? undefined : JSON.stringify(typable);
|
|
21
|
+
const latest = useRef({ onSectionPress, shownSectionId, onWords, places });
|
|
19
22
|
useEffect(() => {
|
|
20
|
-
latest.current = { onSectionPress, shownSectionId };
|
|
23
|
+
latest.current = { onSectionPress, shownSectionId, onWords, places };
|
|
21
24
|
});
|
|
25
|
+
// When words were last typed on the page, and whether the page lacks a change made in the form.
|
|
26
|
+
const typedAt = useRef(0);
|
|
27
|
+
const isBehind = useRef(false);
|
|
22
28
|
// The first page is asked for at once. After that, a pause in the typing asks for the next.
|
|
23
29
|
useEffect(() => {
|
|
24
30
|
if (address === undefined)
|
|
25
31
|
return;
|
|
26
32
|
const send = () => {
|
|
27
33
|
hasSent.current = true;
|
|
34
|
+
isBehind.current = false;
|
|
28
35
|
form.current?.submit();
|
|
29
36
|
};
|
|
30
37
|
if (!hasSent.current) {
|
|
31
38
|
send();
|
|
32
39
|
return;
|
|
33
40
|
}
|
|
41
|
+
// Words typed on the page are on the page already: drawing it again would take the caret away.
|
|
42
|
+
if (Date.now() - typedAt.current < OWN && !isBehind.current)
|
|
43
|
+
return;
|
|
44
|
+
isBehind.current = true;
|
|
34
45
|
const waiting = setTimeout(send, PAUSE);
|
|
35
46
|
return () => clearTimeout(waiting);
|
|
36
47
|
}, [address, draft]);
|
|
@@ -38,6 +49,10 @@ export function PagePreview({ label, address, draft, note, toolbar, emptyText, o
|
|
|
38
49
|
if (id !== undefined)
|
|
39
50
|
frame.current?.contentWindow?.postMessage({ source: SOURCE, type: 'show', id }, window.location.origin);
|
|
40
51
|
};
|
|
52
|
+
const tell = (said) => {
|
|
53
|
+
if (said !== undefined)
|
|
54
|
+
frame.current?.contentWindow?.postMessage({ source: SOURCE, type: 'typable', places: JSON.parse(said) }, window.location.origin);
|
|
55
|
+
};
|
|
41
56
|
// Only this site's own page, in this frame, is listened to.
|
|
42
57
|
useEffect(() => {
|
|
43
58
|
const hear = (event) => {
|
|
@@ -46,15 +61,26 @@ export function PagePreview({ label, address, draft, note, toolbar, emptyText, o
|
|
|
46
61
|
const said = event.data;
|
|
47
62
|
if (said?.source !== SOURCE)
|
|
48
63
|
return;
|
|
49
|
-
if (said.type === 'section' && typeof said.id === 'string')
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
if (said.type === 'section' && typeof said.id === 'string') {
|
|
65
|
+
if (typeof said.field === 'string')
|
|
66
|
+
latest.current.onSectionPress?.(said.id, said.field);
|
|
67
|
+
else
|
|
68
|
+
latest.current.onSectionPress?.(said.id);
|
|
69
|
+
}
|
|
70
|
+
if (said.type === 'words' && typeof said.id === 'string' && typeof said.field === 'string' && typeof said.words === 'string') {
|
|
71
|
+
typedAt.current = Date.now();
|
|
72
|
+
latest.current.onWords?.(said.id, said.field, said.words);
|
|
73
|
+
}
|
|
74
|
+
if (said.type === 'ready') {
|
|
75
|
+
tell(latest.current.places);
|
|
52
76
|
show(latest.current.shownSectionId);
|
|
77
|
+
}
|
|
53
78
|
};
|
|
54
79
|
window.addEventListener('message', hear);
|
|
55
80
|
return () => window.removeEventListener('message', hear);
|
|
56
81
|
}, []);
|
|
57
82
|
useEffect(() => show(shownSectionId), [shownSectionId]);
|
|
58
|
-
|
|
83
|
+
useEffect(() => tell(places), [places]);
|
|
84
|
+
return (_jsxs("div", { className: pagePreviewVariants({ isBare }), children: [(note !== undefined || toolbar !== undefined) && (_jsxs("div", { className: pagePreviewBarClass, children: [_jsx("span", { className: pagePreviewNoteClass, children: note }), toolbar] })), _jsx("div", { className: pagePreviewStageClass, children: address === undefined ? (_jsx("p", { className: pagePreviewEmptyClass, children: emptyText })) : (_jsxs(_Fragment, { children: [createPortal(_jsx("form", { ref: form, method: "post", action: address, target: name, hidden: true, children: _jsx("input", { type: "hidden", name: "draft", value: draft, readOnly: true }) }), document.body), _jsx("iframe", { ref: frame, name: name, title: label, className: pagePreviewFrameVariants({ width }) })] })) })] }));
|
|
59
85
|
}
|
|
60
86
|
//# sourceMappingURL=PagePreview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PagePreview.js","sourceRoot":"","sources":["../../../src/patterns/PagePreview/PagePreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"PagePreview.js","sourceRoot":"","sources":["../../../src/patterns/PagePreview/PagePreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,GAEtB,MAAM,2BAA2B,CAAC;AAEnC,+FAA+F;AAC/F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-1,5 +1,8 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
-
|
|
2
|
+
/** In a card of its own, or bare where what holds it is the frame already. */
|
|
3
|
+
export declare const pagePreviewVariants: (props?: ({
|
|
4
|
+
isBare?: boolean | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
3
6
|
export declare const pagePreviewBarClass = "flex flex-wrap items-center justify-between gap-3 border-b border-border bg-background px-3 py-2";
|
|
4
7
|
export declare const pagePreviewNoteClass = "min-w-0 truncate text-sm text-foreground-muted";
|
|
5
8
|
export declare const pagePreviewStageClass = "flex min-h-0 flex-1 justify-center";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PagePreview.variants.d.ts","sourceRoot":"","sources":["../../../src/patterns/PagePreview/PagePreview.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"PagePreview.variants.d.ts","sourceRoot":"","sources":["../../../src/patterns/PagePreview/PagePreview.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB;;8EAG9B,CAAC;AACH,eAAO,MAAM,mBAAmB,qGAAqG,CAAC;AACtI,eAAO,MAAM,oBAAoB,mDAAmD,CAAC;AACrF,eAAO,MAAM,qBAAqB,uCAAuC,CAAC;AAC1E,eAAO,MAAM,qBAAqB,mEAAmE,CAAC;AAEtG,kIAAkI;AAClI,eAAO,MAAM,wBAAwB;;8EASnC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { cva } from 'class-variance-authority';
|
|
2
|
-
|
|
2
|
+
/** In a card of its own, or bare where what holds it is the frame already. */
|
|
3
|
+
export const pagePreviewVariants = cva('flex h-full min-h-0 flex-col overflow-hidden bg-background-secondary', {
|
|
4
|
+
variants: { isBare: { true: '', false: 'rounded-lg border border-border' } },
|
|
5
|
+
defaultVariants: { isBare: false },
|
|
6
|
+
});
|
|
3
7
|
export const pagePreviewBarClass = 'flex flex-wrap items-center justify-between gap-3 border-b border-border bg-background px-3 py-2';
|
|
4
8
|
export const pagePreviewNoteClass = 'min-w-0 truncate text-sm text-foreground-muted';
|
|
5
9
|
export const pagePreviewStageClass = 'flex min-h-0 flex-1 justify-center';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PagePreview.variants.js","sourceRoot":"","sources":["../../../src/patterns/PagePreview/PagePreview.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"PagePreview.variants.js","sourceRoot":"","sources":["../../../src/patterns/PagePreview/PagePreview.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC,sEAAsE,EAAE;IAC7G,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,iCAAiC,EAAE,EAAE;IAC5E,eAAe,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;CACnC,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,kGAAkG,CAAC;AACtI,MAAM,CAAC,MAAM,oBAAoB,GAAG,gDAAgD,CAAC;AACrF,MAAM,CAAC,MAAM,qBAAqB,GAAG,oCAAoC,CAAC;AAC1E,MAAM,CAAC,MAAM,qBAAqB,GAAG,gEAAgE,CAAC;AAEtG,kIAAkI;AAClI,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC,wDAAwD,EAAE;IACpG,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,KAAK,EAAE,iCAAiC;YACxC,MAAM,EAAE,kCAAkC;YAC1C,IAAI,EAAE,EAAE;SACT;KACF;IACD,eAAe,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;CACnC,CAAC,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
export interface SaveBarBack {
|
|
3
|
-
|
|
3
|
+
/** Where it goes. Left out, `onPress` says what going back does. */
|
|
4
|
+
readonly href?: string;
|
|
5
|
+
/** What going back does, where it is not another address: closing a view that took the window. */
|
|
6
|
+
readonly onPress?: () => void;
|
|
4
7
|
/** Where it goes, such as "Listings". */
|
|
5
8
|
readonly label: string;
|
|
6
9
|
}
|
|
@@ -15,7 +18,9 @@ export interface SaveBarProps {
|
|
|
15
18
|
readonly status: ReactNode;
|
|
16
19
|
/** The buttons, main action last. */
|
|
17
20
|
readonly actions: ReactNode;
|
|
21
|
+
/** `window` for a bar across a whole window, in place of one at the top of a screen. */
|
|
22
|
+
readonly across?: 'screen' | 'window';
|
|
18
23
|
}
|
|
19
24
|
/** The bar that stays at the top of an editing screen: the way back, what is being edited, its state and its save buttons. */
|
|
20
|
-
export declare function SaveBar({ label, back, title, status, actions }: SaveBarProps): import("react").JSX.Element;
|
|
25
|
+
export declare function SaveBar({ label, back, title, status, actions, across }: SaveBarProps): import("react").JSX.Element;
|
|
21
26
|
//# sourceMappingURL=SaveBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveBar.d.ts","sourceRoot":"","sources":["../../../src/patterns/SaveBar/SaveBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"SaveBar.d.ts","sourceRoot":"","sources":["../../../src/patterns/SaveBar/SaveBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvC,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,kGAAkG;IAClG,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,yCAAyC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qDAAqD;IACrD,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,sFAAsF;IACtF,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,wFAAwF;IACxF,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACvC;AAED,8HAA8H;AAC9H,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAiB,EAAE,EAAE,YAAY,+BAwB/F"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ChevronLeft } from 'lucide-react';
|
|
3
|
-
import { Link } from 'react-aria-components';
|
|
4
|
-
import { saveBarActionsClass, saveBarBackClass, saveBarBackIconSize,
|
|
3
|
+
import { Button, Link } from 'react-aria-components';
|
|
4
|
+
import { saveBarActionsClass, saveBarBackClass, saveBarBackIconSize, saveBarHeadingClass, saveBarStatusClass, saveBarTitleClass, saveBarVariants, } from './SaveBar.variants.js';
|
|
5
5
|
/** The bar that stays at the top of an editing screen: the way back, what is being edited, its state and its save buttons. */
|
|
6
|
-
export function SaveBar({ label, back, title, status, actions }) {
|
|
7
|
-
return (_jsxs("div", { role: "region", "aria-label": label, className:
|
|
6
|
+
export function SaveBar({ label, back, title, status, actions, across = 'screen' }) {
|
|
7
|
+
return (_jsxs("div", { role: "region", "aria-label": label, className: saveBarVariants({ across }), children: [back?.href !== undefined && (_jsxs(Link, { href: back.href, className: saveBarBackClass, children: [_jsx(ChevronLeft, { "aria-hidden": true, size: saveBarBackIconSize }), back.label] })), back !== undefined && back.href === undefined && (_jsxs(Button, { className: saveBarBackClass, ...(back.onPress && { onPress: back.onPress }), children: [_jsx(ChevronLeft, { "aria-hidden": true, size: saveBarBackIconSize }), back.label] })), _jsxs("div", { className: saveBarHeadingClass, children: [title !== undefined && _jsx("h1", { className: saveBarTitleClass, children: title }), _jsx("div", { className: saveBarStatusClass, "aria-live": "polite", children: status })] }), _jsx("div", { className: saveBarActionsClass, children: actions })] }));
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=SaveBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveBar.js","sourceRoot":"","sources":["../../../src/patterns/SaveBar/SaveBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"SaveBar.js","sourceRoot":"","sources":["../../../src/patterns/SaveBar/SaveBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AA0B/B,8HAA8H;AAC9H,MAAM,UAAU,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,EAAgB;IAC9F,OAAO,CACL,eAAK,IAAI,EAAC,QAAQ,gBAAa,KAAK,EAAE,SAAS,EAAE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC,aACzE,IAAI,EAAE,IAAI,KAAK,SAAS,IAAI,CAC3B,MAAC,IAAI,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,gBAAgB,aAChD,KAAC,WAAW,yBAAa,IAAI,EAAE,mBAAmB,GAAI,EACrD,IAAI,CAAC,KAAK,IACN,CACR,EACA,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,CAChD,MAAC,MAAM,IAAC,SAAS,EAAE,gBAAgB,KAAM,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,aAClF,KAAC,WAAW,yBAAa,IAAI,EAAE,mBAAmB,GAAI,EACrD,IAAI,CAAC,KAAK,IACJ,CACV,EACD,eAAK,SAAS,EAAE,mBAAmB,aAChC,KAAK,KAAK,SAAS,IAAI,aAAI,SAAS,EAAE,iBAAiB,YAAG,KAAK,GAAM,EACtE,cAAK,SAAS,EAAE,kBAAkB,eAAY,QAAQ,YACnD,MAAM,GACH,IACF,EACN,cAAK,SAAS,EAAE,mBAAmB,YAAG,OAAO,GAAO,IAChD,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/** On a screen the bar stays at the top of the screen's panel. Across a whole window it is the window's top edge. */
|
|
2
|
+
export declare const saveBarVariants: (props?: ({
|
|
3
|
+
across?: "screen" | "window" | null | undefined;
|
|
4
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
2
5
|
export declare const saveBarBackClass: string;
|
|
3
6
|
export declare const saveBarHeadingClass = "flex min-w-0 flex-1 flex-col gap-0.5";
|
|
4
7
|
export declare const saveBarTitleClass = "truncate text-lg font-semibold text-foreground";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveBar.variants.d.ts","sourceRoot":"","sources":["../../../src/patterns/SaveBar/SaveBar.variants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SaveBar.variants.d.ts","sourceRoot":"","sources":["../../../src/patterns/SaveBar/SaveBar.variants.ts"],"names":[],"mappings":"AAEA,qHAAqH;AACrH,eAAO,MAAM,eAAe;;8EAQ1B,CAAC;AAEH,eAAO,MAAM,gBAAgB,QAIlB,CAAC;AAEZ,eAAO,MAAM,mBAAmB,yCAAyC,CAAC;AAC1E,eAAO,MAAM,iBAAiB,mDAAmD,CAAC;AAClF,eAAO,MAAM,kBAAkB,oCAAoC,CAAC;AACpE,eAAO,MAAM,mBAAmB,qCAAqC,CAAC;AAEtE,wDAAwD;AACxD,eAAO,MAAM,mBAAmB,KAAK,CAAC"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
/** On a screen the bar stays at the top of the screen's panel. Across a whole window it is the window's top edge. */
|
|
3
|
+
export const saveBarVariants = cva('flex flex-wrap items-center gap-4 border-b border-border bg-background py-3', {
|
|
4
|
+
variants: {
|
|
5
|
+
across: {
|
|
6
|
+
screen: 'sticky top-0 layer-sticky rounded-t-2xl px-6',
|
|
7
|
+
window: 'shrink-0 px-4',
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
defaultVariants: { across: 'screen' },
|
|
11
|
+
});
|
|
2
12
|
export const saveBarBackClass = [
|
|
3
13
|
'inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border-strong bg-background pr-3 pl-2 text-sm font-medium text-foreground',
|
|
4
14
|
'transition-colors motion-fast',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveBar.variants.js","sourceRoot":"","sources":["../../../src/patterns/SaveBar/SaveBar.variants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"SaveBar.variants.js","sourceRoot":"","sources":["../../../src/patterns/SaveBar/SaveBar.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE/C,qHAAqH;AACrH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC,6EAA6E,EAAE;IAChH,QAAQ,EAAE;QACR,MAAM,EAAE;YACN,MAAM,EAAE,8CAA8C;YACtD,MAAM,EAAE,eAAe;SACxB;KACF;IACD,eAAe,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;CACtC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,kJAAkJ;IAClJ,+BAA+B;IAC/B,0GAA0G;CAC3G,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,CAAC,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AAC1E,MAAM,CAAC,MAAM,iBAAiB,GAAG,gDAAgD,CAAC;AAClF,MAAM,CAAC,MAAM,kBAAkB,GAAG,iCAAiC,CAAC;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,kCAAkC,CAAC;AAEtE,wDAAwD;AACxD,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC"}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
import { type WorkbenchVariants } from './Workbench.variants.js';
|
|
3
|
+
export interface WorkbenchProps extends WorkbenchVariants {
|
|
3
4
|
/** Names the pane for screen readers, such as "The page". */
|
|
4
5
|
readonly paneLabel: string;
|
|
5
6
|
/** What is worked on: the form, in a column of its own. */
|
|
6
7
|
readonly children: ReactNode;
|
|
7
8
|
/** What the work makes, shown large beside it and kept in view: the page. */
|
|
8
9
|
readonly pane: ReactNode;
|
|
10
|
+
/** Across the top when the workbench has the whole window: what is edited, the way back and the save buttons. */
|
|
11
|
+
readonly bar?: ReactNode;
|
|
12
|
+
/** With the whole window, whether the form is put away at the side so the pane has it all. */
|
|
13
|
+
readonly isFormAway?: boolean;
|
|
9
14
|
}
|
|
10
|
-
/**
|
|
11
|
-
|
|
15
|
+
/**
|
|
16
|
+
* A form with what it makes shown large beside it. On a narrow screen the pane follows below.
|
|
17
|
+
* With `view="whole"` the two take the whole window, over the editor's frame, and the form is a
|
|
18
|
+
* panel at the side that can be put away. Going from one view to the other keeps both as they
|
|
19
|
+
* are: nothing typed is lost and the pane is not made again.
|
|
20
|
+
*/
|
|
21
|
+
export declare function Workbench({ paneLabel, children, pane, bar, isFormAway, view }: WorkbenchProps): import("react").JSX.Element;
|
|
12
22
|
//# sourceMappingURL=Workbench.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Workbench.d.ts","sourceRoot":"","sources":["../../../src/patterns/Workbench/Workbench.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Workbench.d.ts","sourceRoot":"","sources":["../../../src/patterns/Workbench/Workbench.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAA0F,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEzJ,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,6DAA6D;IAC7D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,iHAAiH;IACjH,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC;IACzB,8FAA8F;IAC9F,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,UAAkB,EAAE,IAAe,EAAE,EAAE,cAAc,+BAgBhH"}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { FocusScope } from 'react-aria';
|
|
3
|
+
import { workbenchBodyVariants, workbenchFormVariants, workbenchPaneVariants, workbenchVariants } from './Workbench.variants.js';
|
|
4
|
+
/**
|
|
5
|
+
* A form with what it makes shown large beside it. On a narrow screen the pane follows below.
|
|
6
|
+
* With `view="whole"` the two take the whole window, over the editor's frame, and the form is a
|
|
7
|
+
* panel at the side that can be put away. Going from one view to the other keeps both as they
|
|
8
|
+
* are: nothing typed is lost and the pane is not made again.
|
|
9
|
+
*/
|
|
10
|
+
export function Workbench({ paneLabel, children, pane, bar, isFormAway = false, view = 'beside' }) {
|
|
11
|
+
const isWhole = view === 'whole';
|
|
12
|
+
return (
|
|
13
|
+
// With the whole window, the keyboard stays in it: what is behind cannot be seen.
|
|
14
|
+
_jsx(FocusScope, { contain: isWhole, children: _jsxs("div", { className: workbenchVariants({ view }), children: [isWhole && bar, _jsxs("div", { className: workbenchBodyVariants({ view }), children: [_jsx("div", { className: workbenchFormVariants({ view, isAway: isWhole && isFormAway }), children: children }), _jsx("section", { "aria-label": paneLabel, className: workbenchPaneVariants({ view }), children: pane })] })] }) }));
|
|
6
15
|
}
|
|
7
16
|
//# sourceMappingURL=Workbench.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Workbench.js","sourceRoot":"","sources":["../../../src/patterns/Workbench/Workbench.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Workbench.js","sourceRoot":"","sources":["../../../src/patterns/Workbench/Workbench.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,iBAAiB,EAA0B,MAAM,yBAAyB,CAAC;AAezJ;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,GAAG,KAAK,EAAE,IAAI,GAAG,QAAQ,EAAkB;IAC/G,MAAM,OAAO,GAAG,IAAI,KAAK,OAAO,CAAC;IACjC,OAAO;IACL,kFAAkF;IAClF,KAAC,UAAU,IAAC,OAAO,EAAE,OAAO,YAC1B,eAAK,SAAS,EAAE,iBAAiB,CAAC,EAAE,IAAI,EAAE,CAAC,aACxC,OAAO,IAAI,GAAG,EACf,eAAK,SAAS,EAAE,qBAAqB,CAAC,EAAE,IAAI,EAAE,CAAC,aAC7C,cAAK,SAAS,EAAE,qBAAqB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,IAAI,UAAU,EAAE,CAAC,YAAG,QAAQ,GAAO,EAChG,gCAAqB,SAAS,EAAE,SAAS,EAAE,qBAAqB,CAAC,EAAE,IAAI,EAAE,CAAC,YACvE,IAAI,GACG,IACN,IACF,GACK,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
/** Beside the form, the workbench is part of the screen. Whole, it covers the window, over the frame of the editor. */
|
|
3
|
+
export declare const workbenchVariants: (props?: ({
|
|
4
|
+
view?: "beside" | "whole" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
1
6
|
/** One column on a narrow screen; from `xl` up, the form in a column of its own width and the pane taking the rest. */
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
export declare const workbenchBodyVariants: (props?: ({
|
|
8
|
+
view?: "beside" | "whole" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
/** Whole, the form is a panel at the side that scrolls by itself, and slides away to leave the pane the window. */
|
|
11
|
+
export declare const workbenchFormVariants: (props?: ({
|
|
12
|
+
view?: "beside" | "whole" | null | undefined;
|
|
13
|
+
isAway?: boolean | null | undefined;
|
|
14
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
|
+
/** Beside the form, the pane stays in view while the form scrolls under the bar at the top. */
|
|
16
|
+
export declare const workbenchPaneVariants: (props?: ({
|
|
17
|
+
view?: "beside" | "whole" | null | undefined;
|
|
18
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
19
|
+
export type WorkbenchVariants = VariantProps<typeof workbenchVariants>;
|
|
6
20
|
//# sourceMappingURL=Workbench.variants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Workbench.variants.d.ts","sourceRoot":"","sources":["../../../src/patterns/Workbench/Workbench.variants.ts"],"names":[],"mappings":"AAAA,uHAAuH;AACvH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"Workbench.variants.d.ts","sourceRoot":"","sources":["../../../src/patterns/Workbench/Workbench.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,uHAAuH;AACvH,eAAO,MAAM,iBAAiB;;8EAQ5B,CAAC;AAEH,uHAAuH;AACvH,eAAO,MAAM,qBAAqB;;8EAQhC,CAAC;AAEH,mHAAmH;AACnH,eAAO,MAAM,qBAAqB;;;8EAUhC,CAAC;AAEH,+FAA+F;AAC/F,eAAO,MAAM,qBAAqB;;8EAQhC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -1,6 +1,44 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
/** Beside the form, the workbench is part of the screen. Whole, it covers the window, over the frame of the editor. */
|
|
3
|
+
export const workbenchVariants = cva('', {
|
|
4
|
+
variants: {
|
|
5
|
+
view: {
|
|
6
|
+
beside: 'w-full',
|
|
7
|
+
whole: 'fixed inset-0 layer-overlay flex flex-col bg-background-secondary',
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
defaultVariants: { view: 'beside' },
|
|
11
|
+
});
|
|
1
12
|
/** One column on a narrow screen; from `xl` up, the form in a column of its own width and the pane taking the rest. */
|
|
2
|
-
export const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
13
|
+
export const workbenchBodyVariants = cva('flex', {
|
|
14
|
+
variants: {
|
|
15
|
+
view: {
|
|
16
|
+
beside: 'w-full flex-col gap-6 xl:flex-row xl:items-start',
|
|
17
|
+
whole: 'min-h-0 flex-1',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: { view: 'beside' },
|
|
21
|
+
});
|
|
22
|
+
/** Whole, the form is a panel at the side that scrolls by itself, and slides away to leave the pane the window. */
|
|
23
|
+
export const workbenchFormVariants = cva('flex min-w-0 flex-col gap-6', {
|
|
24
|
+
variants: {
|
|
25
|
+
view: {
|
|
26
|
+
beside: 'xl:w-lg xl:shrink-0',
|
|
27
|
+
whole: 'w-lg max-w-full shrink-0 overflow-auto border-r border-border bg-background p-4 transition-all motion-slide',
|
|
28
|
+
},
|
|
29
|
+
isAway: { true: '', false: '' },
|
|
30
|
+
},
|
|
31
|
+
compoundVariants: [{ view: 'whole', isAway: true, class: '-ml-128 invisible' }],
|
|
32
|
+
defaultVariants: { view: 'beside', isAway: false },
|
|
33
|
+
});
|
|
34
|
+
/** Beside the form, the pane stays in view while the form scrolls under the bar at the top. */
|
|
35
|
+
export const workbenchPaneVariants = cva('min-w-0', {
|
|
36
|
+
variants: {
|
|
37
|
+
view: {
|
|
38
|
+
beside: 'pane-tall xl:sticky xl:top-24 xl:flex-1',
|
|
39
|
+
whole: 'min-h-0 flex-1',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: { view: 'beside' },
|
|
43
|
+
});
|
|
6
44
|
//# sourceMappingURL=Workbench.variants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Workbench.variants.js","sourceRoot":"","sources":["../../../src/patterns/Workbench/Workbench.variants.ts"],"names":[],"mappings":"AAAA,uHAAuH;AACvH,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"Workbench.variants.js","sourceRoot":"","sources":["../../../src/patterns/Workbench/Workbench.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAElE,uHAAuH;AACvH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC,EAAE,EAAE;IACvC,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,mEAAmE;SAC3E;KACF;IACD,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;CACpC,CAAC,CAAC;AAEH,uHAAuH;AACvH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC,MAAM,EAAE;IAC/C,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,MAAM,EAAE,kDAAkD;YAC1D,KAAK,EAAE,gBAAgB;SACxB;KACF;IACD,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;CACpC,CAAC,CAAC;AAEH,mHAAmH;AACnH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC,6BAA6B,EAAE;IACtE,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,MAAM,EAAE,qBAAqB;YAC7B,KAAK,EAAE,6GAA6G;SACrH;QACD,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;KAChC;IACD,gBAAgB,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC/E,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE;CACnD,CAAC,CAAC;AAEH,+FAA+F;AAC/F,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC,SAAS,EAAE;IAClD,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,MAAM,EAAE,yCAAyC;YACjD,KAAK,EAAE,gBAAgB;SACxB;KACF;IACD,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;CACpC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velocity-astro/cms-ui",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.5",
|
|
4
4
|
"description": "The Velocity CMS editor's design system: tokens, components and patterns. Knows nothing about content or the API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"@tiptap/starter-kit": "^3.34.0",
|
|
51
51
|
"class-variance-authority": "^0.7.1",
|
|
52
52
|
"lucide-react": "^1.74.0",
|
|
53
|
+
"react-aria": "^3.53.1",
|
|
53
54
|
"react-aria-components": "^1.22.1"
|
|
54
55
|
},
|
|
55
56
|
"peerDependencies": {
|
package/src/styles.css
CHANGED
|
@@ -117,6 +117,11 @@
|
|
|
117
117
|
transition-duration: var(--motion-base);
|
|
118
118
|
transition-timing-function: var(--motion-ease);
|
|
119
119
|
}
|
|
120
|
+
/* A panel that is part of the layout and makes room or takes it: the form beside a page. */
|
|
121
|
+
@utility motion-slide {
|
|
122
|
+
transition-duration: var(--motion-slow);
|
|
123
|
+
transition-timing-function: var(--motion-ease);
|
|
124
|
+
}
|
|
120
125
|
/*
|
|
121
126
|
* How things arrive and leave. React Aria marks a part `data-entering` while it opens and
|
|
122
127
|
* `data-exiting` while it closes, and waits for the animation before taking it away. Leaving is
|