@g9tm/lynxcontrols 2.5.9 → 2.5.11

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.
Files changed (60) hide show
  1. package/catalog/cards/G9Anchor.md +1 -1
  2. package/catalog/cards/G9AppearancePage.md +2 -2
  3. package/catalog/cards/G9ContrastPanel.md +1 -0
  4. package/catalog/cards/G9DesignNode.md +1 -1
  5. package/catalog/cards/G9Keycap.md +1 -1
  6. package/catalog/cards/G9PersonalThemeSheet.md +3 -3
  7. package/catalog/cards/G9ShortcutList.md +1 -1
  8. package/catalog/cards/G9SwipeView.md +1 -1
  9. package/catalog/cards/G9ThemePreviewCard.md +1 -0
  10. package/catalog/cards/G9ThemeTokenEditor.md +17 -0
  11. package/catalog/cards/G9WallpaperSwatch.md +2 -1
  12. package/catalog/catalog.json +1172 -224
  13. package/catalog/index.md +2 -1
  14. package/dist/.tsbuildinfo +1 -1
  15. package/dist/appearance/appearance.css +201 -0
  16. package/dist/appearance/appearance.css.map +1 -1
  17. package/dist/appearance/appearance.d.ts +75 -9
  18. package/dist/appearance/appearance.d.ts.map +1 -1
  19. package/dist/appearance/appearance.jsx +333 -56
  20. package/dist/appearance/index.d.ts +1 -0
  21. package/dist/appearance/index.d.ts.map +1 -1
  22. package/dist/appearance/index.jsx +1 -0
  23. package/dist/appearance/token-editor.d.ts +52 -0
  24. package/dist/appearance/token-editor.d.ts.map +1 -0
  25. package/dist/appearance/token-editor.jsx +205 -0
  26. package/dist/display/theme-preview.d.ts +2 -0
  27. package/dist/display/theme-preview.d.ts.map +1 -1
  28. package/dist/display/theme-preview.jsx +10 -4
  29. package/dist/provider/provider.d.ts.map +1 -1
  30. package/dist/provider/provider.jsx +3 -2
  31. package/dist/swipe/index.d.ts +1 -1
  32. package/dist/swipe/index.d.ts.map +1 -1
  33. package/dist/swipe/index.jsx +1 -1
  34. package/dist/swipe/model.d.ts +7 -0
  35. package/dist/swipe/model.d.ts.map +1 -1
  36. package/dist/swipe/model.jsx +8 -1
  37. package/dist/swipe/swipe-view.d.ts +7 -0
  38. package/dist/swipe/swipe-view.d.ts.map +1 -1
  39. package/dist/swipe/swipe-view.jsx +34 -6
  40. package/package.json +2 -2
  41. package/skills/g9-lynx-app/SKILL.md +1 -0
  42. package/skills/g9-lynx-app/references/catalog-index.md +9 -5
  43. package/skills/g9-lynx-app/references/components/anchor.md +1 -1
  44. package/skills/g9-lynx-app/references/components/appearance.md +26 -6
  45. package/skills/g9-lynx-app/references/components/calendar-1.md +21 -37
  46. package/skills/g9-lynx-app/references/components/calendar-2.md +38 -1
  47. package/skills/g9-lynx-app/references/components/canvas.md +1 -1
  48. package/skills/g9-lynx-app/references/components/chat-1.md +58 -61
  49. package/skills/g9-lynx-app/references/components/chat-2.md +111 -34
  50. package/skills/g9-lynx-app/references/components/chat-3.md +61 -0
  51. package/skills/g9-lynx-app/references/components/commands.md +1 -1
  52. package/skills/g9-lynx-app/references/components/design.md +1 -1
  53. package/skills/g9-lynx-app/references/components/display-1.md +1 -1
  54. package/skills/g9-lynx-app/references/components/display-3.md +1 -0
  55. package/skills/g9-lynx-app/references/components/media-1.md +75 -77
  56. package/skills/g9-lynx-app/references/components/media-2.md +131 -3
  57. package/skills/g9-lynx-app/references/components/native-media.md +34 -0
  58. package/skills/g9-lynx-app/references/components/projects.md +91 -3
  59. package/skills/g9-lynx-app/references/components/swipe.md +1 -1
  60. 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
- for (const p of null != (_props_pairs = props.pairs) ? _props_pairs : []){
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 paint = props.wallpaper ? props.wallpaper.paint(props.palette, props.scheme) : {
147
- color: props.palette.Background
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
- backgroundColor: paint.color,
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(props.bases[0], '');
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,31 @@ 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 named = draft.name.trim().length > 0;
359
+ const save = ()=>{
360
+ var _props_onSave;
361
+ if (!named) return;
362
+ if (tk && tokenTheme) tk.onSave(tokenTheme, {
363
+ ...tokenDraft,
364
+ name: draft.name.trim()
365
+ });
366
+ else null == (_props_onSave = props.onSave) || _props_onSave.call(props, built, {
367
+ ...draft,
368
+ name: draft.name.trim()
369
+ });
370
+ };
371
+ const stored = tk ? void 0 !== tk.draft : void 0 !== props.draft;
372
+ const exportIt = ()=>{
373
+ var _props_onExport;
374
+ if ((null == tk ? void 0 : tk.onExport) && tokenTheme) tk.onExport(tokenTheme, tokenDraft);
375
+ else null == (_props_onExport = props.onExport) || _props_onExport.call(props, built);
376
+ };
253
377
  const label = (text1)=><text className="g9-appearance__label" style={{
254
378
  textAlign: rtl ? 'right' : 'left'
255
379
  }}>
@@ -259,15 +383,12 @@ function G9PersonalThemeSheet(props) {
259
383
  flexDirection: rtl ? 'row-reverse' : 'row',
260
384
  direction: 'ltr'
261
385
  }}>
262
- {props.onDelete && props.draft ? <G9Button id={`${base}_Delete`} text={w.delete} variant="ghost" onPress={()=>{
386
+ {props.onDelete && stored ? <G9Button id={`${base}_Delete`} text={w.delete} variant="ghost" onPress={()=>{
263
387
  var _props_onDelete;
264
388
  return null == (_props_onDelete = props.onDelete) ? void 0 : _props_onDelete.call(props, draft.id);
265
389
  }}/> : null}
266
- {props.onExport ? <G9Button id={`${base}_Export`} text={w.export} variant="outline" onPress={()=>{
267
- var _props_onExport;
268
- return null == (_props_onExport = props.onExport) ? void 0 : _props_onExport.call(props, built);
269
- }}/> : null}
270
- <G9Button id={`${base}_Save`} text={w.save} variant="primary" onPress={()=>props.onSave(built, draft)}/>
390
+ {props.onExport || (null == tk ? void 0 : tk.onExport) ? <G9Button id={`${base}_Export`} text={w.export} variant="outline" onPress={exportIt}/> : null}
391
+ <G9Button id={`${base}_Save`} text={w.save} variant="primary" blocked={!named} onPress={save}/>
271
392
  </view>;
272
393
  return <G9Sheet open={props.open} onOpenChange={(open)=>{
273
394
  if (!open) props.onClose();
@@ -289,7 +410,7 @@ function G9PersonalThemeSheet(props) {
289
410
  flexDirection: rtl ? 'row-reverse' : 'row',
290
411
  direction: 'ltr'
291
412
  }}>
292
- {props.bases.map((b)=><view key={b.id} className="g9-appearance__cell">
413
+ {bases.map((b)=><view key={b.id} className="g9-appearance__cell">
293
414
  <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
415
  update({
295
416
  base: b,
@@ -334,8 +455,8 @@ function G9PersonalThemeSheet(props) {
334
455
  }))} onChange={(surfaces)=>update({
335
456
  surfaces: surfaces
336
457
  })}/>
337
- {label(w.scheme)}
338
- <G9Segmented id={`${base}_Scheme`} size="sm" value={scheme} items={[
458
+ {tk ? null : label(w.scheme)}
459
+ {tk ? null : <G9Segmented id={`${base}_Scheme`} size="sm" value={scheme} items={[
339
460
  {
340
461
  key: 'light',
341
462
  label: w.light
@@ -346,21 +467,26 @@ function G9PersonalThemeSheet(props) {
346
467
  }
347
468
  ]} onChange={(s)=>update({
348
469
  scheme: s
349
- })}/>
470
+ })}/>}
350
471
  {label(w.wallpaper)}
351
472
  <view className="g9-appearance__swatches" style={{
352
473
  flexDirection: rtl ? 'row-reverse' : 'row',
353
474
  direction: 'ltr'
354
475
  }}>
355
476
  <view className="g9-appearance__wall">
356
- <G9WallpaperSwatch id={`${base}_Wall_theme`} wallpaper={null} palette={preview.palette} scheme={scheme} label={w.themeWallpaper} selected={'theme' === draft.wallpaper} onPress={()=>update({
477
+ <G9WallpaperSwatch id={`${base}_Wall_theme`} wallpaper={null} palette={preview.palette} scheme={scheme} {...preview.appTokens ? {
478
+ tokens: preview.appTokens
479
+ } : {}} label={w.themeWallpaper} selected={'theme' === draft.wallpaper} onPress={()=>update({
357
480
  wallpaper: 'theme'
358
481
  })}/>
359
482
  </view>
360
483
  {wallpapers.map((wp)=>{
361
- var _ref, _wp_name_lang;
484
+ var _ref, _ref1;
485
+ var _wp_name, _wp_name1;
362
486
  return <view key={wp.id} className="g9-appearance__wall">
363
- <G9WallpaperSwatch id={`${base}_Wall_${wp.id}`} wallpaper={wp} palette={preview.palette} scheme={scheme} label={null != (_ref = null != (_wp_name_lang = wp.name[lang]) ? _wp_name_lang : wp.name.en) ? _ref : wp.id} selected={draft.wallpaper === wp.id} onPress={()=>update({
487
+ <G9WallpaperSwatch id={`${base}_Wall_${wp.id}`} wallpaper={wp} palette={preview.palette} scheme={scheme} {...preview.appTokens ? {
488
+ tokens: preview.appTokens
489
+ } : {}} 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
490
  wallpaper: wp.id
365
491
  })}/>
366
492
  </view>;
@@ -368,7 +494,9 @@ function G9PersonalThemeSheet(props) {
368
494
  </view>
369
495
  {label(w.preview)}
370
496
  <G9ThemePreviewCard id={`${base}_Preview`} theme={preview} name={draft.name.trim() || themeName(draft.base, lang)}/>
371
- <G9ContrastPanel id={`${base}_Contrast`} palette={preview.palette} onlyFailures onFix={(token, value)=>setFixes((f)=>({
497
+ <G9ContrastPanel id={`${base}_Contrast`} palette={preview.palette} {...preview.appTokens ? {
498
+ appTokens: preview.appTokens
499
+ } : {}} onlyFailures onFix={(token, value)=>setFixes((f)=>({
372
500
  ...f,
373
501
  [token]: value
374
502
  }))} {...(null == (_props_words1 = props.words) ? void 0 : _props_words1.contrast) ? {
@@ -407,7 +535,20 @@ const PAGE_EN = {
407
535
  off: 'Off'
408
536
  },
409
537
  newTheme: 'New theme',
410
- edit: 'Edit'
538
+ edit: 'Edit',
539
+ followDevice: 'Follow the device',
540
+ followHint: 'Light by day, dark at night, as the device switches.',
541
+ importTheme: 'Import a theme',
542
+ exportTheme: 'Export this theme',
543
+ current: 'Current theme',
544
+ accentHex: 'Accent (#rrggbb)',
545
+ effectsReasons: {
546
+ lowEnd: 'Off on this device to keep it smooth.',
547
+ reducedMotion: 'Off because the system reduces motion.',
548
+ setting: ''
549
+ },
550
+ delete: 'Delete',
551
+ export: 'Export'
411
552
  };
412
553
  const ALL = [
413
554
  'mode',
@@ -419,7 +560,7 @@ const ALL = [
419
560
  'effects'
420
561
  ];
421
562
  function G9AppearancePage(props) {
422
- var _props_language, _props_id, _props_themes_find, _props_sections;
563
+ var _props_language, _props_id, _props_themes_find, _ref, _s_accent, _props_sections, _props_extra;
423
564
  var _props_words, _props_words1, _props_words2;
424
565
  const w = {
425
566
  ...PAGE_EN,
@@ -458,13 +599,103 @@ function G9AppearancePage(props) {
458
599
  });
459
600
  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
601
  const currentScheme = (null == current ? void 0 : current.mode) === 'dark' ? 'dark' : following ? props.systemScheme : 'light';
461
- const palette = current ? previewThemeDefinition(current, currentScheme).palette : null;
462
- const title = (text1)=><text className="g9-appearance__label" style={{
602
+ const currentPreview = current ? previewThemeDefinition(current, currentScheme) : null;
603
+ const palette = null != (_ref = null == currentPreview ? void 0 : currentPreview.palette) ? _ref : null;
604
+ const tokensOf = (null == currentPreview ? void 0 : currentPreview.appTokens) ? {
605
+ tokens: currentPreview.appTokens
606
+ } : {};
607
+ const [hexDraft, setHexDraft] = useState(null != (_s_accent = s.accent) ? _s_accent : '');
608
+ useEffect(()=>{
609
+ var _s_accent;
610
+ return setHexDraft(null != (_s_accent = s.accent) ? _s_accent : '');
611
+ }, [
612
+ s.accent
613
+ ]);
614
+ const titleText = (text1)=><text className="g9-appearance__label" style={{
463
615
  textAlign: rtl ? 'right' : 'left'
464
616
  }}>
465
617
  {text1}
466
618
  </text>;
619
+ let drawing = 'mode';
620
+ const title = (text1)=>{
621
+ var _props_descriptions;
622
+ const d = null == (_props_descriptions = props.descriptions) ? void 0 : _props_descriptions[drawing];
623
+ return d ? <>
624
+ {titleText(text1)}
625
+ <text className="g9-appearance__description" style={{
626
+ textAlign: rtl ? 'right' : 'left'
627
+ }}>
628
+ {d}
629
+ </text>
630
+ </> : titleText(text1);
631
+ };
632
+ const personal = (t)=>{
633
+ var _w_export, _w_delete;
634
+ return 'personal' === t.source && (props.onEditTheme || props.onDeleteTheme || props.onExportEach) ? <view className="g9-appearance__files" style={{
635
+ flexDirection: row,
636
+ direction: 'ltr'
637
+ }}>
638
+ {props.onEditTheme && t.recipe ? <view className="g9-appearance__edit" {...g9IdProps(`${base}_Edit_${g9SafeId(t.id)}`)} bindtap={()=>{
639
+ var _props_onEditTheme;
640
+ return null == (_props_onEditTheme = props.onEditTheme) ? void 0 : _props_onEditTheme.call(props, t);
641
+ }} accessibility-element={true} accessibility-traits="button">
642
+ <text className="g9-appearance__link">{w.edit}</text>
643
+ </view> : null}
644
+ {props.onExportEach ? <view className="g9-appearance__edit" {...g9IdProps(`${base}_ExportEach_${g9SafeId(t.id)}`)} bindtap={()=>{
645
+ var _props_onExportEach;
646
+ return null == (_props_onExportEach = props.onExportEach) ? void 0 : _props_onExportEach.call(props, t);
647
+ }} accessibility-element={true} accessibility-traits="button">
648
+ <text className="g9-appearance__link">{null != (_w_export = w.export) ? _w_export : w.exportTheme}</text>
649
+ </view> : null}
650
+ {props.onDeleteTheme ? <view className="g9-appearance__edit" {...g9IdProps(`${base}_Delete_${g9SafeId(t.id)}`)} bindtap={()=>{
651
+ var _props_onDeleteTheme;
652
+ return null == (_props_onDeleteTheme = props.onDeleteTheme) ? void 0 : _props_onDeleteTheme.call(props, t);
653
+ }} accessibility-element={true} accessibility-traits="button">
654
+ <text className="g9-appearance__link g9-appearance__link--danger">{null != (_w_delete = w.delete) ? _w_delete : 'Delete'}</text>
655
+ </view> : null}
656
+ </view> : null;
657
+ };
658
+ const card = (t, tagged)=>{
659
+ var _props_themeHint;
660
+ const hint = null == (_props_themeHint = props.themeHint) ? void 0 : _props_themeHint.call(props, t);
661
+ return <view key={t.id} className="g9-appearance__cell">
662
+ <G9ThemePreviewCard id={`${base}_Theme_${g9SafeId(t.id)}`} theme={previewThemeDefinition(t, modeOf(t))} name={themeName(t, lang)} {...tagged ? {
663
+ tag: 'dark' === modeOf(t) ? w.dark : w.light
664
+ } : {}} {...hint ? {
665
+ hint
666
+ } : {}} selected={chosen(t)} onSelect={()=>pick(t)}/>
667
+ {personal(t)}
668
+ </view>;
669
+ };
467
670
  const sections = {
671
+ preview: ()=>currentPreview && current ? <view key="preview" className="g9-appearance__section">
672
+ {title(w.current)}
673
+ <G9ThemePreviewCard id={`${base}_Current`} theme={currentPreview} name={themeName(current, lang)}/>
674
+ </view> : null,
675
+ follow: ()=><view key="follow" className="g9-appearance__section">
676
+ <view className="g9-appearance__follow" style={{
677
+ flexDirection: row,
678
+ direction: 'ltr'
679
+ }}>
680
+ <view className="g9-appearance__follow-texts">
681
+ <text className="g9-appearance__follow-title" style={{
682
+ textAlign: rtl ? 'right' : 'left'
683
+ }}>
684
+ {w.followDevice}
685
+ </text>
686
+ <text className="g9-appearance__follow-hint" style={{
687
+ textAlign: rtl ? 'right' : 'left'
688
+ }}>
689
+ {w.followHint}
690
+ </text>
691
+ </view>
692
+ <G9Switch id={`${base}_Follow`} checked={following} accessibilityLabel={w.followDevice} onCheckedChange={(on)=>on ? set({
693
+ theme: 'system'
694
+ }) : set({
695
+ theme: 'dark' === props.systemScheme ? s.dark : s.light
696
+ })}/>
697
+ </view>
698
+ </view>,
468
699
  mode: ()=><view key="mode" className="g9-appearance__section">
469
700
  {title(w.follow)}
470
701
  <G9Segmented id={`${base}_Mode`} value={following ? 'system' : current ? modeOf(current) : 'light'} items={[
@@ -488,29 +719,49 @@ function G9AppearancePage(props) {
488
719
  </view>,
489
720
  themes: ()=><view key="themes" className="g9-appearance__section">
490
721
  {title(w.themes)}
722
+ {following && props.groupByScheme ? [
723
+ 'light',
724
+ 'dark'
725
+ ].map((scheme)=><view key={scheme} className="g9-appearance__group">
726
+ <text className="g9-appearance__group-title" style={{
727
+ textAlign: rtl ? 'right' : 'left'
728
+ }}>
729
+ {'dark' === scheme ? w.dark : w.light}
730
+ </text>
731
+ <view className="g9-appearance__grid" style={{
732
+ flexDirection: row,
733
+ direction: 'ltr'
734
+ }}>
735
+ {props.themes.filter((t)=>modeOf(t) === scheme).map((t)=>card(t, false))}
736
+ </view>
737
+ </view>) : null}
491
738
  <view className="g9-appearance__grid" style={{
492
739
  flexDirection: row,
493
740
  direction: 'ltr'
494
741
  }}>
495
- {props.themes.map((t)=><view key={t.id} className="g9-appearance__cell">
496
- <G9ThemePreviewCard id={`${base}_Theme_${g9SafeId(t.id)}`} theme={previewThemeDefinition(t, modeOf(t))} name={themeName(t, lang)} {...following ? {
497
- tag: 'dark' === modeOf(t) ? w.dark : w.light
498
- } : {}} selected={chosen(t)} onSelect={()=>pick(t)}/>
499
- {'personal' === t.source && props.onEditTheme ? <view className="g9-appearance__edit" {...g9IdProps(`${base}_Edit_${g9SafeId(t.id)}`)} bindtap={()=>{
500
- var _props_onEditTheme;
501
- return null == (_props_onEditTheme = props.onEditTheme) ? void 0 : _props_onEditTheme.call(props, t);
502
- }}>
503
- <text className="g9-appearance__link">{w.edit}</text>
504
- </view> : null}
505
- </view>)}
742
+ {following && props.groupByScheme ? null : props.themes.map((t)=>card(t, following))}
506
743
  {props.onCreateTheme ? <view className="g9-appearance__cell g9-appearance__new" {...g9IdProps(`${base}_New`)} bindtap={props.onCreateTheme}>
507
744
  <G9Icon icon="plus" size={20} color="var(--g9-primary)"/>
508
745
  <text className="g9-appearance__link">{w.newTheme}</text>
509
746
  </view> : null}
510
747
  </view>
748
+ {props.onImportTheme || props.onExportTheme && current ? <view className="g9-appearance__files" style={{
749
+ flexDirection: row,
750
+ direction: 'ltr'
751
+ }}>
752
+ {props.onImportTheme ? <view className="g9-appearance__edit" {...g9IdProps(`${base}_Import`)} bindtap={props.onImportTheme} accessibility-element={true} accessibility-traits="button">
753
+ <text className="g9-appearance__link">{w.importTheme}</text>
754
+ </view> : null}
755
+ {props.onExportTheme && current ? <view className="g9-appearance__edit" {...g9IdProps(`${base}_Export`)} bindtap={()=>{
756
+ var _props_onExportTheme;
757
+ return null == (_props_onExportTheme = props.onExportTheme) ? void 0 : _props_onExportTheme.call(props, current);
758
+ }} accessibility-element={true} accessibility-traits="button">
759
+ <text className="g9-appearance__link">{w.exportTheme}</text>
760
+ </view> : null}
761
+ </view> : null}
511
762
  </view>,
512
763
  accent: ()=>{
513
- var _props_accents;
764
+ var _props_accents, _w_accentHex;
514
765
  return <view key="accent" className="g9-appearance__section">
515
766
  {title(w.accent)}
516
767
  <view className="g9-appearance__swatches" style={{
@@ -530,6 +781,16 @@ function G9AppearancePage(props) {
530
781
  })}/>;
531
782
  })}
532
783
  </view>
784
+ {props.accentInput ? <view className="g9-appearance__hex">
785
+ <G9TextEntry id={`${base}_AccentHex`} label={null != (_w_accentHex = w.accentHex) ? _w_accentHex : '#rrggbb'} value={hexDraft} inputTextDirection="leftToRight" {...hexDraft && !/^#[0-9a-fA-F]{6}$/.test(hexDraft) ? {
786
+ hasError: true
787
+ } : {}} onValueChange={(v)=>{
788
+ setHexDraft(v);
789
+ if (/^#[0-9a-fA-F]{6}$/.test(v.trim())) set({
790
+ accent: v.trim().toLowerCase()
791
+ });
792
+ }}/>
793
+ </view> : null}
533
794
  </view>;
534
795
  },
535
796
  wallpaper: ()=>{
@@ -541,14 +802,15 @@ function G9AppearancePage(props) {
541
802
  direction: 'ltr'
542
803
  }}>
543
804
  <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({
805
+ <G9WallpaperSwatch id={`${base}_Wall_theme`} wallpaper={null} palette={palette} scheme={currentScheme} {...tokensOf} label={w.themeWallpaper} selected={'theme' === s.wallpaper} onPress={()=>set({
545
806
  wallpaper: 'theme'
546
807
  })}/>
547
808
  </view>
548
809
  {(null != (_props_wallpapers = props.wallpapers) ? _props_wallpapers : g9Wallpapers).map((wp)=>{
549
- var _ref, _wp_name_lang;
810
+ var _ref, _ref1;
811
+ var _wp_name, _wp_name1;
550
812
  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 != (_wp_name_lang = wp.name[lang]) ? _wp_name_lang : wp.name.en) ? _ref : wp.id} selected={s.wallpaper === wp.id} onPress={()=>set({
813
+ <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
814
  wallpaper: wp.id
553
815
  })}/>
554
816
  </view>;
@@ -570,20 +832,25 @@ function G9AppearancePage(props) {
570
832
  fontScale: k
571
833
  })}/>
572
834
  </view>,
573
- density: ()=><view key="density" className="g9-appearance__section">
835
+ density: ()=>{
836
+ var _props_densities;
837
+ return <view key="density" className="g9-appearance__section">
574
838
  {title(w.density)}
575
- <G9Segmented id={`${base}_Density`} value={s.density} items={[
839
+ <G9Segmented id={`${base}_Density`} value={s.density} items={(null != (_props_densities = props.densities) ? _props_densities : [
576
840
  'compact',
577
841
  'regular',
578
842
  'comfortable'
579
- ].map((k)=>({
843
+ ]).map((k)=>({
580
844
  key: k,
581
845
  label: w.densities[k]
582
846
  }))} onChange={(k)=>set({
583
847
  density: k
584
848
  })}/>
585
- </view>,
586
- effects: ()=><view key="effects" className="g9-appearance__section">
849
+ </view>;
850
+ },
851
+ effects: ()=>{
852
+ var _w_effectsReasons;
853
+ return <view key="effects" className="g9-appearance__section">
587
854
  {title(w.effects)}
588
855
  <G9Segmented id={`${base}_Effects`} value={s.effects} items={[
589
856
  'auto',
@@ -595,10 +862,20 @@ function G9AppearancePage(props) {
595
862
  }))} onChange={(k)=>set({
596
863
  effects: k
597
864
  })}/>
598
- </view>
865
+ {props.effectsReason && 'setting' !== props.effectsReason && (null == (_w_effectsReasons = w.effectsReasons) ? void 0 : _w_effectsReasons[props.effectsReason]) ? <text className="g9-appearance__description" style={{
866
+ textAlign: rtl ? 'right' : 'left'
867
+ }}>
868
+ {w.effectsReasons[props.effectsReason]}
869
+ </text> : null}
870
+ </view>;
871
+ }
599
872
  };
600
873
  return <view className="g9-appearance" {...g9IdProps(props.id)}>
601
- {(null != (_props_sections = props.sections) ? _props_sections : ALL).map((section)=>sections[section]())}
874
+ {(null != (_props_sections = props.sections) ? _props_sections : ALL).map((section)=>{
875
+ drawing = section;
876
+ return sections[section]();
877
+ })}
878
+ {null != (_props_extra = props.extra) ? _props_extra : null}
602
879
  </view>;
603
880
  }
604
881
  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"}
@@ -1 +1,2 @@
1
1
  export { G9AppearancePage, G9ContrastPanel, G9PersonalThemeSheet, G9WallpaperSwatch } from "./appearance.jsx";
2
+ export { G9ThemeTokenEditor } from "./token-editor.jsx";