@sveltia/ui 0.11.1 → 0.12.1

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 (90) hide show
  1. package/package/components/button/button.svelte +4 -1
  2. package/package/components/button/button.svelte.d.ts +4 -4
  3. package/package/components/button/select-button-group.svelte.d.ts +4 -4
  4. package/package/components/button/select-button.svelte.d.ts +4 -4
  5. package/package/components/button/split-button.svelte +2 -5
  6. package/package/components/button/split-button.svelte.d.ts +4 -4
  7. package/package/components/calendar/calendar.svelte +1 -1
  8. package/package/components/checkbox/checkbox.svelte +2 -2
  9. package/package/components/checkbox/checkbox.svelte.d.ts +6 -6
  10. package/package/components/dialog/dialog.svelte +2 -2
  11. package/package/components/dialog/dialog.svelte.d.ts +2 -2
  12. package/package/components/dialog/prompt-dialog.svelte +7 -1
  13. package/package/components/dialog/prompt-dialog.svelte.d.ts +2 -0
  14. package/package/components/disclosure/disclosure.svelte +2 -2
  15. package/package/components/disclosure/disclosure.svelte.d.ts +2 -2
  16. package/package/components/drawer/drawer.svelte +2 -2
  17. package/package/components/drawer/drawer.svelte.d.ts +2 -2
  18. package/package/components/grid/grid-body.svelte +2 -2
  19. package/package/components/grid/grid.svelte.d.ts +2 -2
  20. package/package/components/icon/icon.svelte +6 -0
  21. package/package/components/listbox/listbox.svelte.d.ts +8 -8
  22. package/package/components/listbox/option-group.svelte +2 -2
  23. package/package/components/listbox/option-group.svelte.d.ts +2 -2
  24. package/package/components/menu/menu-button.svelte +0 -8
  25. package/package/components/menu/menu-button.svelte.d.ts +4 -4
  26. package/package/components/menu/menu-item-checkbox.svelte.d.ts +4 -4
  27. package/package/components/menu/menu-item-group.svelte +2 -2
  28. package/package/components/menu/menu-item-group.svelte.d.ts +2 -2
  29. package/package/components/menu/menu-item-radio.svelte.d.ts +4 -4
  30. package/package/components/menu/menu-item.svelte +1 -1
  31. package/package/components/menu/menu-item.svelte.d.ts +2 -2
  32. package/package/components/radio/radio-group.svelte.d.ts +4 -4
  33. package/package/components/radio/radio.svelte +2 -2
  34. package/package/components/radio/radio.svelte.d.ts +4 -4
  35. package/package/components/select/combobox.svelte +3 -3
  36. package/package/components/select/combobox.svelte.d.ts +4 -4
  37. package/package/components/select/select.svelte.d.ts +4 -4
  38. package/package/components/slider/slider.svelte +1 -1
  39. package/package/components/slider/slider.svelte.d.ts +8 -8
  40. package/package/components/switch/switch.svelte.d.ts +6 -6
  41. package/package/components/table/table-body.svelte +2 -2
  42. package/package/components/tabs/tab-list.svelte +1 -1
  43. package/package/components/text-editor/core.d.ts +2 -0
  44. package/package/components/text-editor/core.js +206 -0
  45. package/package/components/text-editor/index.d.ts +23 -0
  46. package/package/components/text-editor/index.js +102 -0
  47. package/package/components/text-editor/lexical-root.svelte +123 -0
  48. package/package/components/text-editor/lexical-root.svelte.d.ts +27 -0
  49. package/package/components/text-editor/text-editor.svelte +154 -0
  50. package/package/components/{text-field/markdown-editor.svelte.d.ts → text-editor/text-editor.svelte.d.ts} +16 -12
  51. package/package/components/text-editor/toolbar/editor-toolbar.svelte +150 -0
  52. package/package/components/text-editor/toolbar/editor-toolbar.svelte.d.ts +25 -0
  53. package/package/components/text-editor/toolbar/format-text-button.svelte +33 -0
  54. package/package/components/text-editor/toolbar/format-text-button.svelte.d.ts +23 -0
  55. package/package/components/text-editor/toolbar/insert-link-button.svelte +231 -0
  56. package/package/components/text-editor/toolbar/insert-link-button.svelte.d.ts +23 -0
  57. package/package/components/text-editor/toolbar/toggle-block-menu-item.svelte +83 -0
  58. package/package/components/text-editor/toolbar/toggle-block-menu-item.svelte.d.ts +23 -0
  59. package/package/components/text-field/number-input.svelte +2 -2
  60. package/package/components/text-field/number-input.svelte.d.ts +10 -10
  61. package/package/components/text-field/password-input.svelte +2 -2
  62. package/package/components/text-field/password-input.svelte.d.ts +4 -4
  63. package/package/components/text-field/search-bar.svelte +3 -3
  64. package/package/components/text-field/search-bar.svelte.d.ts +4 -4
  65. package/package/components/text-field/text-area.svelte +3 -0
  66. package/package/components/text-field/text-area.svelte.d.ts +4 -4
  67. package/package/components/text-field/text-input.svelte +2 -2
  68. package/package/components/text-field/text-input.svelte.d.ts +4 -4
  69. package/package/components/toast/toast.svelte +2 -2
  70. package/package/components/util/app-shell.svelte +56 -4
  71. package/package/components/util/modal.svelte +3 -3
  72. package/package/components/util/modal.svelte.d.ts +4 -4
  73. package/package/components/util/popup.svelte +2 -2
  74. package/package/index.d.ts +1 -2
  75. package/package/index.js +9 -4
  76. package/package/locales/en.d.ts +25 -7
  77. package/package/locales/en.js +25 -6
  78. package/package/locales/ja.d.ts +25 -7
  79. package/package/locales/ja.js +25 -6
  80. package/package/services/events.js +2 -2
  81. package/package/services/group.js +7 -6
  82. package/package/services/popup.js +2 -2
  83. package/package/styles/core.scss +51 -2
  84. package/package/styles/variables.scss +3 -1
  85. package/package/typedef.d.ts +48 -0
  86. package/package/typedef.js +36 -0
  87. package/package.json +22 -18
  88. package/package/components/text-field/markdown-editor.svelte +0 -141
  89. package/package/services/util.d.ts +0 -3
  90. package/package/services/util.js +0 -35
@@ -25,7 +25,7 @@
25
25
  let fontLoader;
26
26
 
27
27
  onMount(() => {
28
- const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
28
+ const mediaQuery = globalThis.matchMedia('(prefers-color-scheme: dark)');
29
29
  const { dataset } = document.documentElement;
30
30
 
31
31
  /**
@@ -44,7 +44,7 @@
44
44
  applyTheme();
45
45
  };
46
46
 
47
- window.setTimeout(() => {
47
+ globalThis.setTimeout(() => {
48
48
  fontLoader?.remove();
49
49
  }, 1000);
50
50
  });
@@ -86,7 +86,7 @@
86
86
  <slot />
87
87
  </div>
88
88
 
89
- <style global>@import url("https://fonts.googleapis.com/css2?family=Merriweather+Sans:ital,wght@0,300;0,600;1,300&family=Noto+Sans+Mono&display=swap");
89
+ <style global>@import url("https://fonts.googleapis.com/css2?family=Merriweather+Sans:ital,wght@0,300;0,600;1,300;1,600&family=Noto+Sans+Mono&display=swap");
90
90
  @import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=block");
91
91
  :global(:root),
92
92
  :global(:host) {
@@ -116,6 +116,7 @@
116
116
  --sui-selected-background-color: hsl(var(--sui-background-color-5-hsl) / 75%);
117
117
  --sui-active-background-color: hsl(var(--sui-background-color-5-hsl) / 100%);
118
118
  --sui-content-background-color: hsl(var(--sui-background-color-1-hsl));
119
+ --sui-code-background-color: hsl(var(--sui-background-color-4-hsl));
119
120
  --sui-primary-background-color: hsl(var(--sui-background-color-2-hsl));
120
121
  --sui-primary-background-color-translucent: hsl(var(--sui-background-color-2-hsl) / 80%);
121
122
  --sui-secondary-background-color: hsl(var(--sui-background-color-3-hsl));
@@ -171,10 +172,11 @@
171
172
  --sui-font-weight-normal: 300;
172
173
  --sui-font-weight-bold: 600;
173
174
  --sui-font-family-monospace: "Noto Sans Mono", monospace;
174
- --sui-font-size-monospace: 12.5px;
175
+ --sui-font-size-monospace: 0.9em;
175
176
  --sui-line-height-default: 1.25;
176
177
  --sui-line-height-compact: 1.5;
177
178
  --sui-line-height-comfortable: 1.75;
179
+ --sui-word-spacing-normal: 0.1ex;
178
180
  --sui-control-small-border-width: 1px;
179
181
  --sui-control-small-border-radius: calc(var(--sui-control-small-height) / 8);
180
182
  --sui-control-small-padding: 0 calc((var(--sui-control-small-height) / 5));
@@ -450,6 +452,31 @@
450
452
  :global(h6) {
451
453
  margin: 0;
452
454
  font-weight: var(--sui-font-weight-bold);
455
+ line-height: var(--sui-line-height-default);
456
+ }
457
+
458
+ :global(h1) {
459
+ font-size: 32px;
460
+ }
461
+
462
+ :global(h2) {
463
+ font-size: 28px;
464
+ }
465
+
466
+ :global(h3) {
467
+ font-size: 24px;
468
+ }
469
+
470
+ :global(h4) {
471
+ font-size: 20px;
472
+ }
473
+
474
+ :global(h5) {
475
+ font-size: 16px;
476
+ }
477
+
478
+ :global(h6) {
479
+ font-size: 12px;
453
480
  }
454
481
 
455
482
  :global(strong) {
@@ -468,16 +495,40 @@
468
495
 
469
496
  :global(code),
470
497
  :global(pre) {
498
+ border-radius: 4px;
499
+ background-color: var(--sui-code-background-color);
471
500
  font-family: var(--sui-font-family-monospace);
472
501
  font-size: var(--sui-font-size-monospace);
502
+ vertical-align: -0.05em;
473
503
  }
474
504
 
475
505
  :global(pre) {
506
+ padding: 8px;
476
507
  line-height: var(--sui-line-height-compact);
477
508
  -webkit-user-select: text;
478
509
  user-select: text;
479
510
  }
480
511
 
512
+ :global(code) {
513
+ padding: 2px 4px;
514
+ }
515
+
516
+ :global(table) {
517
+ border-collapse: collapse;
518
+ }
519
+
520
+ :global(th),
521
+ :global(td) {
522
+ border: 1px solid var(--sui-textbox-border-color);
523
+ padding: 8px;
524
+ }
525
+
526
+ :global(blockquote) {
527
+ margin-left: 16px;
528
+ border-left: 4px solid var(--sui-textbox-border-color);
529
+ padding-left: 12px;
530
+ }
531
+
481
532
  :global(.disabled),
482
533
  :global(.readonly),
483
534
  :global([aria-disabled=true]),
@@ -525,6 +576,7 @@
525
576
  font-family: var(--sui-font-family-default);
526
577
  font-size: var(--sui-font-size-default);
527
578
  font-weight: var(--sui-font-weight-normal);
579
+ word-spacing: var(--sui-word-spacing-normal);
528
580
  -webkit-user-select: none;
529
581
  user-select: none;
530
582
  touch-action: none;
@@ -5,8 +5,8 @@
5
5
  <svelte:options accessors={true} />
6
6
 
7
7
  <script>
8
+ import { sleep } from '@sveltia/utils/misc';
8
9
  import { createEventDispatcher, onMount } from 'svelte';
9
- import { sleep } from '../../services/util';
10
10
 
11
11
  /**
12
12
  * The `class` attribute on the `<dialog>` element.
@@ -145,7 +145,6 @@
145
145
 
146
146
  $: {
147
147
  void open;
148
- void dialog;
149
148
  toggleDialog();
150
149
  }
151
150
 
@@ -180,7 +179,8 @@
180
179
  }}
181
180
  on:cancel|preventDefault={() => {
182
181
  // Escape key is pressed
183
- if (escapeDismiss) {
182
+ if (dialog && escapeDismiss) {
183
+ dialog.returnValue = 'cancel';
184
184
  open = false;
185
185
  }
186
186
  }}
@@ -7,7 +7,7 @@ export default class Modal extends SvelteComponent<{
7
7
  class?: string | undefined;
8
8
  close?: ((returnValue: string) => void) | undefined;
9
9
  dialog?: HTMLDialogElement | undefined;
10
- role?: "dialog" | "none" | "alertdialog" | undefined;
10
+ role?: "dialog" | "alertdialog" | "none" | undefined;
11
11
  open?: boolean | undefined;
12
12
  showBackdrop?: boolean | undefined;
13
13
  lightDismiss?: boolean | undefined;
@@ -29,8 +29,8 @@ export default class Modal extends SvelteComponent<{
29
29
  set class(arg: string | undefined);
30
30
  get class(): string | undefined;
31
31
  /**accessor*/
32
- set role(arg: "dialog" | "none" | "alertdialog" | undefined);
33
- get role(): "dialog" | "none" | "alertdialog" | undefined;
32
+ set role(arg: "dialog" | "alertdialog" | "none" | undefined);
33
+ get role(): "dialog" | "alertdialog" | "none" | undefined;
34
34
  /**accessor*/
35
35
  set open(arg: boolean | undefined);
36
36
  get open(): boolean | undefined;
@@ -60,7 +60,7 @@ declare const __propDef: {
60
60
  class?: string | undefined;
61
61
  close?: ((returnValue: string) => void) | undefined;
62
62
  dialog?: HTMLDialogElement | undefined;
63
- role?: "dialog" | "none" | "alertdialog" | undefined;
63
+ role?: "dialog" | "alertdialog" | "none" | undefined;
64
64
  open?: boolean | undefined;
65
65
  showBackdrop?: boolean | undefined;
66
66
  lightDismiss?: boolean | undefined;
@@ -5,10 +5,10 @@
5
5
  <svelte:options accessors={true} />
6
6
 
7
7
  <script>
8
+ import { sleep } from '@sveltia/utils/misc';
8
9
  import { onMount } from 'svelte';
9
10
  import { writable } from 'svelte/store';
10
11
  import { activatePopup } from '../../services/popup';
11
- import { sleep } from '../../services/util';
12
12
  import Modal from './modal.svelte';
13
13
 
14
14
  /**
@@ -92,7 +92,7 @@
92
92
  $: touch = touchOptimized && touchEnabled;
93
93
 
94
94
  onMount(() => {
95
- touchEnabled = window.matchMedia('(pointer: coarse)').matches;
95
+ touchEnabled = globalThis.matchMedia('(pointer: coarse)').matches;
96
96
  });
97
97
  </script>
98
98
 
@@ -56,7 +56,7 @@ export { default as TabList } from "./components/tabs/tab-list.svelte";
56
56
  export { default as TabPanel } from "./components/tabs/tab-panel.svelte";
57
57
  export { default as TabPanels } from "./components/tabs/tab-panels.svelte";
58
58
  export { default as Tab } from "./components/tabs/tab.svelte";
59
- export { default as MarkdownEditor } from "./components/text-field/markdown-editor.svelte";
59
+ export { default as TextEditor } from "./components/text-editor/text-editor.svelte";
60
60
  export { default as NumberInput } from "./components/text-field/number-input.svelte";
61
61
  export { default as PasswordInput } from "./components/text-field/password-input.svelte";
62
62
  export { default as SearchBar } from "./components/text-field/search-bar.svelte";
@@ -67,4 +67,3 @@ export { default as Toolbar } from "./components/toolbar/toolbar.svelte";
67
67
  export { default as AppShell } from "./components/util/app-shell.svelte";
68
68
  export { default as Group } from "./components/util/group.svelte";
69
69
  export { default as Modal } from "./components/util/modal.svelte";
70
- export * from "./services/util";
package/package/index.js CHANGED
@@ -10,7 +10,14 @@ import { addMessages, init } from 'svelte-i18n';
10
10
  */
11
11
  export const initLocales = ({ fallbackLocale = 'en', initialLocale = 'en' } = {}) => {
12
12
  /** @type {{ [key: string]: { strings: object }}} */
13
- const modules = import.meta.glob('./locales/*.js', { eager: true });
13
+ let modules = import.meta.glob('./locales/*.js', { eager: true });
14
+
15
+ // The file path must be relative during local development, or the import may fail when using
16
+ // `pnpm link -g @sveltia/ui`. On the other hand, it must start with `$lib` when being imported
17
+ // with `pnpm install @sveltia/ui`, otherwise the path cannot be resolved.
18
+ if (!Object.keys(modules).length) {
19
+ modules = import.meta.glob('$lib/locales/*.js', { eager: true });
20
+ }
14
21
 
15
22
  Object.entries(modules).forEach(([path, { strings }]) => {
16
23
  const [, locale] = /** @type {string[]} */ (path.match(/([a-zA-Z-]+)\.js/));
@@ -81,7 +88,7 @@ export { default as TabList } from './components/tabs/tab-list.svelte';
81
88
  export { default as TabPanel } from './components/tabs/tab-panel.svelte';
82
89
  export { default as TabPanels } from './components/tabs/tab-panels.svelte';
83
90
  export { default as Tab } from './components/tabs/tab.svelte';
84
- export { default as MarkdownEditor } from './components/text-field/markdown-editor.svelte';
91
+ export { default as TextEditor } from './components/text-editor/text-editor.svelte';
85
92
  export { default as NumberInput } from './components/text-field/number-input.svelte';
86
93
  export { default as PasswordInput } from './components/text-field/password-input.svelte';
87
94
  export { default as SearchBar } from './components/text-field/search-bar.svelte';
@@ -92,5 +99,3 @@ export { default as Toolbar } from './components/toolbar/toolbar.svelte';
92
99
  export { default as AppShell } from './components/util/app-shell.svelte';
93
100
  export { default as Group } from './components/util/group.svelte';
94
101
  export { default as Modal } from './components/util/modal.svelte';
95
-
96
- export * from './services/util';
@@ -3,6 +3,8 @@ export namespace strings {
3
3
  const cancel: string;
4
4
  const close: string;
5
5
  const clear: string;
6
+ const insert: string;
7
+ const update: string;
6
8
  const remove: string;
7
9
  const collapse: string;
8
10
  const expand: string;
@@ -32,16 +34,32 @@ export namespace strings {
32
34
  const show_password: string;
33
35
  const hide_password: string;
34
36
  }
35
- namespace markdown_editor {
36
- const markdown_editor_1: string;
37
- export { markdown_editor_1 as markdown_editor };
37
+ namespace text_editor {
38
+ const text_editor_1: string;
39
+ export { text_editor_1 as text_editor };
40
+ export const text_style_options: string;
41
+ export const show_text_style_options: string;
42
+ export const paragraph: string;
43
+ export const heading_1: string;
44
+ export const heading_2: string;
45
+ export const heading_3: string;
46
+ export const heading_4: string;
47
+ export const heading_5: string;
48
+ export const heading_6: string;
49
+ export const bulleted_list: string;
50
+ export const numbered_list: string;
51
+ export const blockquote: string;
38
52
  export const bold: string;
39
53
  export const italic: string;
40
54
  export const code: string;
41
55
  export const link: string;
42
- export const heading_x: string;
43
- export const quote: string;
44
- export const bulleted_list: string;
45
- export const numbered_list: string;
56
+ export const insert_link: string;
57
+ export const update_link: string;
58
+ export const text: string;
59
+ export const url: string;
60
+ export const edit_options: string;
61
+ export const show_edit_options: string;
62
+ export const use_rich_text: string;
63
+ export const converter_error: string;
46
64
  }
47
65
  }
@@ -3,6 +3,8 @@ export const strings = {
3
3
  cancel: 'Cancel',
4
4
  close: 'Close',
5
5
  clear: 'Clear',
6
+ insert: 'Insert',
7
+ update: 'Update',
6
8
  remove: 'Remove',
7
9
  collapse: 'Collapse',
8
10
  expand: 'Expand',
@@ -32,15 +34,32 @@ export const strings = {
32
34
  show_password: 'Show Password',
33
35
  hide_password: 'Hide Password',
34
36
  },
35
- markdown_editor: {
36
- markdown_editor: 'Markdown Editor',
37
+ text_editor: {
38
+ text_editor: 'Text Editor',
39
+ text_style_options: 'Text Style Options',
40
+ show_text_style_options: 'Show Text Style Options',
41
+ paragraph: 'Paragraph',
42
+ heading_1: 'Heading 1',
43
+ heading_2: 'Heading 2',
44
+ heading_3: 'Heading 3',
45
+ heading_4: 'Heading 4',
46
+ heading_5: 'Heading 5',
47
+ heading_6: 'Heading 6',
48
+ bulleted_list: 'Bulleted List',
49
+ numbered_list: 'Numbered List',
50
+ blockquote: 'Block Quote',
37
51
  bold: 'Bold',
38
52
  italic: 'Italic',
39
53
  code: 'Code',
40
54
  link: 'Link',
41
- heading_x: 'Heading {level}',
42
- quote: 'Quote',
43
- bulleted_list: 'Bulleted List',
44
- numbered_list: 'Numbered List',
55
+ insert_link: 'Insert Link',
56
+ update_link: 'Update Link',
57
+ text: 'Text',
58
+ url: 'URL',
59
+ edit_options: 'Edit Options',
60
+ show_edit_options: 'Show Edit Options',
61
+ use_rich_text: 'Use Rich Text',
62
+ converter_error:
63
+ 'There was an error while enabling rich text mode. Please use the plain text editor instead.',
45
64
  },
46
65
  };
@@ -3,6 +3,8 @@ export namespace strings {
3
3
  const cancel: string;
4
4
  const close: string;
5
5
  const clear: string;
6
+ const insert: string;
7
+ const update: string;
6
8
  const remove: string;
7
9
  const collapse: string;
8
10
  const expand: string;
@@ -32,16 +34,32 @@ export namespace strings {
32
34
  const show_password: string;
33
35
  const hide_password: string;
34
36
  }
35
- namespace markdown_editor {
36
- const markdown_editor_1: string;
37
- export { markdown_editor_1 as markdown_editor };
37
+ namespace text_editor {
38
+ const text_editor_1: string;
39
+ export { text_editor_1 as text_editor };
40
+ export const text_style_options: string;
41
+ export const show_text_style_options: string;
42
+ export const paragraph: string;
43
+ export const heading_1: string;
44
+ export const heading_2: string;
45
+ export const heading_3: string;
46
+ export const heading_4: string;
47
+ export const heading_5: string;
48
+ export const heading_6: string;
49
+ export const bulleted_list: string;
50
+ export const numbered_list: string;
51
+ export const blockquote: string;
38
52
  export const bold: string;
39
53
  export const italic: string;
40
54
  export const code: string;
41
55
  export const link: string;
42
- export const heading_x: string;
43
- export const quote: string;
44
- export const bulleted_list: string;
45
- export const numbered_list: string;
56
+ export const insert_link: string;
57
+ export const update_link: string;
58
+ export const text: string;
59
+ export const url: string;
60
+ export const edit_options: string;
61
+ export const show_edit_options: string;
62
+ export const use_rich_text: string;
63
+ export const converter_error: string;
46
64
  }
47
65
  }
@@ -3,6 +3,8 @@ export const strings = {
3
3
  cancel: 'キャンセル',
4
4
  close: '閉じる',
5
5
  clear: 'クリア',
6
+ insert: '挿入',
7
+ update: '更新',
6
8
  remove: '削除',
7
9
  collapse: '折り畳む',
8
10
  expand: '広げる',
@@ -32,15 +34,32 @@ export const strings = {
32
34
  show_password: 'パスワードを表示',
33
35
  hide_password: 'パスワードを隠す',
34
36
  },
35
- markdown_editor: {
36
- markdown_editor: 'Markdown エディター',
37
+ text_editor: {
38
+ text_editor: 'テキストエディター',
39
+ text_style_options: 'テキストスタイルオプション',
40
+ show_text_style_options: 'テキストスタイルオプションを表示',
41
+ paragraph: '段落',
42
+ heading_1: '見出し 1',
43
+ heading_2: '見出し 2',
44
+ heading_3: '見出し 3',
45
+ heading_4: '見出し 4',
46
+ heading_5: '見出し 5',
47
+ heading_6: '見出し 6',
48
+ bulleted_list: '番号なしリスト',
49
+ numbered_list: '番号付きリスト',
50
+ blockquote: 'ブロック引用',
37
51
  bold: '太字',
38
52
  italic: '斜体',
39
53
  code: 'コード',
40
54
  link: 'リンク',
41
- heading_x: '見出し {level}',
42
- quote: '引用',
43
- bulleted_list: '番号なしリスト',
44
- numbered_list: '番号付きリスト',
55
+ insert_link: 'リンクを挿入',
56
+ update_link: 'リンクを更新',
57
+ text: 'テキスト',
58
+ url: 'URL',
59
+ edit_options: '編集オプション',
60
+ show_edit_options: '編集オプションを表示',
61
+ use_rich_text: 'リッチテキストを使用',
62
+ converter_error:
63
+ 'リッチテキストモードを有効化中に問題が発生しました。代わりにプレーンテキストエディターを使用してください。',
45
64
  },
46
65
  };
@@ -83,7 +83,7 @@ export const activateKeyShortcuts = (element, shortcuts = '') => {
83
83
  * Remove the event listener.
84
84
  */
85
85
  const removeListener = () => {
86
- window.removeEventListener('keydown', handler);
86
+ globalThis.removeEventListener('keydown', handler);
87
87
  element.removeAttribute('aria-keyshortcuts');
88
88
  };
89
89
 
@@ -96,7 +96,7 @@ export const activateKeyShortcuts = (element, shortcuts = '') => {
96
96
  : undefined;
97
97
 
98
98
  if (platformKeyShortcuts) {
99
- window.addEventListener('keydown', handler);
99
+ globalThis.addEventListener('keydown', handler);
100
100
  element.setAttribute('aria-keyshortcuts', platformKeyShortcuts);
101
101
  }
102
102
  };
@@ -1,4 +1,5 @@
1
- import { getRandomId, sleep } from './util';
1
+ import { generateElementId } from '@sveltia/utils/element';
2
+ import { sleep } from '@sveltia/utils/misc';
2
3
 
3
4
  /**
4
5
  * @type {{ [role: string]: {
@@ -62,7 +63,7 @@ class Group {
62
63
  this.parent = parent;
63
64
  this.role = /** @type {string} */ (parent.getAttribute('role'));
64
65
  this.multi = this.parent.getAttribute('aria-multiselectable') === 'true';
65
- this.id = getRandomId(this.role);
66
+ this.id = generateElementId(this.role);
66
67
  this.parentGroupSelector = `[role="group"], [role="${this.role}"]`;
67
68
 
68
69
  const { orientation, childRoles, childSelectedAttr, focusChild } = config[this.role];
@@ -106,7 +107,7 @@ class Group {
106
107
  controlTarget.setAttribute('aria-hidden', String(!isSelected));
107
108
 
108
109
  if (isSelected) {
109
- window.setTimeout(() => {
110
+ globalThis.setTimeout(() => {
110
111
  try {
111
112
  controlTarget.scrollIntoView({
112
113
  block: 'nearest',
@@ -258,7 +259,7 @@ class Group {
258
259
 
259
260
  if (this.focusChild) {
260
261
  // Wait a bit before the element is rerendered
261
- window.requestAnimationFrame(() => {
262
+ globalThis.requestAnimationFrame(() => {
262
263
  element.tabIndex = isTarget ? 0 : -1;
263
264
 
264
265
  if (isTarget) {
@@ -279,7 +280,7 @@ class Group {
279
280
  controlTarget.setAttribute('aria-hidden', String(!isTarget));
280
281
 
281
282
  if (isTarget) {
282
- window.setTimeout(() => {
283
+ globalThis.setTimeout(() => {
283
284
  try {
284
285
  controlTarget.scrollIntoView({
285
286
  block: 'nearest',
@@ -296,7 +297,7 @@ class Group {
296
297
  if (isTarget) {
297
298
  this.parent.setAttribute('aria-activedescendant', element.id);
298
299
 
299
- window.setTimeout(() => {
300
+ globalThis.setTimeout(() => {
300
301
  try {
301
302
  element.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: 'auto' });
302
303
  } catch {
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable no-nested-ternary */
2
2
 
3
+ import { generateElementId } from '@sveltia/utils/element';
3
4
  import { get, writable } from 'svelte/store';
4
- import { getRandomId } from './util';
5
5
 
6
6
  /**
7
7
  * Implement the popup handler.
@@ -105,7 +105,7 @@ class Popup {
105
105
  this.popupElement = popupElement; // = backdrop
106
106
  this.position = position;
107
107
  this.positionBaseElement = positionBaseElement ?? anchorElement;
108
- this.id = getRandomId('popup');
108
+ this.id = generateElementId('popup');
109
109
 
110
110
  this.anchorElement.setAttribute('aria-controls', this.id);
111
111
  this.popupElement.setAttribute('id', this.id);
@@ -1,7 +1,7 @@
1
1
  @use "variables.scss";
2
2
 
3
- // https://fonts.google.com/share?selection.family=Merriweather%20Sans:ital,wght@0,300;0,600;1,300%7CNoto%20Sans%20Mono
4
- @import url("https://fonts.googleapis.com/css2?family=Merriweather+Sans:ital,wght@0,300;0,600;1,300&family=Noto+Sans+Mono&display=swap");
3
+ // https://fonts.google.com/share?selection.family=Merriweather+Sans:ital,wght@0,300;0,600;1,300;1,600|Noto+Sans+Mono
4
+ @import url("https://fonts.googleapis.com/css2?family=Merriweather+Sans:ital,wght@0,300;0,600;1,300;1,600&family=Noto+Sans+Mono&display=swap");
5
5
  // https://fonts.google.com/icons?icon.set=Material+Symbols
6
6
  // Use `font-display: block;` @see https://stackoverflow.com/q/41710834
7
7
  @import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=block");
@@ -61,6 +61,31 @@ h5,
61
61
  h6 {
62
62
  margin: 0;
63
63
  font-weight: var(--sui-font-weight-bold);
64
+ line-height: var(--sui-line-height-default);
65
+ }
66
+
67
+ h1 {
68
+ font-size: 32px;
69
+ }
70
+
71
+ h2 {
72
+ font-size: 28px;
73
+ }
74
+
75
+ h3 {
76
+ font-size: 24px;
77
+ }
78
+
79
+ h4 {
80
+ font-size: 20px;
81
+ }
82
+
83
+ h5 {
84
+ font-size: 16px;
85
+ }
86
+
87
+ h6 {
88
+ font-size: 12px;
64
89
  }
65
90
 
66
91
  strong {
@@ -79,16 +104,40 @@ li {
79
104
 
80
105
  code,
81
106
  pre {
107
+ border-radius: 4px;
108
+ background-color: var(--sui-code-background-color);
82
109
  font-family: var(--sui-font-family-monospace);
83
110
  font-size: var(--sui-font-size-monospace);
111
+ vertical-align: -0.05em;
84
112
  }
85
113
 
86
114
  pre {
115
+ padding: 8px;
87
116
  line-height: var(--sui-line-height-compact);
88
117
  -webkit-user-select: text;
89
118
  user-select: text;
90
119
  }
91
120
 
121
+ code {
122
+ padding: 2px 4px;
123
+ }
124
+
125
+ table {
126
+ border-collapse: collapse;
127
+ }
128
+
129
+ th,
130
+ td {
131
+ border: 1px solid var(--sui-textbox-border-color);
132
+ padding: 8px;
133
+ }
134
+
135
+ blockquote {
136
+ margin-left: 16px;
137
+ border-left: 4px solid var(--sui-textbox-border-color);
138
+ padding-left: 12px;
139
+ }
140
+
92
141
  .disabled,
93
142
  .readonly,
94
143
  [aria-disabled="true"],
@@ -101,6 +101,7 @@
101
101
  --sui-selected-background-color: hsl(var(--sui-background-color-5-hsl) / 75%);
102
102
  --sui-active-background-color: hsl(var(--sui-background-color-5-hsl) / 100%);
103
103
  --sui-content-background-color: hsl(var(--sui-background-color-1-hsl));
104
+ --sui-code-background-color: hsl(var(--sui-background-color-4-hsl));
104
105
  --sui-primary-background-color: hsl(var(--sui-background-color-2-hsl));
105
106
  --sui-primary-background-color-translucent: hsl(var(--sui-background-color-2-hsl) / 80%);
106
107
  --sui-secondary-background-color: hsl(var(--sui-background-color-3-hsl));
@@ -160,10 +161,11 @@
160
161
  --sui-font-weight-normal: 300;
161
162
  --sui-font-weight-bold: 600;
162
163
  --sui-font-family-monospace: "Noto Sans Mono", monospace;
163
- --sui-font-size-monospace: 12.5px;
164
+ --sui-font-size-monospace: 0.9em;
164
165
  --sui-line-height-default: 1.25;
165
166
  --sui-line-height-compact: 1.5;
166
167
  --sui-line-height-comfortable: 1.75;
168
+ --sui-word-spacing-normal: 0.1ex;
167
169
  // Controls
168
170
  --sui-control-small-border-width: 1px;
169
171
  --sui-control-small-border-radius: calc(var(--sui-control-small-height) / 8);