@cloudgrid-io/ui 0.31.4 → 0.31.6
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 +32 -0
- package/dist/badge/brand.d.ts +8 -0
- package/dist/badge/brand.d.ts.map +1 -0
- package/dist/badge/brand.js +22 -0
- package/dist/badge/brand.js.map +1 -0
- package/dist/badge/bubble.d.ts +11 -0
- package/dist/badge/bubble.d.ts.map +1 -0
- package/dist/badge/bubble.js +17 -0
- package/dist/badge/bubble.js.map +1 -0
- package/dist/badge/css-base.d.ts +25 -0
- package/dist/badge/css-base.d.ts.map +1 -0
- package/dist/badge/css-base.js +103 -0
- package/dist/badge/css-base.js.map +1 -0
- package/dist/badge/css-bubble.d.ts +10 -0
- package/dist/badge/css-bubble.d.ts.map +1 -0
- package/dist/badge/css-bubble.js +21 -0
- package/dist/badge/css-bubble.js.map +1 -0
- package/dist/badge/css-owner.d.ts +7 -0
- package/dist/badge/css-owner.d.ts.map +1 -0
- package/dist/badge/css-owner.js +159 -0
- package/dist/badge/css-owner.js.map +1 -0
- package/dist/badge/css-visitor.d.ts +7 -0
- package/dist/badge/css-visitor.d.ts.map +1 -0
- package/dist/badge/css-visitor.js +69 -0
- package/dist/badge/css-visitor.js.map +1 -0
- package/dist/badge/html.d.ts +26 -0
- package/dist/badge/html.d.ts.map +1 -0
- package/dist/badge/html.js +55 -0
- package/dist/badge/html.js.map +1 -0
- package/dist/badge/index.d.ts +43 -0
- package/dist/badge/index.d.ts.map +1 -0
- package/dist/badge/index.js +46 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/badge/marks.d.ts +47 -0
- package/dist/badge/marks.d.ts.map +1 -0
- package/dist/badge/marks.js +131 -0
- package/dist/badge/marks.js.map +1 -0
- package/dist/badge/owner.d.ts +239 -0
- package/dist/badge/owner.d.ts.map +1 -0
- package/dist/badge/owner.js +355 -0
- package/dist/badge/owner.js.map +1 -0
- package/dist/badge/palette.d.ts +23 -0
- package/dist/badge/palette.d.ts.map +1 -0
- package/dist/badge/palette.js +86 -0
- package/dist/badge/palette.js.map +1 -0
- package/dist/badge/root.d.ts +24 -0
- package/dist/badge/root.d.ts.map +1 -0
- package/dist/badge/root.js +11 -0
- package/dist/badge/root.js.map +1 -0
- package/dist/badge/shared.d.ts +56 -0
- package/dist/badge/shared.d.ts.map +1 -0
- package/dist/badge/shared.js +53 -0
- package/dist/badge/shared.js.map +1 -0
- package/dist/badge/visitor.d.ts +96 -0
- package/dist/badge/visitor.d.ts.map +1 -0
- package/dist/badge/visitor.js +118 -0
- package/dist/badge/visitor.js.map +1 -0
- package/dist/blocks/entity-status.d.ts +44 -1
- package/dist/blocks/entity-status.d.ts.map +1 -1
- package/dist/blocks/entity-status.js +26 -1
- package/dist/blocks/entity-status.js.map +1 -1
- package/dist/blocks/expiry-notice.d.ts +86 -0
- package/dist/blocks/expiry-notice.d.ts.map +1 -0
- package/dist/blocks/expiry-notice.js +81 -0
- package/dist/blocks/expiry-notice.js.map +1 -0
- package/dist/blocks/icons.d.ts +22 -0
- package/dist/blocks/icons.d.ts.map +1 -1
- package/dist/blocks/icons.js +22 -0
- package/dist/blocks/icons.js.map +1 -1
- package/dist/blocks/notification-row.d.ts +88 -0
- package/dist/blocks/notification-row.d.ts.map +1 -0
- package/dist/blocks/notification-row.js +32 -0
- package/dist/blocks/notification-row.js.map +1 -0
- package/dist/blocks/phosphor-marks.d.ts +10 -0
- package/dist/blocks/phosphor-marks.d.ts.map +1 -1
- package/dist/blocks/phosphor-marks.js +15 -0
- package/dist/blocks/phosphor-marks.js.map +1 -1
- package/dist/brand/badge/manrope-latin-wght-normal.woff2 +0 -0
- package/dist/brand/badge/space-grotesk-latin-wght-normal.woff2 +0 -0
- package/dist/brand/email/headline-activity.png +0 -0
- package/dist/brand/email/headline-expired.png +0 -0
- package/dist/brand/email/headline-expires-tomorrow.png +0 -0
- package/dist/brand/email/headline-expiring-soon.png +0 -0
- package/dist/brand/email/headline-invited.png +0 -0
- package/dist/brand/email/headline-sign-in-code.png +0 -0
- package/dist/brand/email/mesh.png +0 -0
- package/dist/brand/email/wordmark.png +0 -0
- package/dist/email/assets.d.ts +50 -0
- package/dist/email/assets.d.ts.map +1 -0
- package/dist/email/assets.js +16 -0
- package/dist/email/assets.js.map +1 -0
- package/dist/email/index.d.ts +204 -0
- package/dist/email/index.d.ts.map +1 -0
- package/dist/email/index.js +429 -0
- package/dist/email/index.js.map +1 -0
- package/dist/email/palette.d.ts +40 -0
- package/dist/email/palette.d.ts.map +1 -0
- package/dist/email/palette.js +44 -0
- package/dist/email/palette.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/ui/dropdown-menu.d.ts +8 -1
- package/dist/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/ui/dropdown-menu.js +9 -2
- package/dist/ui/dropdown-menu.js.map +1 -1
- package/package.json +18 -2
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The owner's half of the badge: the tab on the edge of the page and the owner
|
|
3
|
+
* panel's three steps (main, edit, share). Markup only; the badge wires the
|
|
4
|
+
* behaviour, the API supplies the data, and the server builds every Console URL.
|
|
5
|
+
*
|
|
6
|
+
* Import from `@cloudgrid-io/ui/badge/owner` in the owner file the badge
|
|
7
|
+
* lazy-loads for the app's owner only. Its stylesheet is `BADGE_OWNER_CSS`,
|
|
8
|
+
* added to a shadow root that already carries `BADGE_BASE_CSS`.
|
|
9
|
+
*
|
|
10
|
+
* The access model is Decision 060's, under the Console's own names
|
|
11
|
+
* (`lib/v2/visibility.ts`): who inside the grid (`shareScope`), who outside it
|
|
12
|
+
* (`externalAccess`), and whether the link needs a sign-in (`requireSignin`).
|
|
13
|
+
* The panel offers three buttons over it; anything finer is done in the
|
|
14
|
+
* Console, behind the "More options" link beside the heading (founder, 2026-10-12).
|
|
15
|
+
*/
|
|
16
|
+
import { ARROW_UP_RIGHT, CARET_LEFT, CHART_LINE_UP, CHAT_CIRCLE, CHECK, CHECK_CIRCLE, COPY, GLOBE, INFO, LOCK_SIMPLE, PENCIL_SIMPLE, SHARE_NETWORK, USERS, X, } from "./marks.js";
|
|
17
|
+
import { esc, glyph, href, sign } from "./html.js";
|
|
18
|
+
import { panel, select, toggleRow } from "./shared.js";
|
|
19
|
+
import { bubbleIcons } from "./bubble.js";
|
|
20
|
+
export { BADGE_OWNER_CSS } from "./css-owner.js";
|
|
21
|
+
/** The tab's label, on hover and on the first-visit peek alike. */
|
|
22
|
+
export const TAB_LABEL = "On your grid";
|
|
23
|
+
/**
|
|
24
|
+
* The owner tab: a white tab on the edge with the CloudGrid sign and a green
|
|
25
|
+
* dot; on hover "On your grid" slides out. The badge makes it draggable along
|
|
26
|
+
* either edge (it snaps to the nearer one) and moves it with the arrow keys.
|
|
27
|
+
*
|
|
28
|
+
* Action: `open-owner`.
|
|
29
|
+
*/
|
|
30
|
+
export function ownerTab({ side = "right", state = "rest", dragging = false, top, hidden = false } = {}) {
|
|
31
|
+
const style = top ? ` style="top:${esc(top)}"` : "";
|
|
32
|
+
return (`<button class="cgb-tab" type="button" data-action="open-owner" data-side="${side}" data-state="${state}"` +
|
|
33
|
+
`${dragging ? " data-dragging" : ""}${hidden ? " data-hidden" : ""}${style} aria-label="Manage your app on CloudGrid" title="Drag to move" aria-haspopup="dialog" aria-expanded="${hidden}">` +
|
|
34
|
+
sign() +
|
|
35
|
+
`<span class="cgb-tab-dot" aria-hidden="true"></span>` +
|
|
36
|
+
`<span class="cgb-tab-label" aria-hidden="true">${TAB_LABEL}</span>` +
|
|
37
|
+
`</button>`);
|
|
38
|
+
}
|
|
39
|
+
export function accessPreset(a) {
|
|
40
|
+
if (a.externalAccess === "none")
|
|
41
|
+
return a.shareScope === "private" ? "private" : "grid";
|
|
42
|
+
return a.shareScope === "grid" && !a.requireSignin ? "public" : null;
|
|
43
|
+
}
|
|
44
|
+
/** What a click on one of the three buttons asks for. Grid keeps "selected spaces" if that is set. */
|
|
45
|
+
export function presetAccess(preset, current) {
|
|
46
|
+
if (preset === "private")
|
|
47
|
+
return { shareScope: "private", externalAccess: "none", requireSignin: false };
|
|
48
|
+
if (preset === "grid")
|
|
49
|
+
return { shareScope: current.shareScope === "spaces" ? "spaces" : "grid", externalAccess: "none", requireSignin: false };
|
|
50
|
+
return { shareScope: "grid", externalAccess: current.externalAccess === "public" ? "public" : "link", requireSignin: false };
|
|
51
|
+
}
|
|
52
|
+
const RANK = { private: 0, spaces: 1, grid: 2, none: 0, link: 1, public: 2 };
|
|
53
|
+
/**
|
|
54
|
+
* True when `next` lets fewer people in than `current`: a smaller outside
|
|
55
|
+
* audience, a smaller inside audience at the same outside one, or a sign-in
|
|
56
|
+
* newly required. Narrowing asks first; widening saves at once.
|
|
57
|
+
*/
|
|
58
|
+
export function isNarrowing(current, next) {
|
|
59
|
+
if (RANK[next.externalAccess] < RANK[current.externalAccess])
|
|
60
|
+
return true;
|
|
61
|
+
if (next.externalAccess === current.externalAccess && RANK[next.shareScope] < RANK[current.shareScope])
|
|
62
|
+
return true;
|
|
63
|
+
return !current.requireSignin && next.requireSignin;
|
|
64
|
+
}
|
|
65
|
+
/** The one-line confirm a narrowing shows in the panel. */
|
|
66
|
+
export function narrowingMessage(current, next, gridName) {
|
|
67
|
+
const outsiders = RANK[next.externalAccess] < RANK[current.externalAccess] || (next.requireSignin && !current.requireSignin);
|
|
68
|
+
return outsiders ? "People with the link will lose access." : `Some people in ${gridName} will lose access.`;
|
|
69
|
+
}
|
|
70
|
+
const number = (n) => esc(n.toLocaleString("en-US"));
|
|
71
|
+
const plural = (n, one, many) => `${number(n)} ${n === 1 ? one : many}`;
|
|
72
|
+
function gridRow(o) {
|
|
73
|
+
const v = o.views;
|
|
74
|
+
let line = "";
|
|
75
|
+
let bars = "";
|
|
76
|
+
if (v) {
|
|
77
|
+
if (v.total > 0) {
|
|
78
|
+
line = `<span class="cgb-row-s"><b>${number(v.total)}</b> ${v.total === 1 ? "view" : "views"} this week</span>`;
|
|
79
|
+
const days = v.daily.slice(-7);
|
|
80
|
+
const max = Math.max(1, ...days);
|
|
81
|
+
bars =
|
|
82
|
+
`<span class="cgb-spark" aria-hidden="true">` +
|
|
83
|
+
days.map((d) => `<i style="height:${Math.round((Math.max(0, d) / max) * 100)}%"></i>`).join("") +
|
|
84
|
+
`</span>`;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
line = `<span class="cgb-row-s">No views yet this week</span>`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return (`<a class="cgb-row" data-tall href="${href(o.appPageUrl)}" target="_blank" rel="noopener" data-action="open-app-page">` +
|
|
91
|
+
`<span class="cgb-row-lead">${glyph(CHART_LINE_UP)}<span><span class="cgb-row-k"><span>Grid:</span> <b>${esc(o.gridName)}</b></span>${line}</span></span>` +
|
|
92
|
+
bars +
|
|
93
|
+
glyph(ARROW_UP_RIGHT) +
|
|
94
|
+
`</a>`);
|
|
95
|
+
}
|
|
96
|
+
function checkbox(value, label, checked, action) {
|
|
97
|
+
return `<label class="cgb-opt"><input type="checkbox" value="${esc(value)}" data-action="${action}"${checked ? " checked" : ""}><span class="cgb-opt-box"></span>${esc(label)}</label>`;
|
|
98
|
+
}
|
|
99
|
+
const PRESETS = [
|
|
100
|
+
{ value: "private", label: "Private", paths: LOCK_SIMPLE },
|
|
101
|
+
{ value: "grid", label: "Grid", paths: USERS },
|
|
102
|
+
{ value: "public", label: "Public", paths: GLOBE },
|
|
103
|
+
];
|
|
104
|
+
/** The Grid row's menu: everyone in the grid, or the selected spaces. */
|
|
105
|
+
export const GRID_SCOPE_OPTIONS = [
|
|
106
|
+
{ value: "grid", label: "Everyone" },
|
|
107
|
+
{ value: "spaces", label: "Selected spaces…" },
|
|
108
|
+
];
|
|
109
|
+
/**
|
|
110
|
+
* Who can open this (founder, 2026-10-12). The heading row carries the Saved
|
|
111
|
+
* flash and a "More options" link to the Console. Under the three buttons is
|
|
112
|
+
* ONE fixed-height row with only the chosen option's control: Private's line,
|
|
113
|
+
* Grid's "In {grid}" menu, Public's findable switch, or the caller's line for a
|
|
114
|
+
* mix the buttons cannot show. The narrowing confirm covers that same row. So
|
|
115
|
+
* the panel keeps one height while choosing; only the selected-spaces
|
|
116
|
+
* checklist, which the owner opens on purpose, grows it.
|
|
117
|
+
*/
|
|
118
|
+
function accessSection(o) {
|
|
119
|
+
const a = o.access;
|
|
120
|
+
const preset = accessPreset(a);
|
|
121
|
+
// The button a narrowing click landed on, waiting for Confirm. A narrowing
|
|
122
|
+
// inside Grid (to selected spaces) came from the menu, so no button is pending.
|
|
123
|
+
const pendingPreset = o.pending ? accessPreset(o.pending) : null;
|
|
124
|
+
const spaces = o.spaces ?? [];
|
|
125
|
+
const save = o.saveState === "saving" ? "Saving…" : o.saveState === "saved" ? "Saved" : "";
|
|
126
|
+
let row;
|
|
127
|
+
if (o.pending) {
|
|
128
|
+
row =
|
|
129
|
+
`<div class="cgb-confirm" role="alert"><span>${esc(narrowingMessage(a, o.pending, o.gridName))}</span><span>` +
|
|
130
|
+
`<button class="cgb-btn" type="button" data-variant="outline" data-size="sm" data-action="confirm-cancel">Cancel</button>` +
|
|
131
|
+
`<button class="cgb-btn" type="button" data-variant="ink" data-size="sm" data-action="confirm-ok">Confirm</button></span></div>`;
|
|
132
|
+
}
|
|
133
|
+
else if (preset === "private") {
|
|
134
|
+
row = `<p class="cgb-desc">Only you can open this.</p>`;
|
|
135
|
+
}
|
|
136
|
+
else if (preset === "grid") {
|
|
137
|
+
row =
|
|
138
|
+
`<div class="cgb-srow"><span>In ${esc(o.gridName)}</span>` +
|
|
139
|
+
select({
|
|
140
|
+
label: `Who in ${o.gridName}`,
|
|
141
|
+
action: "access-scope",
|
|
142
|
+
value: a.shareScope === "spaces" ? "spaces" : "grid",
|
|
143
|
+
options: GRID_SCOPE_OPTIONS,
|
|
144
|
+
open: !!o.scopeMenuOpen,
|
|
145
|
+
}) +
|
|
146
|
+
`</div>`;
|
|
147
|
+
}
|
|
148
|
+
else if (preset === "public") {
|
|
149
|
+
row = `<div class="cgb-srow">${toggleRow("Findable by search engines", a.externalAccess === "public", "access-findable")}</div>`;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
row = `<p class="cgb-desc">${esc(o.customDescription ?? "")}</p>`;
|
|
153
|
+
}
|
|
154
|
+
const list = preset === "grid" && a.shareScope === "spaces" && spaces.length
|
|
155
|
+
? `<div class="cgb-spaces">${spaces.map((s) => checkbox(s.id, s.name, !!s.selected, "access-space")).join("")}</div>`
|
|
156
|
+
: "";
|
|
157
|
+
return (`<div class="cgb-sec"><h3 id="cgb-access">Who can open this<span class="cgb-saved" role="status">${save}</span></h3>` +
|
|
158
|
+
`<a class="cgb-more" href="${href(o.accessPageUrl)}" target="_blank" rel="noopener" data-action="open-access-page">More options${glyph(ARROW_UP_RIGHT)}</a></div>` +
|
|
159
|
+
`<div class="cgb-seg" role="radiogroup" aria-labelledby="cgb-access">` +
|
|
160
|
+
PRESETS.map((p) => `<button type="button" role="radio" aria-checked="${p.value === preset}"${p.value === pendingPreset && p.value !== preset ? " data-pending" : ""} data-action="access-preset" data-value="${p.value}">${glyph(p.paths)}${p.label}</button>`).join("") +
|
|
161
|
+
`</div>` +
|
|
162
|
+
`<div class="cgb-aslot">${row}</div>` +
|
|
163
|
+
list);
|
|
164
|
+
}
|
|
165
|
+
/** The switch's label (ui#316; it read "Show to visitors" before). */
|
|
166
|
+
export const ASK_VISITORS_LABEL = "Ask visitors for feedback";
|
|
167
|
+
/**
|
|
168
|
+
* The explanation the info button opens, in order: what visitors see, then
|
|
169
|
+
* what they can do (founder, 2026-10-13).
|
|
170
|
+
*/
|
|
171
|
+
export const ASK_VISITORS_INFO = [
|
|
172
|
+
"Visitors see this in the corner of your app.",
|
|
173
|
+
"They can leave a reaction or a note. Turn it off to hide it.",
|
|
174
|
+
];
|
|
175
|
+
/**
|
|
176
|
+
* "Ask visitors for feedback" with its info button and switch, and the
|
|
177
|
+
* explanation the button opens (ui#316).
|
|
178
|
+
*
|
|
179
|
+
* The explanation is drawn OVER the rows above the switch, anchored to the
|
|
180
|
+
* switch row's top edge and growing upward, never in the flow: the panel keeps
|
|
181
|
+
* its height and nothing under it moves, and the switch it explains stays in
|
|
182
|
+
* view and in reach. Its height reaches the gap under the name row, so it
|
|
183
|
+
* covers the grid row and the Feedback row whole and stops short of the name
|
|
184
|
+
* row, which keeps Edit and Share in view. It shows the visitor's bubble itself, from the same
|
|
185
|
+
* artwork and look as `bubble()`, still, in a tile standing for the app's corner.
|
|
186
|
+
*
|
|
187
|
+
* It sits right after the info button in the markup, so Tab goes from the
|
|
188
|
+
* button into the explanation (its x) and then on to the switch. The row is a
|
|
189
|
+
* div with a `<label for>` rather than a wrapping label: a button inside a
|
|
190
|
+
* label would become the label's control.
|
|
191
|
+
*/
|
|
192
|
+
function askRow(checked, infoOpen) {
|
|
193
|
+
return (`<div class="cgb-toggle cgb-ask">` +
|
|
194
|
+
`<label for="cgb-ask-switch">${ASK_VISITORS_LABEL}</label>` +
|
|
195
|
+
`<button class="cgb-info-btn" type="button" data-action="feedback-info" aria-label="What visitors see" aria-expanded="${infoOpen}" aria-controls="cgb-info">${glyph(INFO)}</button>` +
|
|
196
|
+
`<div class="cgb-info" id="cgb-info" role="group" aria-label="What visitors see"${infoOpen ? "" : " hidden"}>` +
|
|
197
|
+
`<span class="cgb-info-art" aria-hidden="true"><span class="cgb-info-bubble">${bubbleIcons()}</span></span>` +
|
|
198
|
+
`<p class="cgb-info-copy"><span>${ASK_VISITORS_INFO[0]}</span> ${ASK_VISITORS_INFO[1]}</p>` +
|
|
199
|
+
`<button class="cgb-icon-btn cgb-info-x" type="button" data-action="feedback-info-close" aria-label="Hide what visitors see">${glyph(X)}</button>` +
|
|
200
|
+
`</div>` +
|
|
201
|
+
`<button class="cgb-switch" id="cgb-ask-switch" type="button" role="switch" aria-checked="${checked}" data-action="show-to-visitors" aria-label="${ASK_VISITORS_LABEL}"></button>` +
|
|
202
|
+
`</div>`);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The main step: the name row (name, status, and Edit and Share at its right
|
|
206
|
+
* end), the grid row, the feedback box, who can open this, and at the foot,
|
|
207
|
+
* under a hairline, "Only you see this panel." (founder, 2026-10-13: no
|
|
208
|
+
* separate Edit and Share row). A long name ends in an ellipsis, with the
|
|
209
|
+
* whole name in its `title`; the status and the two buttons never shrink.
|
|
210
|
+
* The status is `EntityStatus`'s dot and word without its chip, so it reads as
|
|
211
|
+
* a state beside the name and not as a third button (founder, 2026-10-13).
|
|
212
|
+
*
|
|
213
|
+
* Actions: `open-app-page`, `open-feedback-page` and `open-access-page` (links,
|
|
214
|
+
* new tab), `go-edit`, `go-share`, `show-to-visitors` and `access-findable`
|
|
215
|
+
* (switches), `feedback-info` (the info button, a toggle) and
|
|
216
|
+
* `feedback-info-close` (the explanation's x), `access-preset` (`data-value`), `access-scope` (the Grid menu's
|
|
217
|
+
* trigger) and `access-scope-pick` (`data-value` `grid` or `spaces`),
|
|
218
|
+
* `access-space` (checkboxes), `confirm-ok`, `confirm-cancel`.
|
|
219
|
+
*/
|
|
220
|
+
export function ownerMain(o) {
|
|
221
|
+
const status = o.status === undefined ? "Live" : o.status;
|
|
222
|
+
return (`<div class="cgb-title"><h2 title="${esc(o.name)}">${esc(o.name)}</h2>${status ? `<span class="cgb-status">${esc(status)}</span>` : ""}` +
|
|
223
|
+
`<span class="cgb-acts">` +
|
|
224
|
+
`<button class="cgb-btn" type="button" data-variant="outline" data-size="sm" data-action="go-edit">${glyph(PENCIL_SIMPLE)}<span>Edit</span></button>` +
|
|
225
|
+
`<button class="cgb-btn" type="button" data-variant="outline" data-size="sm" data-action="go-share">${glyph(SHARE_NETWORK)}<span>Share</span></button>` +
|
|
226
|
+
`</span></div>` +
|
|
227
|
+
gridRow(o) +
|
|
228
|
+
`<div class="cgb-box">` +
|
|
229
|
+
`<a class="cgb-row" data-tall href="${href(o.feedback.url)}" target="_blank" rel="noopener" data-action="open-feedback-page">` +
|
|
230
|
+
`<span class="cgb-row-lead">${glyph(CHAT_CIRCLE)}<span><span class="cgb-row-k"><b>Feedback</b></span>` +
|
|
231
|
+
`<span class="cgb-row-s">${plural(o.feedback.reactions, "reaction", "reactions")} · ${plural(o.feedback.notes, "note", "notes")}</span></span></span>` +
|
|
232
|
+
glyph(ARROW_UP_RIGHT) +
|
|
233
|
+
`</a>` +
|
|
234
|
+
askRow(o.showToVisitors, !!o.infoOpen) +
|
|
235
|
+
`</div>` +
|
|
236
|
+
accessSection(o) +
|
|
237
|
+
`<p class="cgb-yours">Only you see this panel.</p>`);
|
|
238
|
+
}
|
|
239
|
+
// ---- the edit step -----------------------------------------------------------------
|
|
240
|
+
/**
|
|
241
|
+
* The prompt the edit step offers, with the library's prompt grammar: a
|
|
242
|
+
* backticked run is a literal (accent on screen) and the fences are never
|
|
243
|
+
* copied. Fill it with `editPrompt`; copy it with `promptCopyText`.
|
|
244
|
+
*/
|
|
245
|
+
export const EDIT_PROMPT_TEMPLATE = "Edit my CloudGrid app {name}: `{url}`\n\n" +
|
|
246
|
+
"If we worked on it in another chat, continue from there. If not, run `grid pull` to get the code, make the change, and plug it again to the same link.\n\n" +
|
|
247
|
+
"Change: describe it here";
|
|
248
|
+
/** The words at the end of the prompt the owner replaces. Dimmed on screen, copied as written. */
|
|
249
|
+
export const EDIT_PROMPT_PLACEHOLDER = "describe it here";
|
|
250
|
+
/** The edit prompt for one app, in the prompt grammar. A backtick in the name or URL is dropped. */
|
|
251
|
+
export function editPrompt(name, url) {
|
|
252
|
+
const clean = (s) => s.replace(/`/g, "");
|
|
253
|
+
return EDIT_PROMPT_TEMPLATE.replace("{name}", clean(name)).replace("{url}", clean(url));
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* The prompt grammar's backtick runs, as `PromptBlock` parses them
|
|
257
|
+
* (`promptSegments` in blocks/prompt-block.tsx): a closed pair is a literal and
|
|
258
|
+
* its fences are delimiters; an unclosed backtick is literal text. Asserted
|
|
259
|
+
* equal to the library's parser in the node suite.
|
|
260
|
+
*/
|
|
261
|
+
export function promptRuns(line) {
|
|
262
|
+
const runs = [];
|
|
263
|
+
let rest = line;
|
|
264
|
+
while (rest.length > 0) {
|
|
265
|
+
const open = rest.indexOf("`");
|
|
266
|
+
if (open === -1)
|
|
267
|
+
break;
|
|
268
|
+
const close = rest.indexOf("`", open + 1);
|
|
269
|
+
if (close === -1)
|
|
270
|
+
break;
|
|
271
|
+
if (open > 0)
|
|
272
|
+
runs.push({ text: rest.slice(0, open), code: false });
|
|
273
|
+
const inner = rest.slice(open + 1, close);
|
|
274
|
+
if (inner.length > 0)
|
|
275
|
+
runs.push({ text: inner, code: true });
|
|
276
|
+
rest = rest.slice(close + 1);
|
|
277
|
+
}
|
|
278
|
+
if (rest.length > 0)
|
|
279
|
+
runs.push({ text: rest, code: false });
|
|
280
|
+
return runs;
|
|
281
|
+
}
|
|
282
|
+
/** What the clipboard gets: the fences consumed, trailing blank lines dropped. Same as `PromptBlock`. */
|
|
283
|
+
export function promptCopyText(prompt) {
|
|
284
|
+
return prompt
|
|
285
|
+
.split("\n")
|
|
286
|
+
.map((l) => promptRuns(l).map((r) => r.text).join(""))
|
|
287
|
+
.join("\n")
|
|
288
|
+
.replace(/\n+$/, "");
|
|
289
|
+
}
|
|
290
|
+
/** The prompt in `PromptBlock`'s look, with its icon-only copy control. Action: `copy-prompt`. */
|
|
291
|
+
export function promptBlock(prompt, { copied = false, placeholder = EDIT_PROMPT_PLACEHOLDER } = {}) {
|
|
292
|
+
const lines = prompt.split("\n").map((line) => promptRuns(line)
|
|
293
|
+
.map((r, i, all) => {
|
|
294
|
+
if (r.code)
|
|
295
|
+
return `<b>${esc(r.text)}</b>`;
|
|
296
|
+
if (placeholder && i === all.length - 1 && r.text.endsWith(placeholder)) {
|
|
297
|
+
return esc(r.text.slice(0, -placeholder.length)) + `<i>${esc(placeholder)}</i>`;
|
|
298
|
+
}
|
|
299
|
+
return esc(r.text);
|
|
300
|
+
})
|
|
301
|
+
.join(""));
|
|
302
|
+
return (`<div class="cgb-prompt"><pre>${lines.join("\n")}</pre>` +
|
|
303
|
+
`<button class="cgb-prompt-copy" type="button" data-action="copy-prompt" aria-label="Copy prompt">${glyph(copied ? CHECK : COPY)}</button>` +
|
|
304
|
+
`<span class="cgb-sr" aria-live="polite">${copied ? "Copied to the clipboard" : ""}</span></div>`);
|
|
305
|
+
}
|
|
306
|
+
const stepHead = (title) => `<div class="cgb-step-head"><button class="cgb-icon-btn" type="button" data-action="go-main" aria-label="Back">${glyph(CARET_LEFT)}</button><h2>${esc(title)}</h2></div>`;
|
|
307
|
+
/** The edit step: why it is safe, the two ways, and the prompt. Actions: `go-main`, `copy-prompt`. */
|
|
308
|
+
export function ownerEdit({ name, url, copied = false }) {
|
|
309
|
+
return (stepHead(`Edit ${name}`) +
|
|
310
|
+
`<p class="cgb-sure">${glyph(CHECK_CIRCLE)}<span><b>No need to worry:</b> every edit updates the same link.</span></p>` +
|
|
311
|
+
`<ol class="cgb-ways">` +
|
|
312
|
+
`<li><span class="cgb-wn" aria-hidden="true">1</span><div><p class="cgb-wt"><b>Best:</b> go back to the chat where you made it</p><p class="cgb-wd">It already remembers ${esc(name)}.</p></div></li>` +
|
|
313
|
+
`<li><span class="cgb-wn" aria-hidden="true">2</span><div><p class="cgb-wt">Or paste this into a new chat</p></div></li>` +
|
|
314
|
+
`</ol>` +
|
|
315
|
+
promptBlock(editPrompt(name, url), { copied }));
|
|
316
|
+
}
|
|
317
|
+
/** Who can open it, in one line, for the share step. */
|
|
318
|
+
export function whoCanOpen(a, gridName) {
|
|
319
|
+
if (a.externalAccess === "public")
|
|
320
|
+
return "Anyone can open it, and search engines can find it.";
|
|
321
|
+
if (a.externalAccess === "link")
|
|
322
|
+
return a.requireSignin ? "Anyone with the link can open it after signing in." : "Anyone with the link can open it.";
|
|
323
|
+
if (a.shareScope === "grid")
|
|
324
|
+
return `Only people in ${gridName} can open it. Others see a page asking for access.`;
|
|
325
|
+
if (a.shareScope === "spaces")
|
|
326
|
+
return "Only people in the selected spaces can open it. Others see a page asking for access.";
|
|
327
|
+
return "Only you can open it.";
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* The share step: the link and Copy link, and who can open it. No invite.
|
|
331
|
+
*
|
|
332
|
+
* On a phone it is the fallback: the badge sends the main panel's Share
|
|
333
|
+
* (`go-share`) straight to the phone's own share sheet (`navigator.share`
|
|
334
|
+
* with the app's name and URL) when the pointer is coarse and the API exists
|
|
335
|
+
* (founder, 2026-10-12). Desktop, and a phone without it, open this step.
|
|
336
|
+
*
|
|
337
|
+
* Actions: `go-main`, `copy-link`, and `go-main` again on "Change who can open
|
|
338
|
+
* it" when the app is private.
|
|
339
|
+
*/
|
|
340
|
+
export function ownerShare({ name, url, access, gridName, copied = false }) {
|
|
341
|
+
const icon = access.externalAccess !== "none" ? GLOBE : access.shareScope === "private" ? LOCK_SIMPLE : USERS;
|
|
342
|
+
const isPrivate = access.externalAccess === "none" && access.shareScope === "private";
|
|
343
|
+
return (stepHead(`Share ${name}`) +
|
|
344
|
+
`<div class="cgb-link-box"><span>${esc(url.replace(/^https?:\/\//, ""))}</span>` +
|
|
345
|
+
`<button class="cgb-btn" type="button" data-size="sm" data-action="copy-link">${glyph(copied ? CHECK : COPY)}<span>${copied ? "Copied" : "Copy link"}</span></button></div>` +
|
|
346
|
+
`<p class="cgb-who">${glyph(icon)}<span>${esc(whoCanOpen(access, gridName))}` +
|
|
347
|
+
(isPrivate ? ` <button type="button" data-action="go-main">Change who can open it</button>` : "") +
|
|
348
|
+
`</span></p>`);
|
|
349
|
+
}
|
|
350
|
+
/** The owner panel around one step, opening from the tab's side. */
|
|
351
|
+
export function ownerPanel(o) {
|
|
352
|
+
const body = o.step === "main" ? ownerMain(o) : o.step === "edit" ? ownerEdit(o) : ownerShare(o);
|
|
353
|
+
return panel({ label: "Manage this app on CloudGrid", side: o.side ?? "right", body, attrs: `data-step="${o.step}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AAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;IAChG,OAAO,KAAK,CAAC,EAAE,KAAK,EAAE,8BAA8B,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAA;AACxH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Every badge token as one declaration list, for the badge root's rule. */
|
|
2
|
+
export declare const BADGE_TOKEN_DECLARATIONS = "--cg-primary:#5a47f0;--cg-primary-press:#4b39db;--cg-primary-tint:#eeecfe;--cg-tertiary:#60e9f0;--cg-tertiary-press:#4dd8e0;--cg-accent:#0061f0;--cg-cyan-200:#dffbfc;--cg-lime-200:#eef7dc;--cg-surface-card:#ffffff;--cg-surface-raised:#f4f6f8;--cg-surface-control:#e3e3e3;--cg-surface-subtle:#f2f1f7;--cg-hover:rgba(34, 34, 34, 0.045);--cg-scrim:rgba(34, 34, 34, 0.4);--cg-text-primary:#222222;--cg-text-secondary:#595959;--cg-text-muted:#858585;--cg-text-muted-strong:#6a6a6a;--cg-text-placeholder:#acacac;--cg-text-accent:#5a47f0;--cg-text-on-primary:#ffffff;--cg-text-on-accent:#222222;--cg-border-hairline:#e6e8ea;--cg-border-control:#e3e3e3;--cg-border-accent:#5a47f0;--cg-focus-ring:rgba(90, 71, 240, 0.28);--cg-online:#00a05c;--cg-online-fill:#e6f7ef;--cg-online-strong:#085d3a;--cg-expired-fill:#fdf3e0;--cg-expired-border:#fedf89;--cg-expired-strong:#7a3d0a;--cg-font-ui:'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;--cg-font-body:'Space Grotesk Variable', 'Space Grotesk', 'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;--cg-font-mono:'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;--cg-weight-regular:400;--cg-weight-medium:500;--cg-weight-bold:600;--cg-body-18:18px;--cg-body-md:16px;--cg-body-sm:15px;--cg-body-14:14px;--cg-caption:13px;--cg-body-line:1.46;--cg-mono-size:14px;--cg-mono-line:1.7;--cg-radius-xs:8px;--cg-radius-sm:10px;--cg-radius-md:12px;--cg-radius-lg:14px;--cg-radius-xl:16px;--cg-radius-container:20px;--cg-radius-pill:999px;--cg-shadow-card:0 4px 16px rgba(34, 34, 34, 0.04), 0 4px 4px rgba(34, 34, 34, 0.04);--cg-shadow-hover:0 8px 24px rgba(34, 34, 34, 0.08);--cg-shadow-panel:0 10px 40px rgba(90, 71, 240, 0.18);--cg-duration-fast:120ms;--cg-duration:180ms;--cg-duration-slow:280ms;--cg-ease-out:cubic-bezier(0, 0, 0.2, 1);";
|
|
3
|
+
/** The same values as a map, for tests and the gallery. Not needed at runtime. */
|
|
4
|
+
export declare const BADGE_TOKENS: Readonly<Record<string, string>>;
|
|
5
|
+
/** `--cg-font-ui`: Manrope. The tab label and button labels. */
|
|
6
|
+
export declare const BADGE_FONT_UI = "'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
|
|
7
|
+
/** `--cg-font-body`: Space Grotesk. Every other line of text. */
|
|
8
|
+
export declare const BADGE_FONT_BODY = "'Space Grotesk Variable', 'Space Grotesk', 'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
|
|
9
|
+
/**
|
|
10
|
+
* The font files the badge's type needs, latin subset, variable weight. The
|
|
11
|
+
* badge never loads them: the platform hosts these files (the package carries
|
|
12
|
+
* them at `@cloudgrid-io/ui/brand/badge/<file>`) and registers each on the
|
|
13
|
+
* document with the FontFace API, because @font-face inside a closed shadow
|
|
14
|
+
* root is unreliable. Without them the system stack in each family renders.
|
|
15
|
+
*/
|
|
16
|
+
export declare const BADGE_FONT_FACES: ReadonlyArray<{
|
|
17
|
+
family: string;
|
|
18
|
+
weight: string;
|
|
19
|
+
style: string;
|
|
20
|
+
file: string;
|
|
21
|
+
unicodeRange: string;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=palette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../src/badge/palette.ts"],"names":[],"mappings":"AAMA,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,u2DACi0D,CAAA;AAEt2D,kFAAkF;AAClF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA6DzD,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,aAAa,6FAA6F,CAAA;AAEvH,iEAAiE;AACjE,eAAO,MAAM,eAAe,wIAAwI,CAAA;AAEpK;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;CACrB,CAGA,CAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// GENERATED by scripts/build-badge.mjs from src/tokens.css. Do not edit.
|
|
2
|
+
//
|
|
3
|
+
// The badge runs in a closed shadow root inside other people's apps, so it
|
|
4
|
+
// carries its token values with it. Each is the resolved value of the token of
|
|
5
|
+
// the same name at :root. Retune the token and rebuild; this file follows.
|
|
6
|
+
/** Every badge token as one declaration list, for the badge root's rule. */
|
|
7
|
+
export const BADGE_TOKEN_DECLARATIONS = "--cg-primary:#5a47f0;--cg-primary-press:#4b39db;--cg-primary-tint:#eeecfe;--cg-tertiary:#60e9f0;--cg-tertiary-press:#4dd8e0;--cg-accent:#0061f0;--cg-cyan-200:#dffbfc;--cg-lime-200:#eef7dc;--cg-surface-card:#ffffff;--cg-surface-raised:#f4f6f8;--cg-surface-control:#e3e3e3;--cg-surface-subtle:#f2f1f7;--cg-hover:rgba(34, 34, 34, 0.045);--cg-scrim:rgba(34, 34, 34, 0.4);--cg-text-primary:#222222;--cg-text-secondary:#595959;--cg-text-muted:#858585;--cg-text-muted-strong:#6a6a6a;--cg-text-placeholder:#acacac;--cg-text-accent:#5a47f0;--cg-text-on-primary:#ffffff;--cg-text-on-accent:#222222;--cg-border-hairline:#e6e8ea;--cg-border-control:#e3e3e3;--cg-border-accent:#5a47f0;--cg-focus-ring:rgba(90, 71, 240, 0.28);--cg-online:#00a05c;--cg-online-fill:#e6f7ef;--cg-online-strong:#085d3a;--cg-expired-fill:#fdf3e0;--cg-expired-border:#fedf89;--cg-expired-strong:#7a3d0a;--cg-font-ui:'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;--cg-font-body:'Space Grotesk Variable', 'Space Grotesk', 'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;--cg-font-mono:'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;--cg-weight-regular:400;--cg-weight-medium:500;--cg-weight-bold:600;--cg-body-18:18px;--cg-body-md:16px;--cg-body-sm:15px;--cg-body-14:14px;--cg-caption:13px;--cg-body-line:1.46;--cg-mono-size:14px;--cg-mono-line:1.7;--cg-radius-xs:8px;--cg-radius-sm:10px;--cg-radius-md:12px;--cg-radius-lg:14px;--cg-radius-xl:16px;--cg-radius-container:20px;--cg-radius-pill:999px;--cg-shadow-card:0 4px 16px rgba(34, 34, 34, 0.04), 0 4px 4px rgba(34, 34, 34, 0.04);--cg-shadow-hover:0 8px 24px rgba(34, 34, 34, 0.08);--cg-shadow-panel:0 10px 40px rgba(90, 71, 240, 0.18);--cg-duration-fast:120ms;--cg-duration:180ms;--cg-duration-slow:280ms;--cg-ease-out:cubic-bezier(0, 0, 0.2, 1);";
|
|
8
|
+
/** The same values as a map, for tests and the gallery. Not needed at runtime. */
|
|
9
|
+
export const BADGE_TOKENS = {
|
|
10
|
+
"--cg-primary": "#5a47f0",
|
|
11
|
+
"--cg-primary-press": "#4b39db",
|
|
12
|
+
"--cg-primary-tint": "#eeecfe",
|
|
13
|
+
"--cg-tertiary": "#60e9f0",
|
|
14
|
+
"--cg-tertiary-press": "#4dd8e0",
|
|
15
|
+
"--cg-accent": "#0061f0",
|
|
16
|
+
"--cg-cyan-200": "#dffbfc",
|
|
17
|
+
"--cg-lime-200": "#eef7dc",
|
|
18
|
+
"--cg-surface-card": "#ffffff",
|
|
19
|
+
"--cg-surface-raised": "#f4f6f8",
|
|
20
|
+
"--cg-surface-control": "#e3e3e3",
|
|
21
|
+
"--cg-surface-subtle": "#f2f1f7",
|
|
22
|
+
"--cg-hover": "rgba(34, 34, 34, 0.045)",
|
|
23
|
+
"--cg-scrim": "rgba(34, 34, 34, 0.4)",
|
|
24
|
+
"--cg-text-primary": "#222222",
|
|
25
|
+
"--cg-text-secondary": "#595959",
|
|
26
|
+
"--cg-text-muted": "#858585",
|
|
27
|
+
"--cg-text-muted-strong": "#6a6a6a",
|
|
28
|
+
"--cg-text-placeholder": "#acacac",
|
|
29
|
+
"--cg-text-accent": "#5a47f0",
|
|
30
|
+
"--cg-text-on-primary": "#ffffff",
|
|
31
|
+
"--cg-text-on-accent": "#222222",
|
|
32
|
+
"--cg-border-hairline": "#e6e8ea",
|
|
33
|
+
"--cg-border-control": "#e3e3e3",
|
|
34
|
+
"--cg-border-accent": "#5a47f0",
|
|
35
|
+
"--cg-focus-ring": "rgba(90, 71, 240, 0.28)",
|
|
36
|
+
"--cg-online": "#00a05c",
|
|
37
|
+
"--cg-online-fill": "#e6f7ef",
|
|
38
|
+
"--cg-online-strong": "#085d3a",
|
|
39
|
+
"--cg-expired-fill": "#fdf3e0",
|
|
40
|
+
"--cg-expired-border": "#fedf89",
|
|
41
|
+
"--cg-expired-strong": "#7a3d0a",
|
|
42
|
+
"--cg-font-ui": "'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
43
|
+
"--cg-font-body": "'Space Grotesk Variable', 'Space Grotesk', 'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
44
|
+
"--cg-font-mono": "'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
45
|
+
"--cg-weight-regular": "400",
|
|
46
|
+
"--cg-weight-medium": "500",
|
|
47
|
+
"--cg-weight-bold": "600",
|
|
48
|
+
"--cg-body-18": "18px",
|
|
49
|
+
"--cg-body-md": "16px",
|
|
50
|
+
"--cg-body-sm": "15px",
|
|
51
|
+
"--cg-body-14": "14px",
|
|
52
|
+
"--cg-caption": "13px",
|
|
53
|
+
"--cg-body-line": "1.46",
|
|
54
|
+
"--cg-mono-size": "14px",
|
|
55
|
+
"--cg-mono-line": "1.7",
|
|
56
|
+
"--cg-radius-xs": "8px",
|
|
57
|
+
"--cg-radius-sm": "10px",
|
|
58
|
+
"--cg-radius-md": "12px",
|
|
59
|
+
"--cg-radius-lg": "14px",
|
|
60
|
+
"--cg-radius-xl": "16px",
|
|
61
|
+
"--cg-radius-container": "20px",
|
|
62
|
+
"--cg-radius-pill": "999px",
|
|
63
|
+
"--cg-shadow-card": "0 4px 16px rgba(34, 34, 34, 0.04), 0 4px 4px rgba(34, 34, 34, 0.04)",
|
|
64
|
+
"--cg-shadow-hover": "0 8px 24px rgba(34, 34, 34, 0.08)",
|
|
65
|
+
"--cg-shadow-panel": "0 10px 40px rgba(90, 71, 240, 0.18)",
|
|
66
|
+
"--cg-duration-fast": "120ms",
|
|
67
|
+
"--cg-duration": "180ms",
|
|
68
|
+
"--cg-duration-slow": "280ms",
|
|
69
|
+
"--cg-ease-out": "cubic-bezier(0, 0, 0.2, 1)",
|
|
70
|
+
};
|
|
71
|
+
/** `--cg-font-ui`: Manrope. The tab label and button labels. */
|
|
72
|
+
export const BADGE_FONT_UI = "'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
|
|
73
|
+
/** `--cg-font-body`: Space Grotesk. Every other line of text. */
|
|
74
|
+
export const BADGE_FONT_BODY = "'Space Grotesk Variable', 'Space Grotesk', 'Manrope Variable', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
|
|
75
|
+
/**
|
|
76
|
+
* The font files the badge's type needs, latin subset, variable weight. The
|
|
77
|
+
* badge never loads them: the platform hosts these files (the package carries
|
|
78
|
+
* them at `@cloudgrid-io/ui/brand/badge/<file>`) and registers each on the
|
|
79
|
+
* document with the FontFace API, because @font-face inside a closed shadow
|
|
80
|
+
* root is unreliable. Without them the system stack in each family renders.
|
|
81
|
+
*/
|
|
82
|
+
export const BADGE_FONT_FACES = [
|
|
83
|
+
{ family: "Manrope Variable", weight: "200 800", style: "normal", file: "manrope-latin-wght-normal.woff2", unicodeRange: "U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD" },
|
|
84
|
+
{ family: "Space Grotesk Variable", weight: "300 700", style: "normal", file: "space-grotesk-latin-wght-normal.woff2", unicodeRange: "U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD" },
|
|
85
|
+
];
|
|
86
|
+
//# sourceMappingURL=palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.js","sourceRoot":"","sources":["../../src/badge/palette.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,2EAA2E;AAC3E,+EAA+E;AAC/E,2EAA2E;AAE3E,4EAA4E;AAC5E,MAAM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AE,MAAM;IACtB,gBAAgB,EAAE,MAAM;IACxB,gBAAgB,EAAE,MAAM;IACxB,gBAAgB,EAAE,KAAK;IACvB,gBAAgB,EAAE,KAAK;IACvB,gBAAgB,EAAE,MAAM;IACxB,gBAAgB,EAAE,MAAM;IACxB,gBAAgB,EAAE,MAAM;IACxB,gBAAgB,EAAE,MAAM;IACxB,uBAAuB,EAAE,MAAM;IAC/B,kBAAkB,EAAE,OAAO;IAC3B,kBAAkB,EAAE,qEAAqE;IACzF,mBAAmB,EAAE,mCAAmC;IACxD,mBAAmB,EAAE,qCAAqC;IAC1D,oBAAoB,EAAE,OAAO;IAC7B,eAAe,EAAE,OAAO;IACxB,oBAAoB,EAAE,OAAO;IAC7B,eAAe,EAAE,4BAA4B;CAC9C,CAAA;AAED,gEAAgE;AAChE,MAAM,CAAC,MAAM,aAAa,GAAG,0FAA0F,CAAA;AAEvH,iEAAiE;AACjE,MAAM,CAAC,MAAM,eAAe,GAAG,qIAAqI,CAAA;AAEpK;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAMxB;IACH,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,iCAAiC,EAAE,YAAY,EAAE,0JAA0J,EAAE;IACrR,EAAE,MAAM,EAAE,wBAAwB,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,uCAAuC,EAAE,YAAY,EAAE,0JAA0J,EAAE;CAClS,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface BadgeRootOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Pin a layout. Unset, the stylesheet decides: a bottom sheet under 520px,
|
|
4
|
+
* floating panels above it. `phone` and `desktop` override that, which is
|
|
5
|
+
* how the gallery shows a phone frame on a desktop screen.
|
|
6
|
+
*/
|
|
7
|
+
layout?: "phone" | "desktop";
|
|
8
|
+
/** Show the touch affordances (the bubble's x) whatever the pointer is. */
|
|
9
|
+
touch?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Position against the nearest positioned ancestor instead of the viewport.
|
|
12
|
+
* For a preview frame; the badge itself leaves this off.
|
|
13
|
+
*/
|
|
14
|
+
contained?: boolean;
|
|
15
|
+
/** Extra attributes, already escaped. */
|
|
16
|
+
attrs?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The badge root, `.cgb`: where the token values are declared and the host
|
|
20
|
+
* page's inherited styles stop. A fixed full-viewport layer that lets clicks
|
|
21
|
+
* through everywhere except on its own children.
|
|
22
|
+
*/
|
|
23
|
+
export declare function badgeRoot(inner: string, { layout, touch, contained, attrs }?: BadgeRootOptions): string;
|
|
24
|
+
//# sourceMappingURL=root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/badge/root.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC5B,2EAA2E;IAC3E,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,KAAa,EAAE,SAAiB,EAAE,KAAU,EAAE,GAAE,gBAAqB,GAAG,MAAM,CAKhI"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { esc } from "./html.js";
|
|
2
|
+
/**
|
|
3
|
+
* The badge root, `.cgb`: where the token values are declared and the host
|
|
4
|
+
* page's inherited styles stop. A fixed full-viewport layer that lets clicks
|
|
5
|
+
* through everywhere except on its own children.
|
|
6
|
+
*/
|
|
7
|
+
export function badgeRoot(inner, { layout, touch = false, contained = false, attrs = "" } = {}) {
|
|
8
|
+
return (`<div class="cgb"${layout ? ` data-cgb-layout="${esc(layout)}"` : ""}${touch ? " data-cgb-touch" : ""}` +
|
|
9
|
+
`${contained ? " data-cgb-contained" : ""}${attrs ? ` ${attrs}` : ""}>${inner}</div>`);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/badge/root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAoB/B;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa,EAAE,EAAE,MAAM,EAAE,KAAK,GAAG,KAAK,EAAE,SAAS,GAAG,KAAK,EAAE,KAAK,GAAG,EAAE,KAAuB,EAAE;IACtH,OAAO,CACL,mBAAmB,MAAM,CAAC,CAAC,CAAC,qBAAqB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE;QACvG,GAAG,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,QAAQ,CACtF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builders both panels use: the panel frame, the Select look, the switch row.
|
|
3
|
+
*
|
|
4
|
+
* Behaviour is the badge's, not this module's. Every interactive element
|
|
5
|
+
* carries a `data-action` (and where it matters a `data-value`) so the badge
|
|
6
|
+
* can wire one delegated listener per panel, and the ARIA state the badge must
|
|
7
|
+
* keep in step (`aria-checked`, `aria-expanded`, `aria-selected`) is rendered
|
|
8
|
+
* here so the first paint is already correct.
|
|
9
|
+
*/
|
|
10
|
+
export type BadgeSide = "right" | "left";
|
|
11
|
+
export interface PanelOptions {
|
|
12
|
+
/** The dialog's accessible name. */
|
|
13
|
+
label: string;
|
|
14
|
+
/** The panel's body: one step's markup. */
|
|
15
|
+
body: string;
|
|
16
|
+
/** `right` / `left`: beside the owner tab. `corner`: above the bubble. On a phone every panel is a bottom sheet. */
|
|
17
|
+
side?: BadgeSide | "corner";
|
|
18
|
+
/** The close button's name. */
|
|
19
|
+
closeLabel?: string;
|
|
20
|
+
/** Extra attributes for the panel element, already escaped. */
|
|
21
|
+
attrs?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The panel frame: the wordmark, a close button, then the step. A phone layout
|
|
25
|
+
* also needs `scrim()` behind it, as a sibling, which the badge closes on tap.
|
|
26
|
+
*/
|
|
27
|
+
export declare function panel({ label, body, side, closeLabel, attrs }: PanelOptions): string;
|
|
28
|
+
/** The phone layout's dimmer behind a bottom sheet. Hidden on desktop by the stylesheet. */
|
|
29
|
+
export declare const scrim: () => string;
|
|
30
|
+
export interface SelectOption {
|
|
31
|
+
value: string;
|
|
32
|
+
label: string;
|
|
33
|
+
}
|
|
34
|
+
export interface SelectOptions {
|
|
35
|
+
/** The trigger's and the list's accessible name. */
|
|
36
|
+
label: string;
|
|
37
|
+
options: readonly SelectOption[];
|
|
38
|
+
value: string;
|
|
39
|
+
/** `data-action` on the trigger; each option carries `data-action="<action>-pick"`. Default `select`. */
|
|
40
|
+
action?: string;
|
|
41
|
+
/** Render the list open, as the badge does after a click on the trigger. */
|
|
42
|
+
open?: boolean;
|
|
43
|
+
/** Extra attributes for the wrapper, already escaped. */
|
|
44
|
+
attrs?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Select's look (`ui/select.tsx`): a 32px trigger with a chevron, and a list
|
|
48
|
+
* that opens with the selected option laid over the trigger, as Select's
|
|
49
|
+
* `alignItemWithTrigger` places it. Items are 30px, so the offset is exact.
|
|
50
|
+
*/
|
|
51
|
+
export declare function select({ label, options, value, action, open, attrs }: SelectOptions): string;
|
|
52
|
+
/** A switch: `role="switch"` with `aria-checked`, the library Switch's 32x18 track. */
|
|
53
|
+
export declare function switchControl(label: string, checked: boolean, action: string, labelled?: boolean): string;
|
|
54
|
+
/** A one-line row: a text label and a switch at the end. The whole row is the switch's label. */
|
|
55
|
+
export declare function toggleRow(label: string, checked: boolean, action: string, cls?: string): string;
|
|
56
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/badge/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;AAExC,MAAM,WAAW,YAAY;IAC3B,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,oHAAoH;IACpH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;IAC3B,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAc,EAAE,UAAoB,EAAE,KAAU,EAAE,EAAE,YAAY,GAAG,MAAM,CAO7G;AAED,4FAA4F;AAC5F,eAAO,MAAM,KAAK,QAAO,MAAgF,CAAA;AAEzG,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,SAAS,YAAY,EAAE,CAAA;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,yGAAyG;IACzG,MAAM,CAAC,EAAE,MAAM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