@gemboss/ui 0.55.1 → 0.57.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 +412 -0
- package/README.md +16 -9
- package/catalog/editor.html +58 -34
- package/catalog/index.html +5 -5
- package/gemboss-ui.css +3 -3
- package/package.json +7 -1
- package/parts/components.css +2 -2
- package/parts/core.css +1 -1
- package/parts/shell.css +1 -1
- package/src/assistant/host.tsx +49 -2
- package/src/assistant/provider.tsx +18 -7
- package/src/assistant-chat.css +1 -1
- package/src/assistant-plain.js +1 -1
- package/src/assistant.css +1 -1
- package/src/chat.css +1 -1
- package/src/collections.css +1 -1
- package/src/collections.tsx +21 -4
- package/src/create-shell.css +1 -1
- package/src/create-shell.tsx +24 -9
- package/src/editor/chips.tsx +24 -0
- package/src/editor/color-picker.tsx +8 -4
- package/src/editor/controls.tsx +404 -58
- package/src/editor/index.ts +7 -3
- package/src/editor/layers.tsx +1 -1
- package/src/editor/new-value.ts +27 -0
- package/src/editor/panel.tsx +22 -9
- package/src/editor/repeater.tsx +66 -29
- package/src/editor/swatch.ts +7 -0
- package/src/editor/tiles.tsx +5 -3
- package/src/editor-chips.css +1 -0
- package/src/editor-color.css +1 -1
- package/src/editor-plain.js +1 -1
- package/src/editor-rail.css +1 -0
- package/src/editor-repeater.css +1 -1
- package/src/editor-tiles.css +1 -1
- package/src/editor.css +1 -1
- package/src/gem-holo.css +1 -0
- package/src/gem-holo.tsx +31 -0
- package/src/gemboss-field.css +1 -1
- package/src/gems.css +1 -0
- package/src/index-table.tsx +1 -1
- package/src/index.ts +3 -1
- package/src/kit-plain.css +1 -1
- package/src/list-page.tsx +6 -3
- package/src/menu.tsx +3 -1
- package/src/page-tabs.tsx +14 -0
- package/src/pager-extras.css +1 -1
- package/src/screens-arriving.ts +65 -0
- package/src/segmented.tsx +28 -4
- package/src/stage.css +1 -1
- package/src/stage.tsx +11 -4
- package/src/starting-point.tsx +25 -9
- package/src/ui.css +1 -1
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import "../editor.css"; // the colour chips (.gemboss-ei-sw) are the editor's
|
|
16
16
|
import "../editor-color.css";
|
|
17
17
|
import React, { useEffect, useRef, useState } from "react";
|
|
18
|
+
import { useOnNewValue } from "./new-value";
|
|
18
19
|
import { Icon } from "../icons";
|
|
19
20
|
import { hexOf, opacityOf, parseColor, pickSwatch, withOpacity, type Rgba } from "./swatch";
|
|
20
21
|
import type { ColorChoice } from "./controls";
|
|
@@ -31,6 +32,9 @@ export interface ColorPickerProps {
|
|
|
31
32
|
choices?: readonly ColorChoice[];
|
|
32
33
|
/** A "None" chip that empties the field (Not set). */
|
|
33
34
|
allowNone?: boolean;
|
|
35
|
+
/** What that chip is called: the field's word for empty ("Theme", "Default", "No change"), so the chip and the box say one word
|
|
36
|
+
* for one state (Control UI C13). "None" without one. */
|
|
37
|
+
noneLabel?: string;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
type Hsv = { h: number; s: number; v: number };
|
|
@@ -49,7 +53,7 @@ function rgbOf({ h, s, v }: Hsv) {
|
|
|
49
53
|
return { r: (r + m) * 255, g: (g + m) * 255, b: (b + m) * 255 };
|
|
50
54
|
}
|
|
51
55
|
|
|
52
|
-
export function ColorPicker({ value, base, onChange, label, choices, allowNone = true }: ColorPickerProps) {
|
|
56
|
+
export function ColorPicker({ value, base, onChange, label, choices, allowNone = true, noneLabel = "None" }: ColorPickerProps) {
|
|
53
57
|
const from = base ?? value;
|
|
54
58
|
const parsed = parseColor(from);
|
|
55
59
|
const rgba: Rgba = parsed ?? { r: 255, g: 255, b: 255, a: 1 };
|
|
@@ -59,10 +63,10 @@ export function ColorPicker({ value, base, onChange, label, choices, allowNone =
|
|
|
59
63
|
// (a throttled write comes back older than the pointer, and the square would jump back to it).
|
|
60
64
|
const emitted = useRef<string | null>(null);
|
|
61
65
|
const dragging = useRef(false);
|
|
62
|
-
|
|
66
|
+
useOnNewValue(() => {
|
|
63
67
|
if (dragging.current || from === emitted.current) return;
|
|
64
68
|
setHsv((now) => hsvOf(rgba, now.h));
|
|
65
|
-
}, [from]);
|
|
69
|
+
}, [from]);
|
|
66
70
|
|
|
67
71
|
// Writes: a key or a click at once; a drag at most every 80 ms, and always its last one.
|
|
68
72
|
const last = useRef(0);
|
|
@@ -175,7 +179,7 @@ export function ColorPicker({ value, base, onChange, label, choices, allowNone =
|
|
|
175
179
|
{chips(recent, "Recent")}
|
|
176
180
|
{allowNone ? (
|
|
177
181
|
<button type="button" className="gemboss-ei-cp-none" aria-pressed={!value.trim()} onClick={() => { emitted.current = null; onChange(""); }}>
|
|
178
|
-
<span className="gemboss-ei-cp-none-sw" aria-hidden />
|
|
182
|
+
<span className="gemboss-ei-cp-none-sw" aria-hidden />{noneLabel}
|
|
179
183
|
</button>
|
|
180
184
|
) : null}
|
|
181
185
|
</div>
|