@g9tm/lynxcontrols 2.5.9 → 2.5.10
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/catalog/cards/G9Anchor.md +1 -1
- package/catalog/cards/G9AppearancePage.md +2 -2
- package/catalog/cards/G9ContrastPanel.md +1 -0
- package/catalog/cards/G9DesignNode.md +1 -1
- package/catalog/cards/G9Keycap.md +1 -1
- package/catalog/cards/G9PersonalThemeSheet.md +3 -3
- package/catalog/cards/G9ShortcutList.md +1 -1
- package/catalog/cards/G9SwipeView.md +1 -1
- package/catalog/cards/G9ThemePreviewCard.md +1 -0
- package/catalog/cards/G9ThemeTokenEditor.md +17 -0
- package/catalog/cards/G9WallpaperSwatch.md +2 -1
- package/catalog/catalog.json +863 -81
- package/catalog/index.md +2 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/appearance/appearance.css +123 -0
- package/dist/appearance/appearance.css.map +1 -1
- package/dist/appearance/appearance.d.ts +46 -9
- package/dist/appearance/appearance.d.ts.map +1 -1
- package/dist/appearance/appearance.jsx +201 -31
- package/dist/appearance/index.d.ts +1 -0
- package/dist/appearance/index.d.ts.map +1 -1
- package/dist/appearance/index.jsx +1 -0
- package/dist/appearance/token-editor.d.ts +38 -0
- package/dist/appearance/token-editor.d.ts.map +1 -0
- package/dist/appearance/token-editor.jsx +170 -0
- package/dist/display/theme-preview.d.ts +2 -0
- package/dist/display/theme-preview.d.ts.map +1 -1
- package/dist/display/theme-preview.jsx +10 -4
- package/dist/provider/provider.d.ts.map +1 -1
- package/dist/provider/provider.jsx +3 -2
- package/dist/swipe/model.d.ts +7 -0
- package/dist/swipe/model.d.ts.map +1 -1
- package/dist/swipe/model.jsx +8 -1
- package/dist/swipe/swipe-view.d.ts +7 -0
- package/dist/swipe/swipe-view.d.ts.map +1 -1
- package/dist/swipe/swipe-view.jsx +34 -6
- package/package.json +2 -2
- package/skills/g9-lynx-app/SKILL.md +1 -0
- package/skills/g9-lynx-app/references/catalog-index.md +9 -5
- package/skills/g9-lynx-app/references/components/anchor.md +1 -1
- package/skills/g9-lynx-app/references/components/appearance.md +26 -6
- package/skills/g9-lynx-app/references/components/calendar-1.md +21 -37
- package/skills/g9-lynx-app/references/components/calendar-2.md +38 -1
- package/skills/g9-lynx-app/references/components/canvas.md +1 -1
- package/skills/g9-lynx-app/references/components/chat-1.md +58 -61
- package/skills/g9-lynx-app/references/components/chat-2.md +110 -34
- package/skills/g9-lynx-app/references/components/chat-3.md +50 -0
- package/skills/g9-lynx-app/references/components/commands.md +1 -1
- package/skills/g9-lynx-app/references/components/design.md +1 -1
- package/skills/g9-lynx-app/references/components/display-1.md +1 -1
- package/skills/g9-lynx-app/references/components/display-3.md +1 -0
- package/skills/g9-lynx-app/references/components/media-1.md +75 -77
- package/skills/g9-lynx-app/references/components/media-2.md +131 -3
- package/skills/g9-lynx-app/references/components/native-media.md +16 -0
- package/skills/g9-lynx-app/references/components/projects.md +91 -3
- package/skills/g9-lynx-app/references/components/swipe.md +1 -1
- package/skills/g9-lynx-app/references/hosting.md +83 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { contrastReport, ensureContrast, g9AccentPresets, g9BuildPersonalTheme, g9PersonalDraft, g9Wallpapers, getContrastRatio, previewThemeDefinition, recipePalettes, themeName, toHex, tryParseColor } from "@g9tm/lynxcontrols-foundation";
|
|
1
|
+
import { contrastReport, ensureContrast, g9AccentPresets, g9BackgroundStyle, g9BuildPersonalTheme, g9BuildTokenPersonalTheme, g9NewPersonalThemeId, g9PersonalDraft, g9ThemeFromTokens, g9TokenForPalette, g9Wallpapers, getContrastRatio, previewThemeDefinition, recipePalettes, themeName, toHex, tryParseColor } from "@g9tm/lynxcontrols-foundation";
|
|
2
2
|
import { useEffect, useMemo, useState } from "@lynx-js/react";
|
|
3
3
|
import { g9IdProps, g9SafeId } from "../base/control.jsx";
|
|
4
4
|
import { G9Button } from "../button/button.jsx";
|
|
@@ -8,6 +8,7 @@ import { G9Icon } from "../icon/icon.jsx";
|
|
|
8
8
|
import { useG9Direction } from "../provider/hooks.jsx";
|
|
9
9
|
import { G9Sheet } from "../sheet/sheet.jsx";
|
|
10
10
|
import { G9Segmented } from "../toggle/choice.jsx";
|
|
11
|
+
import { G9Switch } from "../toggle/switch.jsx";
|
|
11
12
|
import "./appearance.css";
|
|
12
13
|
const CONTRAST_EN = {
|
|
13
14
|
title: 'Contrast',
|
|
@@ -18,6 +19,12 @@ const CONTRAST_EN = {
|
|
|
18
19
|
unknown: 'Cannot be measured',
|
|
19
20
|
pair: (fg, bg)=>`${fg} / ${bg}`
|
|
20
21
|
};
|
|
22
|
+
function firstColour(value) {
|
|
23
|
+
var _exec;
|
|
24
|
+
if (!value) return;
|
|
25
|
+
if (tryParseColor(value)) return value;
|
|
26
|
+
return null == (_exec = /#[0-9a-f]{3,8}\b|rgba?\([^()]*\)/i.exec(value)) ? void 0 : _exec[0];
|
|
27
|
+
}
|
|
21
28
|
function G9ContrastPanel(props) {
|
|
22
29
|
const w = {
|
|
23
30
|
...CONTRAST_EN,
|
|
@@ -26,7 +33,7 @@ function G9ContrastPanel(props) {
|
|
|
26
33
|
const rtl = 'rtl' === useG9Direction();
|
|
27
34
|
const row = rtl ? 'row-reverse' : 'row';
|
|
28
35
|
const rows = useMemo(()=>{
|
|
29
|
-
var _props_pairs;
|
|
36
|
+
var _t_bubbleminetext, _firstColour, _t_bubbleothertext, _firstColour1, _props_pairs;
|
|
30
37
|
const out = contrastReport(props.palette, props.rules).map((r)=>({
|
|
31
38
|
key: `${r.foreground}-${r.background}`,
|
|
32
39
|
label: w.pair(r.foreground, r.background),
|
|
@@ -37,7 +44,27 @@ function G9ContrastPanel(props) {
|
|
|
37
44
|
required: r.required,
|
|
38
45
|
ratio: r.ratio
|
|
39
46
|
}));
|
|
40
|
-
|
|
47
|
+
const t = props.appTokens;
|
|
48
|
+
const bubbles = t ? [
|
|
49
|
+
{
|
|
50
|
+
key: 'bubble-mine-text',
|
|
51
|
+
label: w.pair('bubble-mine-text', 'bubble-mine'),
|
|
52
|
+
foreground: null != (_t_bubbleminetext = t['bubble-mine-text']) ? _t_bubbleminetext : '',
|
|
53
|
+
background: null != (_firstColour = firstColour(t['bubble-mine'])) ? _firstColour : '',
|
|
54
|
+
required: 4.5
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
key: 'bubble-other-text',
|
|
58
|
+
label: w.pair('bubble-other-text', 'bubble-other'),
|
|
59
|
+
foreground: null != (_t_bubbleothertext = t['bubble-other-text']) ? _t_bubbleothertext : '',
|
|
60
|
+
background: null != (_firstColour1 = firstColour(t['bubble-other'])) ? _firstColour1 : '',
|
|
61
|
+
required: 4.5
|
|
62
|
+
}
|
|
63
|
+
].filter((p)=>p.foreground && p.background) : [];
|
|
64
|
+
for (const p of [
|
|
65
|
+
...bubbles,
|
|
66
|
+
...null != (_props_pairs = props.pairs) ? _props_pairs : []
|
|
67
|
+
]){
|
|
41
68
|
const a = tryParseColor(p.foreground);
|
|
42
69
|
const b = tryParseColor(p.background);
|
|
43
70
|
out.push({
|
|
@@ -55,7 +82,8 @@ function G9ContrastPanel(props) {
|
|
|
55
82
|
}, [
|
|
56
83
|
props.palette,
|
|
57
84
|
props.rules,
|
|
58
|
-
props.pairs
|
|
85
|
+
props.pairs,
|
|
86
|
+
props.appTokens
|
|
59
87
|
]);
|
|
60
88
|
const shown = props.onlyFailures ? rows.filter((r)=>!(r.ratio >= r.required)) : rows;
|
|
61
89
|
const failing = rows.filter((r)=>!Number.isNaN(r.ratio) && r.ratio < r.required).length;
|
|
@@ -140,21 +168,43 @@ function Grade(props) {
|
|
|
140
168
|
<text className="g9-contrast__grade-text">{props.label}</text>
|
|
141
169
|
</view>;
|
|
142
170
|
}
|
|
171
|
+
function paletteTokens(p) {
|
|
172
|
+
return {
|
|
173
|
+
bg: p.Background,
|
|
174
|
+
surface: p.Surface,
|
|
175
|
+
accent: p.Primary,
|
|
176
|
+
'accent-2': p.Secondary,
|
|
177
|
+
'accent-3': p.Tertiary,
|
|
178
|
+
'aurora-1': p.Secondary,
|
|
179
|
+
'aurora-2': p.Primary,
|
|
180
|
+
'aurora-3': p.Tertiary,
|
|
181
|
+
text: p.TextPrimary
|
|
182
|
+
};
|
|
183
|
+
}
|
|
143
184
|
function G9WallpaperSwatch(props) {
|
|
144
185
|
var _ref, _props_label, _props_height;
|
|
145
186
|
var _props_wallpaper;
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
187
|
+
const wp = props.wallpaper;
|
|
188
|
+
const style = wp && 'css' in wp ? g9BackgroundStyle(wp.css(props.scheme), {
|
|
189
|
+
...paletteTokens(props.palette),
|
|
190
|
+
...props.tokens
|
|
191
|
+
}) : (()=>{
|
|
192
|
+
const paint = wp ? wp.paint(props.palette, props.scheme) : {
|
|
193
|
+
color: props.palette.Background
|
|
194
|
+
};
|
|
195
|
+
return {
|
|
196
|
+
backgroundColor: paint.color,
|
|
197
|
+
...paint.image ? {
|
|
198
|
+
backgroundImage: paint.image
|
|
199
|
+
} : {}
|
|
200
|
+
};
|
|
201
|
+
})();
|
|
149
202
|
return <view className={props.selected ? 'g9-wallpaper g9-wallpaper--on' : 'g9-wallpaper'} {...g9IdProps(props.id)} accessibility-element={true} accessibility-label={null != (_ref = null != (_props_label = props.label) ? _props_label : null == (_props_wallpaper = props.wallpaper) ? void 0 : _props_wallpaper.id) ? _ref : ''} accessibility-traits={props.selected ? 'selected' : 'button'} {...props.onPress ? {
|
|
150
203
|
bindtap: props.onPress
|
|
151
204
|
} : {}}>
|
|
152
205
|
<view className={props.selected ? 'g9-wallpaper__paint g9-wallpaper__paint--on' : 'g9-wallpaper__paint'} style={{
|
|
153
206
|
height: `${null != (_props_height = props.height) ? _props_height : 56}px`,
|
|
154
|
-
|
|
155
|
-
...paint.image ? {
|
|
156
|
-
backgroundImage: paint.image
|
|
157
|
-
} : {}
|
|
207
|
+
...style
|
|
158
208
|
}}>
|
|
159
209
|
{props.selected ? <view className="g9-wallpaper__check">
|
|
160
210
|
<G9Icon icon="check" size={14} color="var(--g9-on-primary)"/>
|
|
@@ -187,7 +237,7 @@ const PERSONAL_EN = {
|
|
|
187
237
|
export: 'Export'
|
|
188
238
|
};
|
|
189
239
|
function G9PersonalThemeSheet(props) {
|
|
190
|
-
var _props_language, _props_id, _draft_scheme, _props_accents, _props_wallpapers;
|
|
240
|
+
var _props_language, _props_id, _props_bases, _draft_scheme, _props_accents, _tk_wallpapers, _props_wallpapers;
|
|
191
241
|
var _props_words, _props_words1;
|
|
192
242
|
const w = {
|
|
193
243
|
...PERSONAL_EN,
|
|
@@ -200,9 +250,27 @@ function G9PersonalThemeSheet(props) {
|
|
|
200
250
|
const lang = null != (_props_language = props.language) ? _props_language : 'en';
|
|
201
251
|
const rtl = 'rtl' === useG9Direction();
|
|
202
252
|
const base = null != (_props_id = props.id) ? _props_id : 'G9PersonalTheme';
|
|
253
|
+
const tk = props.tokens;
|
|
254
|
+
const tokenBases = useMemo(()=>tk ? tk.builtins.map((t)=>g9ThemeFromTokens(t, {
|
|
255
|
+
...tk.options,
|
|
256
|
+
source: 'builtin'
|
|
257
|
+
})) : [], [
|
|
258
|
+
null == tk ? void 0 : tk.builtins
|
|
259
|
+
]);
|
|
260
|
+
const bases = tk ? tokenBases : null != (_props_bases = props.bases) ? _props_bases : [];
|
|
203
261
|
const fresh = ()=>{
|
|
204
262
|
var _props_draft;
|
|
205
|
-
return null != (_props_draft = props.draft) ? _props_draft : g9PersonalDraft(
|
|
263
|
+
if (!tk) return null != (_props_draft = props.draft) ? _props_draft : g9PersonalDraft(bases[0], '');
|
|
264
|
+
const d = tk.draft;
|
|
265
|
+
const from = d && tokenBases.find((b)=>b.id === d.base) || tokenBases[0];
|
|
266
|
+
return d ? {
|
|
267
|
+
id: d.id,
|
|
268
|
+
name: d.name,
|
|
269
|
+
base: from,
|
|
270
|
+
accent: d.accent,
|
|
271
|
+
surfaces: d.surfaces,
|
|
272
|
+
wallpaper: d.wallpaper
|
|
273
|
+
} : g9PersonalDraft(from, '', g9NewPersonalThemeId());
|
|
206
274
|
};
|
|
207
275
|
const [draft, setDraft] = useState(fresh);
|
|
208
276
|
const [fixes, setFixes] = useState({});
|
|
@@ -223,9 +291,45 @@ function G9PersonalThemeSheet(props) {
|
|
|
223
291
|
}));
|
|
224
292
|
setFixes({});
|
|
225
293
|
};
|
|
226
|
-
const scheme = null != (_draft_scheme = draft.scheme) ? _draft_scheme : 'dark' === draft.base.mode ? 'dark' : 'light';
|
|
294
|
+
const scheme = tk ? 'dark' === draft.base.mode ? 'dark' : 'light' : null != (_draft_scheme = draft.scheme) ? _draft_scheme : 'dark' === draft.base.mode ? 'dark' : 'light';
|
|
295
|
+
const tokenDraft = {
|
|
296
|
+
id: draft.id,
|
|
297
|
+
name: draft.name,
|
|
298
|
+
base: draft.base.id,
|
|
299
|
+
accent: draft.accent,
|
|
300
|
+
surfaces: draft.surfaces,
|
|
301
|
+
wallpaper: draft.wallpaper
|
|
302
|
+
};
|
|
303
|
+
const tokenTheme = useMemo(()=>{
|
|
304
|
+
var _tk_wallpapers;
|
|
305
|
+
if (!tk) return null;
|
|
306
|
+
const t = g9BuildTokenPersonalTheme(tokenDraft, tk.builtins, {
|
|
307
|
+
...tk.options,
|
|
308
|
+
wallpapers: null != (_tk_wallpapers = tk.wallpapers) ? _tk_wallpapers : []
|
|
309
|
+
});
|
|
310
|
+
const fixed = {};
|
|
311
|
+
for (const [token, value] of Object.entries(fixes)){
|
|
312
|
+
const name = g9TokenForPalette(token);
|
|
313
|
+
if (name && value) fixed[name] = value;
|
|
314
|
+
}
|
|
315
|
+
return Object.keys(fixed).length ? {
|
|
316
|
+
...t,
|
|
317
|
+
tokens: {
|
|
318
|
+
...t.tokens,
|
|
319
|
+
...fixed
|
|
320
|
+
}
|
|
321
|
+
} : t;
|
|
322
|
+
}, [
|
|
323
|
+
tk,
|
|
324
|
+
draft,
|
|
325
|
+
fixes
|
|
326
|
+
]);
|
|
227
327
|
const built = useMemo(()=>{
|
|
228
328
|
var _theme_overrides;
|
|
329
|
+
if (tokenTheme) return g9ThemeFromTokens(tokenTheme, {
|
|
330
|
+
...null == tk ? void 0 : tk.options,
|
|
331
|
+
source: 'personal'
|
|
332
|
+
});
|
|
229
333
|
const palettes = recipePalettes(draft.base.recipe, {
|
|
230
334
|
...draft.base.brand,
|
|
231
335
|
primary: tryParseColor(draft.accent) ? draft.accent : draft.base.brand.primary
|
|
@@ -245,11 +349,17 @@ function G9PersonalThemeSheet(props) {
|
|
|
245
349
|
}, [
|
|
246
350
|
draft,
|
|
247
351
|
fixes,
|
|
248
|
-
scheme
|
|
352
|
+
scheme,
|
|
353
|
+
tokenTheme
|
|
249
354
|
]);
|
|
250
355
|
const preview = previewThemeDefinition(built, scheme);
|
|
251
356
|
const accents = null != (_props_accents = props.accents) ? _props_accents : g9AccentPresets;
|
|
252
|
-
const wallpapers = null != (_props_wallpapers = props.wallpapers) ? _props_wallpapers : g9Wallpapers;
|
|
357
|
+
const wallpapers = tk ? null != (_tk_wallpapers = tk.wallpapers) ? _tk_wallpapers : [] : null != (_props_wallpapers = props.wallpapers) ? _props_wallpapers : g9Wallpapers;
|
|
358
|
+
const save = ()=>{
|
|
359
|
+
var _props_onSave;
|
|
360
|
+
if (tk && tokenTheme) tk.onSave(tokenTheme, tokenDraft);
|
|
361
|
+
else null == (_props_onSave = props.onSave) || _props_onSave.call(props, built, draft);
|
|
362
|
+
};
|
|
253
363
|
const label = (text1)=><text className="g9-appearance__label" style={{
|
|
254
364
|
textAlign: rtl ? 'right' : 'left'
|
|
255
365
|
}}>
|
|
@@ -267,7 +377,7 @@ function G9PersonalThemeSheet(props) {
|
|
|
267
377
|
var _props_onExport;
|
|
268
378
|
return null == (_props_onExport = props.onExport) ? void 0 : _props_onExport.call(props, built);
|
|
269
379
|
}}/> : null}
|
|
270
|
-
<G9Button id={`${base}_Save`} text={w.save} variant="primary" onPress={
|
|
380
|
+
<G9Button id={`${base}_Save`} text={w.save} variant="primary" onPress={save}/>
|
|
271
381
|
</view>;
|
|
272
382
|
return <G9Sheet open={props.open} onOpenChange={(open)=>{
|
|
273
383
|
if (!open) props.onClose();
|
|
@@ -289,7 +399,7 @@ function G9PersonalThemeSheet(props) {
|
|
|
289
399
|
flexDirection: rtl ? 'row-reverse' : 'row',
|
|
290
400
|
direction: 'ltr'
|
|
291
401
|
}}>
|
|
292
|
-
{
|
|
402
|
+
{bases.map((b)=><view key={b.id} className="g9-appearance__cell">
|
|
293
403
|
<G9ThemePreviewCard id={`${base}_Base_${g9SafeId(b.id)}`} theme={previewThemeDefinition(b, 'dark' === b.mode ? 'dark' : 'light')} name={themeName(b, lang)} selected={b.id === draft.base.id} onSelect={()=>{
|
|
294
404
|
update({
|
|
295
405
|
base: b,
|
|
@@ -334,8 +444,8 @@ function G9PersonalThemeSheet(props) {
|
|
|
334
444
|
}))} onChange={(surfaces)=>update({
|
|
335
445
|
surfaces: surfaces
|
|
336
446
|
})}/>
|
|
337
|
-
{label(w.scheme)}
|
|
338
|
-
<G9Segmented id={`${base}_Scheme`} size="sm" value={scheme} items={[
|
|
447
|
+
{tk ? null : label(w.scheme)}
|
|
448
|
+
{tk ? null : <G9Segmented id={`${base}_Scheme`} size="sm" value={scheme} items={[
|
|
339
449
|
{
|
|
340
450
|
key: 'light',
|
|
341
451
|
label: w.light
|
|
@@ -346,21 +456,26 @@ function G9PersonalThemeSheet(props) {
|
|
|
346
456
|
}
|
|
347
457
|
]} onChange={(s)=>update({
|
|
348
458
|
scheme: s
|
|
349
|
-
})}/>
|
|
459
|
+
})}/>}
|
|
350
460
|
{label(w.wallpaper)}
|
|
351
461
|
<view className="g9-appearance__swatches" style={{
|
|
352
462
|
flexDirection: rtl ? 'row-reverse' : 'row',
|
|
353
463
|
direction: 'ltr'
|
|
354
464
|
}}>
|
|
355
465
|
<view className="g9-appearance__wall">
|
|
356
|
-
<G9WallpaperSwatch id={`${base}_Wall_theme`} wallpaper={null} palette={preview.palette} scheme={scheme}
|
|
466
|
+
<G9WallpaperSwatch id={`${base}_Wall_theme`} wallpaper={null} palette={preview.palette} scheme={scheme} {...preview.appTokens ? {
|
|
467
|
+
tokens: preview.appTokens
|
|
468
|
+
} : {}} label={w.themeWallpaper} selected={'theme' === draft.wallpaper} onPress={()=>update({
|
|
357
469
|
wallpaper: 'theme'
|
|
358
470
|
})}/>
|
|
359
471
|
</view>
|
|
360
472
|
{wallpapers.map((wp)=>{
|
|
361
|
-
var _ref,
|
|
473
|
+
var _ref, _ref1;
|
|
474
|
+
var _wp_name, _wp_name1;
|
|
362
475
|
return <view key={wp.id} className="g9-appearance__wall">
|
|
363
|
-
<G9WallpaperSwatch id={`${base}_Wall_${wp.id}`} wallpaper={wp} palette={preview.palette} scheme={scheme}
|
|
476
|
+
<G9WallpaperSwatch id={`${base}_Wall_${wp.id}`} wallpaper={wp} palette={preview.palette} scheme={scheme} {...preview.appTokens ? {
|
|
477
|
+
tokens: preview.appTokens
|
|
478
|
+
} : {}} label={null != (_ref = null != (_ref1 = null == (_wp_name = wp.name) ? void 0 : _wp_name[lang]) ? _ref1 : null == (_wp_name1 = wp.name) ? void 0 : _wp_name1.en) ? _ref : wp.id} selected={draft.wallpaper === wp.id} onPress={()=>update({
|
|
364
479
|
wallpaper: wp.id
|
|
365
480
|
})}/>
|
|
366
481
|
</view>;
|
|
@@ -368,7 +483,9 @@ function G9PersonalThemeSheet(props) {
|
|
|
368
483
|
</view>
|
|
369
484
|
{label(w.preview)}
|
|
370
485
|
<G9ThemePreviewCard id={`${base}_Preview`} theme={preview} name={draft.name.trim() || themeName(draft.base, lang)}/>
|
|
371
|
-
<G9ContrastPanel id={`${base}_Contrast`} palette={preview.palette}
|
|
486
|
+
<G9ContrastPanel id={`${base}_Contrast`} palette={preview.palette} {...preview.appTokens ? {
|
|
487
|
+
appTokens: preview.appTokens
|
|
488
|
+
} : {}} onlyFailures onFix={(token, value)=>setFixes((f)=>({
|
|
372
489
|
...f,
|
|
373
490
|
[token]: value
|
|
374
491
|
}))} {...(null == (_props_words1 = props.words) ? void 0 : _props_words1.contrast) ? {
|
|
@@ -407,7 +524,12 @@ const PAGE_EN = {
|
|
|
407
524
|
off: 'Off'
|
|
408
525
|
},
|
|
409
526
|
newTheme: 'New theme',
|
|
410
|
-
edit: 'Edit'
|
|
527
|
+
edit: 'Edit',
|
|
528
|
+
followDevice: 'Follow the device',
|
|
529
|
+
followHint: 'Light by day, dark at night, as the device switches.',
|
|
530
|
+
importTheme: 'Import a theme',
|
|
531
|
+
exportTheme: 'Export this theme',
|
|
532
|
+
current: 'Current theme'
|
|
411
533
|
};
|
|
412
534
|
const ALL = [
|
|
413
535
|
'mode',
|
|
@@ -419,7 +541,7 @@ const ALL = [
|
|
|
419
541
|
'effects'
|
|
420
542
|
];
|
|
421
543
|
function G9AppearancePage(props) {
|
|
422
|
-
var _props_language, _props_id, _props_themes_find, _props_sections;
|
|
544
|
+
var _props_language, _props_id, _props_themes_find, _ref, _props_sections, _props_extra;
|
|
423
545
|
var _props_words, _props_words1, _props_words2;
|
|
424
546
|
const w = {
|
|
425
547
|
...PAGE_EN,
|
|
@@ -458,13 +580,45 @@ function G9AppearancePage(props) {
|
|
|
458
580
|
});
|
|
459
581
|
const current = null != (_props_themes_find = props.themes.find((t)=>t.id === (following ? 'dark' === props.systemScheme ? s.dark : s.light : s.theme))) ? _props_themes_find : props.themes[0];
|
|
460
582
|
const currentScheme = (null == current ? void 0 : current.mode) === 'dark' ? 'dark' : following ? props.systemScheme : 'light';
|
|
461
|
-
const
|
|
583
|
+
const currentPreview = current ? previewThemeDefinition(current, currentScheme) : null;
|
|
584
|
+
const palette = null != (_ref = null == currentPreview ? void 0 : currentPreview.palette) ? _ref : null;
|
|
585
|
+
const tokensOf = (null == currentPreview ? void 0 : currentPreview.appTokens) ? {
|
|
586
|
+
tokens: currentPreview.appTokens
|
|
587
|
+
} : {};
|
|
462
588
|
const title = (text1)=><text className="g9-appearance__label" style={{
|
|
463
589
|
textAlign: rtl ? 'right' : 'left'
|
|
464
590
|
}}>
|
|
465
591
|
{text1}
|
|
466
592
|
</text>;
|
|
467
593
|
const sections = {
|
|
594
|
+
preview: ()=>currentPreview && current ? <view key="preview" className="g9-appearance__section">
|
|
595
|
+
{title(w.current)}
|
|
596
|
+
<G9ThemePreviewCard id={`${base}_Current`} theme={currentPreview} name={themeName(current, lang)}/>
|
|
597
|
+
</view> : null,
|
|
598
|
+
follow: ()=><view key="follow" className="g9-appearance__section">
|
|
599
|
+
<view className="g9-appearance__follow" style={{
|
|
600
|
+
flexDirection: row,
|
|
601
|
+
direction: 'ltr'
|
|
602
|
+
}}>
|
|
603
|
+
<view className="g9-appearance__follow-texts">
|
|
604
|
+
<text className="g9-appearance__follow-title" style={{
|
|
605
|
+
textAlign: rtl ? 'right' : 'left'
|
|
606
|
+
}}>
|
|
607
|
+
{w.followDevice}
|
|
608
|
+
</text>
|
|
609
|
+
<text className="g9-appearance__follow-hint" style={{
|
|
610
|
+
textAlign: rtl ? 'right' : 'left'
|
|
611
|
+
}}>
|
|
612
|
+
{w.followHint}
|
|
613
|
+
</text>
|
|
614
|
+
</view>
|
|
615
|
+
<G9Switch id={`${base}_Follow`} checked={following} accessibilityLabel={w.followDevice} onCheckedChange={(on)=>on ? set({
|
|
616
|
+
theme: 'system'
|
|
617
|
+
}) : set({
|
|
618
|
+
theme: 'dark' === props.systemScheme ? s.dark : s.light
|
|
619
|
+
})}/>
|
|
620
|
+
</view>
|
|
621
|
+
</view>,
|
|
468
622
|
mode: ()=><view key="mode" className="g9-appearance__section">
|
|
469
623
|
{title(w.follow)}
|
|
470
624
|
<G9Segmented id={`${base}_Mode`} value={following ? 'system' : current ? modeOf(current) : 'light'} items={[
|
|
@@ -508,6 +662,20 @@ function G9AppearancePage(props) {
|
|
|
508
662
|
<text className="g9-appearance__link">{w.newTheme}</text>
|
|
509
663
|
</view> : null}
|
|
510
664
|
</view>
|
|
665
|
+
{props.onImportTheme || props.onExportTheme && current ? <view className="g9-appearance__files" style={{
|
|
666
|
+
flexDirection: row,
|
|
667
|
+
direction: 'ltr'
|
|
668
|
+
}}>
|
|
669
|
+
{props.onImportTheme ? <view className="g9-appearance__edit" {...g9IdProps(`${base}_Import`)} bindtap={props.onImportTheme} accessibility-element={true} accessibility-traits="button">
|
|
670
|
+
<text className="g9-appearance__link">{w.importTheme}</text>
|
|
671
|
+
</view> : null}
|
|
672
|
+
{props.onExportTheme && current ? <view className="g9-appearance__edit" {...g9IdProps(`${base}_Export`)} bindtap={()=>{
|
|
673
|
+
var _props_onExportTheme;
|
|
674
|
+
return null == (_props_onExportTheme = props.onExportTheme) ? void 0 : _props_onExportTheme.call(props, current);
|
|
675
|
+
}} accessibility-element={true} accessibility-traits="button">
|
|
676
|
+
<text className="g9-appearance__link">{w.exportTheme}</text>
|
|
677
|
+
</view> : null}
|
|
678
|
+
</view> : null}
|
|
511
679
|
</view>,
|
|
512
680
|
accent: ()=>{
|
|
513
681
|
var _props_accents;
|
|
@@ -541,14 +709,15 @@ function G9AppearancePage(props) {
|
|
|
541
709
|
direction: 'ltr'
|
|
542
710
|
}}>
|
|
543
711
|
<view className="g9-appearance__wall">
|
|
544
|
-
<G9WallpaperSwatch id={`${base}_Wall_theme`} wallpaper={null} palette={palette} scheme={currentScheme} label={w.themeWallpaper} selected={'theme' === s.wallpaper} onPress={()=>set({
|
|
712
|
+
<G9WallpaperSwatch id={`${base}_Wall_theme`} wallpaper={null} palette={palette} scheme={currentScheme} {...tokensOf} label={w.themeWallpaper} selected={'theme' === s.wallpaper} onPress={()=>set({
|
|
545
713
|
wallpaper: 'theme'
|
|
546
714
|
})}/>
|
|
547
715
|
</view>
|
|
548
716
|
{(null != (_props_wallpapers = props.wallpapers) ? _props_wallpapers : g9Wallpapers).map((wp)=>{
|
|
549
|
-
var _ref,
|
|
717
|
+
var _ref, _ref1;
|
|
718
|
+
var _wp_name, _wp_name1;
|
|
550
719
|
return <view key={wp.id} className="g9-appearance__wall">
|
|
551
|
-
<G9WallpaperSwatch id={`${base}_Wall_${wp.id}`} wallpaper={wp} palette={palette} scheme={currentScheme} label={null != (_ref = null != (
|
|
720
|
+
<G9WallpaperSwatch id={`${base}_Wall_${wp.id}`} wallpaper={wp} palette={palette} scheme={currentScheme} {...tokensOf} label={null != (_ref = null != (_ref1 = null == (_wp_name = wp.name) ? void 0 : _wp_name[lang]) ? _ref1 : null == (_wp_name1 = wp.name) ? void 0 : _wp_name1.en) ? _ref : wp.id} selected={s.wallpaper === wp.id} onPress={()=>set({
|
|
552
721
|
wallpaper: wp.id
|
|
553
722
|
})}/>
|
|
554
723
|
</view>;
|
|
@@ -599,6 +768,7 @@ function G9AppearancePage(props) {
|
|
|
599
768
|
};
|
|
600
769
|
return <view className="g9-appearance" {...g9IdProps(props.id)}>
|
|
601
770
|
{(null != (_props_sections = props.sections) ? _props_sections : ALL).map((section)=>sections[section]())}
|
|
771
|
+
{null != (_props_extra = props.extra) ? _props_extra : null}
|
|
602
772
|
</view>;
|
|
603
773
|
}
|
|
604
774
|
export { G9AppearancePage, G9ContrastPanel, G9PersonalThemeSheet, G9WallpaperSwatch };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { G9AppearancePage, type G9AppearancePageProps, type G9AppearanceSection, type G9AppearanceWords, type G9ContrastPair, G9ContrastPanel, type G9ContrastPanelProps, type G9ContrastWords, G9PersonalThemeSheet, type G9PersonalThemeSheetProps, type G9PersonalThemeWords, G9WallpaperSwatch, type G9WallpaperSwatchProps, } from './appearance.js';
|
|
2
|
+
export { G9ThemeTokenEditor, type G9ThemeTokenEditorProps, type G9ThemeTokenEditorWords } from './token-editor.js';
|
|
2
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/appearance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/appearance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,KAAK,uBAAuB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import './appearance.css';
|
|
2
|
+
import { type G9ColorScheme, type G9ThemeTokens, type G9TokenTheme, type G9TokenThemeOptions } from '@g9tm/lynxcontrols-foundation';
|
|
3
|
+
import { type ReactNode } from '@lynx-js/react';
|
|
4
|
+
import { type G9ContrastWords } from './appearance.js';
|
|
5
|
+
/** The words of {@link G9ThemeTokenEditor}. */
|
|
6
|
+
export interface G9ThemeTokenEditorWords {
|
|
7
|
+
readonly name?: string;
|
|
8
|
+
readonly scheme?: string;
|
|
9
|
+
readonly light?: string;
|
|
10
|
+
readonly dark?: string;
|
|
11
|
+
readonly changedOnly?: string;
|
|
12
|
+
readonly reset?: string;
|
|
13
|
+
readonly invalid?: string;
|
|
14
|
+
readonly preview?: string;
|
|
15
|
+
/** A group's title by its id (`surfaces`, `text`, `accent`, `chat`, `status`, `depth`, `shape`, `motion`). */
|
|
16
|
+
readonly groups?: Readonly<Partial<Record<string, string>>>;
|
|
17
|
+
readonly contrast?: G9ContrastWords;
|
|
18
|
+
}
|
|
19
|
+
/** Props of {@link G9ThemeTokenEditor}. */
|
|
20
|
+
export interface G9ThemeTokenEditorProps {
|
|
21
|
+
readonly id?: string;
|
|
22
|
+
/** The theme being edited (its tokens list only what it changes). */
|
|
23
|
+
readonly value: G9TokenTheme;
|
|
24
|
+
readonly onChange: (theme: G9TokenTheme) => void;
|
|
25
|
+
/** What each scheme inherits (G9Hub SCHEME_DEFAULTS): the fields' placeholders and the preview's fallbacks. */
|
|
26
|
+
readonly inherited?: Readonly<Partial<Record<G9ColorScheme, G9ThemeTokens>>>;
|
|
27
|
+
/** How the preview reads the theme (base shape and motion, the recipe). */
|
|
28
|
+
readonly options?: G9TokenThemeOptions;
|
|
29
|
+
/** The token list's height (dp). Default 480. */
|
|
30
|
+
readonly listHeight?: number;
|
|
31
|
+
/** A virtual list (default true); false draws every row in a scroll view (a short «changed only» list). */
|
|
32
|
+
readonly virtual?: boolean;
|
|
33
|
+
readonly language?: string;
|
|
34
|
+
readonly words?: G9ThemeTokenEditorWords;
|
|
35
|
+
}
|
|
36
|
+
/** The organisation theme editor: name, scheme, a row per token, a live preview and its contrast. */
|
|
37
|
+
export declare function G9ThemeTokenEditor(props: G9ThemeTokenEditorProps): ReactNode;
|
|
38
|
+
//# sourceMappingURL=token-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-editor.d.ts","sourceRoot":"","sources":["../../src/appearance/token-editor.tsx"],"names":[],"mappings":"AAKA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,aAAa,EAGlB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EAQzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,gBAAgB,CAAC;AASnE,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAErE,+CAA+C;AAC/C,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,8GAA8G;IAC9G,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAC5D,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC;CACrC;AAaD,2CAA2C;AAC3C,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACjD,+GAA+G;IAC/G,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC7E,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC;IACvC,iDAAiD;IACjD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,2GAA2G;IAC3G,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,uBAAuB,CAAC;CAC1C;AAMD,qGAAqG;AACrG,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,SAAS,CA0J5E"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import "./appearance.css";
|
|
2
|
+
import { g9BackgroundStyle, g9ResolveThemeTokens, g9ThemeFromTokens, g9ThemeTokenGroups, g9TokenForPalette, g9TokenValueValid, previewThemeDefinition } from "@g9tm/lynxcontrols-foundation";
|
|
3
|
+
import { useMemo, useState } from "@lynx-js/react";
|
|
4
|
+
import { g9IdProps, g9SafeId } from "../base/control.jsx";
|
|
5
|
+
import { G9IconButton } from "../button/icon-button.jsx";
|
|
6
|
+
import { G9ThemePreviewCard } from "../display/theme-preview.jsx";
|
|
7
|
+
import { G9TextEntry } from "../fields/text-entry.jsx";
|
|
8
|
+
import { G9VirtualList } from "../list/virtual-list.jsx";
|
|
9
|
+
import { useG9Direction, useG9Layout } from "../provider/hooks.jsx";
|
|
10
|
+
import { G9Segmented } from "../toggle/choice.jsx";
|
|
11
|
+
import { G9Switch } from "../toggle/switch.jsx";
|
|
12
|
+
import { G9ContrastPanel } from "./appearance.jsx";
|
|
13
|
+
const EN = {
|
|
14
|
+
name: 'Name',
|
|
15
|
+
scheme: 'Scheme',
|
|
16
|
+
light: 'Light',
|
|
17
|
+
dark: 'Dark',
|
|
18
|
+
changedOnly: 'Changed only',
|
|
19
|
+
reset: 'Reset to inherited',
|
|
20
|
+
invalid: 'Not a valid value',
|
|
21
|
+
preview: 'Preview'
|
|
22
|
+
};
|
|
23
|
+
function G9ThemeTokenEditor(props) {
|
|
24
|
+
var _props_id, _ref, _theme_name_, _props_language, _props_listHeight, _theme_name_1, _props_language1;
|
|
25
|
+
var _props_inherited, _props_words;
|
|
26
|
+
const w = {
|
|
27
|
+
...EN,
|
|
28
|
+
...props.words
|
|
29
|
+
};
|
|
30
|
+
const rtl = 'rtl' === useG9Direction();
|
|
31
|
+
const { wide } = useG9Layout();
|
|
32
|
+
const base = null != (_props_id = props.id) ? _props_id : 'G9TokenEditor';
|
|
33
|
+
const [changedOnly, setChangedOnly] = useState(false);
|
|
34
|
+
const theme = props.value;
|
|
35
|
+
const inherited = null != (_ref = null == (_props_inherited = props.inherited) ? void 0 : _props_inherited[theme.scheme]) ? _ref : {};
|
|
36
|
+
const options = {
|
|
37
|
+
...props.options,
|
|
38
|
+
...props.inherited ? {
|
|
39
|
+
defaults: props.inherited
|
|
40
|
+
} : {}
|
|
41
|
+
};
|
|
42
|
+
const resolved = useMemo(()=>g9ResolveThemeTokens(theme, options), [
|
|
43
|
+
theme,
|
|
44
|
+
props.inherited,
|
|
45
|
+
props.options
|
|
46
|
+
]);
|
|
47
|
+
const preview = useMemo(()=>previewThemeDefinition(g9ThemeFromTokens(theme, options), theme.scheme), [
|
|
48
|
+
theme,
|
|
49
|
+
props.inherited,
|
|
50
|
+
props.options
|
|
51
|
+
]);
|
|
52
|
+
const own = theme.tokens;
|
|
53
|
+
const setToken = (name, value)=>{
|
|
54
|
+
const next = {
|
|
55
|
+
...theme.tokens
|
|
56
|
+
};
|
|
57
|
+
if (null !== value && value.trim()) next[name] = value;
|
|
58
|
+
else delete next[name];
|
|
59
|
+
props.onChange({
|
|
60
|
+
...theme,
|
|
61
|
+
tokens: next
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const items = useMemo(()=>{
|
|
65
|
+
const out = [];
|
|
66
|
+
for (const g of g9ThemeTokenGroups){
|
|
67
|
+
const tokens = g.tokens.filter((t)=>!changedOnly || void 0 !== own[t]);
|
|
68
|
+
if (tokens.length) {
|
|
69
|
+
out.push({
|
|
70
|
+
kind: 'group',
|
|
71
|
+
id: g.id
|
|
72
|
+
});
|
|
73
|
+
for (const t of tokens)out.push({
|
|
74
|
+
kind: 'token',
|
|
75
|
+
name: t,
|
|
76
|
+
group: g.id
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
}, [
|
|
82
|
+
changedOnly,
|
|
83
|
+
theme.tokens
|
|
84
|
+
]);
|
|
85
|
+
const row = {
|
|
86
|
+
flexDirection: rtl ? 'row-reverse' : 'row',
|
|
87
|
+
direction: 'ltr'
|
|
88
|
+
};
|
|
89
|
+
const align = {
|
|
90
|
+
textAlign: rtl ? 'right' : 'left'
|
|
91
|
+
};
|
|
92
|
+
const renderItem = (item)=>{
|
|
93
|
+
var _ref, _own_name, _resolved_name, _ref1, _inherited_name;
|
|
94
|
+
var _props_words_groups, _props_words;
|
|
95
|
+
if ('group' === item.kind) return <text className="g9-token-editor__group" style={align}>
|
|
96
|
+
{null != (_ref = null == (_props_words = props.words) ? void 0 : null == (_props_words_groups = _props_words.groups) ? void 0 : _props_words_groups[item.id]) ? _ref : item.id}
|
|
97
|
+
</text>;
|
|
98
|
+
const name = item.name;
|
|
99
|
+
const value = null != (_own_name = own[name]) ? _own_name : '';
|
|
100
|
+
const valid = g9TokenValueValid(name, value);
|
|
101
|
+
const shown = null != (_resolved_name = resolved[name]) ? _resolved_name : '';
|
|
102
|
+
const swatch = shown ? g9BackgroundStyle(shown, resolved) : {
|
|
103
|
+
backgroundColor: 'transparent'
|
|
104
|
+
};
|
|
105
|
+
const pid = `${base}_${g9SafeId(name)}`;
|
|
106
|
+
const head = <view className="g9-token-editor__head" style={row}>
|
|
107
|
+
<view className="g9-token-editor__swatch" style={swatch}/>
|
|
108
|
+
<text className="g9-token-editor__name g9-token-editor__mono" text-maxline="1" style={align}>
|
|
109
|
+
{name}
|
|
110
|
+
</text>
|
|
111
|
+
{void 0 !== own[name] ? <G9IconButton id={`${pid}_Reset`} icon="close" isGhost buttonSize={32} accessibilityText={w.reset} onPress={()=>setToken(name, null)}/> : null}
|
|
112
|
+
</view>;
|
|
113
|
+
const field = <view className="g9-token-editor__field">
|
|
114
|
+
<G9TextEntry id={`${pid}_Value`} value={value} placeholder={null != (_ref1 = null != (_inherited_name = inherited[name]) ? _inherited_name : resolved[name]) ? _ref1 : ''} inputTextDirection="leftToRight" hasError={!valid} {...!valid ? {
|
|
115
|
+
errorText: w.invalid
|
|
116
|
+
} : {}} accessibilityLabel={name} onValueChange={(v)=>setToken(name, v)}/>
|
|
117
|
+
</view>;
|
|
118
|
+
return <view className={wide ? 'g9-token-editor__row g9-token-editor__row--wide' : 'g9-token-editor__row'} style={wide ? row : {}} {...g9IdProps(pid)}>
|
|
119
|
+
{head}
|
|
120
|
+
{field}
|
|
121
|
+
</view>;
|
|
122
|
+
};
|
|
123
|
+
return <view className="g9-token-editor" {...g9IdProps(props.id)}>
|
|
124
|
+
<G9TextEntry id={`${base}_Name`} label={w.name} value={'string' == typeof theme.name ? theme.name : null != (_theme_name_ = theme.name[null != (_props_language = props.language) ? _props_language : 'en']) ? _theme_name_ : ''} maxLength={60} onValueChange={(name)=>props.onChange({
|
|
125
|
+
...theme,
|
|
126
|
+
name
|
|
127
|
+
})}/>
|
|
128
|
+
<view className="g9-token-editor__bar" style={row}>
|
|
129
|
+
<G9Segmented id={`${base}_Scheme`} size="sm" value={theme.scheme} items={[
|
|
130
|
+
{
|
|
131
|
+
key: 'light',
|
|
132
|
+
label: w.light
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
key: 'dark',
|
|
136
|
+
label: w.dark
|
|
137
|
+
}
|
|
138
|
+
]} onChange={(s)=>props.onChange({
|
|
139
|
+
...theme,
|
|
140
|
+
scheme: s
|
|
141
|
+
})}/>
|
|
142
|
+
<view className="g9-token-editor__filter" style={row}>
|
|
143
|
+
<text className="g9-token-editor__filter-text">{w.changedOnly}</text>
|
|
144
|
+
<G9Switch id={`${base}_Changed`} checked={changedOnly} accessibilityLabel={w.changedOnly} onCheckedChange={setChangedOnly}/>
|
|
145
|
+
</view>
|
|
146
|
+
</view>
|
|
147
|
+
<view className="g9-token-editor__list" style={{
|
|
148
|
+
height: `${null != (_props_listHeight = props.listHeight) ? _props_listHeight : 480}px`
|
|
149
|
+
}}>
|
|
150
|
+
{false === props.virtual ? <scroll-view className="g9-token-editor__scroll" scroll-orientation="vertical">
|
|
151
|
+
{items.map((it)=><view key={'group' === it.kind ? `g:${it.id}` : `t:${it.name}`}>{renderItem(it)}</view>)}
|
|
152
|
+
</scroll-view> : <G9VirtualList {...props.id ? {
|
|
153
|
+
id: `${props.id}_List`
|
|
154
|
+
} : {}} items={items} getKey={(it)=>'group' === it.kind ? `g:${it.id}` : `t:${it.name}`} estimatedSize={(it)=>'group' === it.kind ? 32 : wide ? 64 : 112} renderItem={renderItem}/>}
|
|
155
|
+
</view>
|
|
156
|
+
<text className="g9-token-editor__group" style={align}>
|
|
157
|
+
{w.preview}
|
|
158
|
+
</text>
|
|
159
|
+
<G9ThemePreviewCard id={`${base}_Preview`} theme={preview} name={'string' == typeof theme.name ? theme.name : null != (_theme_name_1 = theme.name[null != (_props_language1 = props.language) ? _props_language1 : 'en']) ? _theme_name_1 : theme.id}/>
|
|
160
|
+
<G9ContrastPanel id={`${base}_Contrast`} palette={preview.palette} {...preview.appTokens ? {
|
|
161
|
+
appTokens: preview.appTokens
|
|
162
|
+
} : {}} onlyFailures onFix={(token, value)=>{
|
|
163
|
+
var _g9TokenForPalette;
|
|
164
|
+
return setToken(null != (_g9TokenForPalette = g9TokenForPalette(token)) ? _g9TokenForPalette : token, value);
|
|
165
|
+
}} {...(null == (_props_words = props.words) ? void 0 : _props_words.contrast) ? {
|
|
166
|
+
words: props.words.contrast
|
|
167
|
+
} : {}}/>
|
|
168
|
+
</view>;
|
|
169
|
+
}
|
|
170
|
+
export { G9ThemeTokenEditor };
|
|
@@ -13,6 +13,8 @@ export interface G9ThemePreviewCardProps {
|
|
|
13
13
|
readonly selected?: boolean;
|
|
14
14
|
readonly onSelect?: () => void;
|
|
15
15
|
readonly className?: string;
|
|
16
|
+
/** Beside the name in the foot (2.5.10: a themes page's «default» tag or its menu button). */
|
|
17
|
+
readonly trailing?: ReactNode;
|
|
16
18
|
}
|
|
17
19
|
/** A card showing a theme as a small app (rail, two chat bubbles, a field), its name, and a check when chosen. */
|
|
18
20
|
export declare function G9ThemePreviewCard(props: G9ThemePreviewCardProps): ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-preview.d.ts","sourceRoot":"","sources":["../../src/display/theme-preview.tsx"],"names":[],"mappings":"AAIA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"theme-preview.d.ts","sourceRoot":"","sources":["../../src/display/theme-preview.tsx"],"names":[],"mappings":"AAIA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,eAAe,EAKrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,SAAS,EAAgC,MAAM,gBAAgB,CAAC;AAQ9E,2CAA2C;AAC3C,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,8FAA8F;IAC9F,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B;AAED,kHAAkH;AAClH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,SAAS,CAuF5E"}
|