@sveltia/ui 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/package/components/button/button.svelte +4 -1
  2. package/package/components/button/button.svelte.d.ts +12 -12
  3. package/package/components/button/select-button-group.svelte.d.ts +4 -4
  4. package/package/components/button/select-button.svelte.d.ts +6 -6
  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-group.svelte.d.ts +2 -2
  9. package/package/components/checkbox/checkbox.svelte +1 -1
  10. package/package/components/checkbox/checkbox.svelte.d.ts +10 -10
  11. package/package/components/dialog/dialog.svelte +1 -1
  12. package/package/components/dialog/dialog.svelte.d.ts +2 -2
  13. package/package/components/dialog/prompt-dialog.svelte +7 -1
  14. package/package/components/dialog/prompt-dialog.svelte.d.ts +4 -2
  15. package/package/components/disclosure/disclosure.svelte +1 -1
  16. package/package/components/disclosure/disclosure.svelte.d.ts +2 -2
  17. package/package/components/drawer/drawer.svelte +1 -1
  18. package/package/components/drawer/drawer.svelte.d.ts +6 -6
  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.d.ts +2 -2
  23. package/package/components/listbox/option.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 +6 -6
  26. package/package/components/menu/menu-item-checkbox.svelte.d.ts +4 -4
  27. package/package/components/menu/menu-item-group.svelte.d.ts +2 -2
  28. package/package/components/menu/menu-item-radio.svelte.d.ts +4 -4
  29. package/package/components/menu/menu-item.svelte +1 -1
  30. package/package/components/menu/menu-item.svelte.d.ts +4 -4
  31. package/package/components/menu/menu.svelte.d.ts +2 -2
  32. package/package/components/radio/radio-group.svelte.d.ts +4 -4
  33. package/package/components/radio/radio.svelte +1 -1
  34. package/package/components/radio/radio.svelte.d.ts +6 -6
  35. package/package/components/select/combobox.svelte +2 -2
  36. package/package/components/select/combobox.svelte.d.ts +6 -6
  37. package/package/components/select/select.svelte.d.ts +6 -6
  38. package/package/components/slider/slider.svelte +1 -1
  39. package/package/components/slider/slider.svelte.d.ts +10 -10
  40. package/package/components/switch/switch.svelte.d.ts +8 -8
  41. package/package/components/tabs/tab-list.svelte +1 -1
  42. package/package/components/tabs/tab-list.svelte.d.ts +2 -2
  43. package/package/components/tabs/tab.svelte.d.ts +2 -2
  44. package/package/components/text-editor/core.d.ts +2 -0
  45. package/package/components/text-editor/core.js +206 -0
  46. package/package/components/text-editor/index.d.ts +23 -0
  47. package/package/components/text-editor/index.js +102 -0
  48. package/package/components/text-editor/lexical-root.svelte +123 -0
  49. package/package/components/text-editor/lexical-root.svelte.d.ts +27 -0
  50. package/package/components/text-editor/text-editor.svelte +154 -0
  51. package/package/components/{text-field/markdown-editor.svelte.d.ts → text-editor/text-editor.svelte.d.ts} +18 -14
  52. package/package/components/text-editor/toolbar/editor-toolbar.svelte +150 -0
  53. package/package/components/text-editor/toolbar/editor-toolbar.svelte.d.ts +25 -0
  54. package/package/components/text-editor/toolbar/format-text-button.svelte +33 -0
  55. package/package/components/text-editor/toolbar/format-text-button.svelte.d.ts +23 -0
  56. package/package/components/text-editor/toolbar/insert-link-button.svelte +231 -0
  57. package/package/components/text-editor/toolbar/insert-link-button.svelte.d.ts +23 -0
  58. package/package/components/text-editor/toolbar/toggle-block-menu-item.svelte +83 -0
  59. package/package/components/text-editor/toolbar/toggle-block-menu-item.svelte.d.ts +23 -0
  60. package/package/components/text-field/number-input.svelte +1 -1
  61. package/package/components/text-field/number-input.svelte.d.ts +12 -12
  62. package/package/components/text-field/password-input.svelte +1 -1
  63. package/package/components/text-field/password-input.svelte.d.ts +6 -6
  64. package/package/components/text-field/search-bar.svelte +2 -2
  65. package/package/components/text-field/search-bar.svelte.d.ts +6 -6
  66. package/package/components/text-field/text-area.svelte +3 -0
  67. package/package/components/text-field/text-area.svelte.d.ts +6 -6
  68. package/package/components/text-field/text-input.svelte.d.ts +8 -8
  69. package/package/components/toast/toast.svelte +2 -2
  70. package/package/components/toast/toast.svelte.d.ts +2 -2
  71. package/package/components/toolbar/toolbar.svelte.d.ts +2 -2
  72. package/package/components/util/app-shell.svelte +56 -4
  73. package/package/components/util/group.svelte.d.ts +2 -2
  74. package/package/components/util/modal.svelte +2 -2
  75. package/package/components/util/modal.svelte.d.ts +6 -6
  76. package/package/components/util/popup.svelte +2 -2
  77. package/package/components/util/popup.svelte.d.ts +6 -3
  78. package/package/index.d.ts +1 -1
  79. package/package/index.js +1 -1
  80. package/package/locales/en.d.ts +25 -7
  81. package/package/locales/en.js +25 -6
  82. package/package/locales/ja.d.ts +25 -7
  83. package/package/locales/ja.js +25 -6
  84. package/package/services/events.js +2 -2
  85. package/package/services/group.js +4 -4
  86. package/package/services/util.d.ts +1 -0
  87. package/package/services/util.js +22 -1
  88. package/package/styles/core.scss +51 -2
  89. package/package/styles/variables.scss +3 -1
  90. package/package/typedef.d.ts +48 -0
  91. package/package/typedef.js +36 -0
  92. package/package.json +18 -8
  93. package/package/components/text-field/markdown-editor.svelte +0 -141
@@ -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;
@@ -8,8 +8,8 @@
8
8
  export default class Group extends SvelteComponent<{
9
9
  [x: string]: any;
10
10
  class?: string | undefined;
11
- disabled?: boolean | undefined;
12
11
  hidden?: boolean | undefined;
12
+ disabled?: boolean | undefined;
13
13
  }, {
14
14
  [evt: string]: CustomEvent<any>;
15
15
  }, {
@@ -24,8 +24,8 @@ declare const __propDef: {
24
24
  props: {
25
25
  [x: string]: any;
26
26
  class?: string | undefined;
27
- disabled?: boolean | undefined;
28
27
  hidden?: boolean | undefined;
28
+ disabled?: boolean | undefined;
29
29
  };
30
30
  events: {
31
31
  [evt: string]: CustomEvent<any>;
@@ -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
  }}
@@ -5,9 +5,9 @@
5
5
  export default class Modal extends SvelteComponent<{
6
6
  [x: string]: any;
7
7
  class?: string | undefined;
8
- close?: ((returnValue: string) => void) | undefined;
9
8
  dialog?: HTMLDialogElement | undefined;
10
- role?: "dialog" | "none" | "alertdialog" | undefined;
9
+ close?: ((returnValue: string) => void) | 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;
@@ -58,9 +58,9 @@ declare const __propDef: {
58
58
  props: {
59
59
  [x: string]: any;
60
60
  class?: string | undefined;
61
- close?: ((returnValue: string) => void) | undefined;
62
61
  dialog?: HTMLDialogElement | undefined;
63
- role?: "dialog" | "none" | "alertdialog" | undefined;
62
+ close?: ((returnValue: string) => void) | undefined;
63
+ role?: "dialog" | "alertdialog" | "none" | undefined;
64
64
  open?: boolean | undefined;
65
65
  showBackdrop?: boolean | undefined;
66
66
  lightDismiss?: boolean | undefined;
@@ -7,9 +7,9 @@
7
7
  <script>
8
8
  import { onMount } from 'svelte';
9
9
  import { writable } from 'svelte/store';
10
+ import Modal from './modal.svelte';
10
11
  import { activatePopup } from '../../services/popup';
11
12
  import { sleep } from '../../services/util';
12
- import Modal from './modal.svelte';
13
13
 
14
14
  /**
15
15
  * The `class` attribute on the content element.
@@ -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
 
@@ -6,9 +6,9 @@ export default class Popup extends SvelteComponent<{
6
6
  [x: string]: any;
7
7
  anchor: HTMLElement | undefined;
8
8
  class?: string | undefined;
9
- position?: PopupPosition | undefined;
10
9
  open?: import("svelte/store").Writable<boolean> | undefined;
11
10
  showBackdrop?: boolean | undefined;
11
+ position?: PopupPosition | undefined;
12
12
  content?: HTMLElement | undefined;
13
13
  positionBaseElement?: HTMLElement | undefined;
14
14
  touchOptimized?: boolean | undefined;
@@ -61,9 +61,9 @@ declare const __propDef: {
61
61
  [x: string]: any;
62
62
  anchor: HTMLElement | undefined;
63
63
  class?: string | undefined;
64
- position?: PopupPosition | undefined;
65
64
  open?: import("svelte/store").Writable<boolean> | undefined;
66
65
  showBackdrop?: boolean | undefined;
66
+ position?: PopupPosition | undefined;
67
67
  content?: HTMLElement | undefined;
68
68
  positionBaseElement?: HTMLElement | undefined;
69
69
  touchOptimized?: boolean | undefined;
@@ -78,7 +78,10 @@ declare const __propDef: {
78
78
  } & {
79
79
  [evt: string]: CustomEvent<any>;
80
80
  };
81
- slots: {
81
+ /**
82
+ * The `class` attribute on the content element.
83
+ * @type {string}
84
+ */ slots: {
82
85
  'extra-content': {
83
86
  slot: string;
84
87
  };
@@ -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";
package/package/index.js CHANGED
@@ -81,7 +81,7 @@ export { default as TabList } from './components/tabs/tab-list.svelte';
81
81
  export { default as TabPanel } from './components/tabs/tab-panel.svelte';
82
82
  export { default as TabPanels } from './components/tabs/tab-panels.svelte';
83
83
  export { default as Tab } from './components/tabs/tab.svelte';
84
- export { default as MarkdownEditor } from './components/text-field/markdown-editor.svelte';
84
+ export { default as TextEditor } from './components/text-editor/text-editor.svelte';
85
85
  export { default as NumberInput } from './components/text-field/number-input.svelte';
86
86
  export { default as PasswordInput } from './components/text-field/password-input.svelte';
87
87
  export { default as SearchBar } from './components/text-field/search-bar.svelte';
@@ -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
  };
@@ -106,7 +106,7 @@ class Group {
106
106
  controlTarget.setAttribute('aria-hidden', String(!isSelected));
107
107
 
108
108
  if (isSelected) {
109
- window.setTimeout(() => {
109
+ globalThis.setTimeout(() => {
110
110
  try {
111
111
  controlTarget.scrollIntoView({
112
112
  block: 'nearest',
@@ -258,7 +258,7 @@ class Group {
258
258
 
259
259
  if (this.focusChild) {
260
260
  // Wait a bit before the element is rerendered
261
- window.requestAnimationFrame(() => {
261
+ globalThis.requestAnimationFrame(() => {
262
262
  element.tabIndex = isTarget ? 0 : -1;
263
263
 
264
264
  if (isTarget) {
@@ -279,7 +279,7 @@ class Group {
279
279
  controlTarget.setAttribute('aria-hidden', String(!isTarget));
280
280
 
281
281
  if (isTarget) {
282
- window.setTimeout(() => {
282
+ globalThis.setTimeout(() => {
283
283
  try {
284
284
  controlTarget.scrollIntoView({
285
285
  block: 'nearest',
@@ -296,7 +296,7 @@ class Group {
296
296
  if (isTarget) {
297
297
  this.parent.setAttribute('aria-activedescendant', element.id);
298
298
 
299
- window.setTimeout(() => {
299
+ globalThis.setTimeout(() => {
300
300
  try {
301
301
  element.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: 'auto' });
302
302
  } catch {
@@ -1,3 +1,4 @@
1
1
  export function getRandomId(prefix?: string | undefined, length?: number | undefined): string;
2
2
  export function isObject(input: any): boolean;
3
3
  export function sleep(ms?: number | undefined): Promise<void>;
4
+ export function isURL(str: string): boolean;
@@ -29,7 +29,28 @@ export const isObject = (input) =>
29
29
  */
30
30
  export const sleep = (ms = 1000) =>
31
31
  new Promise((resolve) => {
32
- window.setTimeout(() => {
32
+ globalThis.setTimeout(() => {
33
33
  resolve();
34
34
  }, ms);
35
35
  });
36
+
37
+ /**
38
+ * Check if the given string is a URL.
39
+ * @param {string} str - String that might be a URL.
40
+ * @returns {boolean} Result.
41
+ */
42
+ export const isURL = (str) => {
43
+ // @ts-ignore
44
+ if (typeof URL.canParse === 'function') {
45
+ // @ts-ignore
46
+ return URL.canParse(str);
47
+ }
48
+
49
+ try {
50
+ // eslint-disable-next-line no-new
51
+ new URL(str);
52
+ return true;
53
+ } catch {
54
+ return false;
55
+ }
56
+ };
@@ -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);