@jackuait/blok 0.4.1-beta.11 → 0.4.1-beta.12

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 (28) hide show
  1. package/dist/blok.mjs +2 -2
  2. package/dist/chunks/{blok-oNSQ3HA6.mjs → blok-BU6NwVkN.mjs} +423 -401
  3. package/dist/chunks/{i18next-loader-BdNRw4n4.mjs → i18next-loader-D8GzSwio.mjs} +1 -1
  4. package/dist/chunks/{index-DHgXmfki.mjs → index-C5e_WLFg.mjs} +1 -1
  5. package/dist/chunks/{inline-tool-convert-CRqgjRim.mjs → inline-tool-convert-CLUxkCe_.mjs} +2 -1
  6. package/dist/full.mjs +2 -2
  7. package/dist/tools.mjs +16 -7
  8. package/package.json +1 -1
  9. package/src/components/inline-tools/inline-tool-convert.ts +1 -0
  10. package/src/components/inline-tools/inline-tool-link.ts +1 -0
  11. package/src/components/modules/toolbar/blockSettings.ts +2 -1
  12. package/src/components/modules/toolbar/index.ts +97 -116
  13. package/src/components/modules/ui.ts +1 -1
  14. package/src/components/ui/toolbox.ts +14 -5
  15. package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.ts +1 -1
  16. package/src/components/utils/popover/components/popover-item/popover-item.ts +11 -0
  17. package/src/components/utils/popover/popover-abstract.ts +1 -1
  18. package/src/components/utils/popover/popover-desktop.ts +8 -2
  19. package/src/stories/Popover.stories.ts +0 -85
  20. package/src/styles/main.css +7 -4
  21. package/src/tools/header/index.ts +1 -0
  22. package/src/tools/list/index.ts +11 -4
  23. package/types/configs/sanitizer-config.d.ts +25 -1
  24. package/types/index.d.ts +1 -0
  25. package/types/tools/block-tool.d.ts +2 -2
  26. package/types/tools/tool-settings.d.ts +7 -0
  27. package/types/utils/popover/popover-item.d.ts +6 -0
  28. package/types/utils/popover/popover.d.ts +6 -0
@@ -84,17 +84,20 @@
84
84
  }
85
85
 
86
86
  [data-drop-indicator]::before {
87
- @apply content-[''] absolute -translate-x-1/2 w-full max-w-content h-1.5 rounded-sm bg-[#d4e3fc] pointer-events-none z-10;
88
- left: calc(50% + var(--drop-indicator-depth, 0) * 12px);
87
+ @apply content-[''] absolute w-full max-w-content h-1.5 rounded-sm bg-[#d4e3fc] pointer-events-none z-10;
88
+ left: 50%;
89
+ margin-left: calc(var(--drop-indicator-depth, 0) * 12px);
89
90
  max-width: calc(650px - var(--drop-indicator-depth, 0) * 24px);
90
91
  }
91
92
 
92
93
  [data-drop-indicator="bottom"]::before {
93
- @apply translate-y-1/2 bottom-0;
94
+ @apply bottom-0;
95
+ transform: translateX(-50%) translateY(50%);
94
96
  }
95
97
 
96
98
  [data-drop-indicator="top"]::before {
97
- @apply -translate-y-1/2 top-0;
99
+ @apply top-0;
100
+ transform: translateX(-50%) translateY(-50%);
98
101
  }
99
102
 
100
103
  /**
@@ -641,6 +641,7 @@ export class Header implements BlockTool {
641
641
  name: `header-${level.number}`,
642
642
  data: { level: level.number },
643
643
  searchTerms: [`h${level.number}`, 'title', 'header', 'heading'],
644
+ shortcut: '#'.repeat(level.number),
644
645
  }));
645
646
  }
646
647
  }
@@ -17,7 +17,7 @@ import type {
17
17
  PasteEvent,
18
18
  ToolboxConfig,
19
19
  ConversionConfig,
20
- SanitizerConfig,
20
+ ToolSanitizerConfig,
21
21
  PasteConfig,
22
22
  } from '../../../types';
23
23
  import type { MenuConfig } from '../../../types/tools/menu-config';
@@ -183,7 +183,7 @@ export class ListItem implements BlockTool {
183
183
  */
184
184
  private static pendingMarkerUpdate = false;
185
185
 
186
- sanitize?: SanitizerConfig | undefined;
186
+ sanitize?: ToolSanitizerConfig | undefined;
187
187
 
188
188
  private normalizeData(data: ListItemData | Record<string, never>): ListItemData {
189
189
  const defaultStyle = this._settings.defaultStyle || 'unordered';
@@ -1665,11 +1665,15 @@ export class ListItem implements BlockTool {
1665
1665
  };
1666
1666
  }
1667
1667
 
1668
- public static get sanitize(): SanitizerConfig {
1668
+ public static get sanitize(): ToolSanitizerConfig {
1669
1669
  return {
1670
1670
  text: {
1671
1671
  br: true,
1672
- a: true,
1672
+ a: {
1673
+ href: true,
1674
+ target: '_blank',
1675
+ rel: 'nofollow',
1676
+ },
1673
1677
  b: true,
1674
1678
  i: true,
1675
1679
  mark: true,
@@ -1797,6 +1801,7 @@ export class ListItem implements BlockTool {
1797
1801
  data: { style: 'unordered' },
1798
1802
  name: 'bulleted-list',
1799
1803
  searchTerms: ['ul', 'bullet', 'unordered', 'list'],
1804
+ shortcut: '-',
1800
1805
  },
1801
1806
  {
1802
1807
  icon: IconListNumbered,
@@ -1805,6 +1810,7 @@ export class ListItem implements BlockTool {
1805
1810
  data: { style: 'ordered' },
1806
1811
  name: 'numbered-list',
1807
1812
  searchTerms: ['ol', 'ordered', 'number', 'list'],
1813
+ shortcut: '1.',
1808
1814
  },
1809
1815
  {
1810
1816
  icon: IconListChecklist,
@@ -1813,6 +1819,7 @@ export class ListItem implements BlockTool {
1813
1819
  data: { style: 'checklist' },
1814
1820
  name: 'check-list',
1815
1821
  searchTerms: ['checkbox', 'task', 'todo', 'check', 'list'],
1822
+ shortcut: '[]',
1816
1823
  },
1817
1824
  ];
1818
1825
  }
@@ -4,7 +4,7 @@
4
4
  */
5
5
  export type TagConfig = boolean | { [attr: string]: boolean | string };
6
6
 
7
- export type SanitizerRule = TagConfig | ((el: Element) => TagConfig)
7
+ export type SanitizerRule = TagConfig | ((el: Element) => TagConfig);
8
8
 
9
9
  export interface SanitizerConfig {
10
10
  /**
@@ -41,3 +41,27 @@ export interface SanitizerConfig {
41
41
  */
42
42
  [key: string]: SanitizerRule;
43
43
  }
44
+
45
+ /**
46
+ * Sanitizer config for Block Tools that supports field-specific tag rules.
47
+ * Use this when your tool's data has multiple fields that each need different sanitization.
48
+ *
49
+ * @example Field-specific sanitization
50
+ * ```typescript
51
+ * static get sanitize(): ToolSanitizerConfig {
52
+ * return {
53
+ * text: {
54
+ * br: true,
55
+ * a: { href: true, target: '_blank', rel: 'nofollow' }
56
+ * },
57
+ * caption: {
58
+ * b: true,
59
+ * i: true
60
+ * }
61
+ * };
62
+ * }
63
+ * ```
64
+ */
65
+ export interface ToolSanitizerConfig {
66
+ [key: string]: SanitizerRule | SanitizerConfig;
67
+ }
package/types/index.d.ts CHANGED
@@ -72,6 +72,7 @@ export {
72
72
  BlokConfig,
73
73
  SanitizerConfig,
74
74
  SanitizerRule,
75
+ ToolSanitizerConfig,
75
76
  PasteConfig,
76
77
  LogLevels,
77
78
  ConversionConfig,
@@ -1,4 +1,4 @@
1
- import { ConversionConfig, PasteConfig, SanitizerConfig } from '../configs';
1
+ import { ConversionConfig, PasteConfig, ToolSanitizerConfig } from '../configs';
2
2
  import { BlockToolData } from './block-tool-data';
3
3
  import { BaseTool, BaseToolConstructable, BaseToolConstructorOptions } from './tool';
4
4
  import { ToolConfig } from './tool-config';
@@ -15,7 +15,7 @@ export interface BlockTool extends BaseTool {
15
15
  /**
16
16
  * Sanitizer rules description
17
17
  */
18
- sanitize?: SanitizerConfig;
18
+ sanitize?: ToolSanitizerConfig;
19
19
 
20
20
  /**
21
21
  * Process Tool's element in DOM and return raw data
@@ -52,6 +52,13 @@ export interface ToolboxConfigEntry {
52
52
  * Terms are matched case-insensitively.
53
53
  */
54
54
  searchTerms?: string[];
55
+
56
+ /**
57
+ * Shortcut hint to display in the toolbox (e.g., '#', '##', '-', '1.', '[]').
58
+ * This is displayed as a secondary label next to the tool title.
59
+ * Unlike tool-level shortcuts, these are per-entry hints for tools with multiple variants.
60
+ */
61
+ shortcut?: string;
55
62
  }
56
63
 
57
64
  /**
@@ -45,6 +45,12 @@ export interface PopoverItemChildren {
45
45
  * Useful for items like link tool that render custom content instead of a dropdown list.
46
46
  */
47
47
  hideChevron?: boolean;
48
+
49
+ /**
50
+ * Width of the nested popover. Defaults to '280px'.
51
+ * Use 'auto' to fit content width.
52
+ */
53
+ width?: string;
48
54
  }
49
55
 
50
56
  /**
@@ -65,6 +65,12 @@ export interface PopoverParams {
65
65
  * Used to close nested popover and return focus to parent.
66
66
  */
67
67
  onNavigateBack?: () => void;
68
+
69
+ /**
70
+ * Width of the popover. Defaults to '280px'.
71
+ * Use 'auto' to fit content width.
72
+ */
73
+ width?: string;
68
74
  }
69
75
 
70
76