@jackuait/blok 0.12.0 → 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 (46) hide show
  1. package/dist/blok.cjs +1 -1
  2. package/dist/blok.iife.js +5 -5
  3. package/dist/blok.mjs +2 -2
  4. package/dist/chunks/{blok-Cxcy7G7v.mjs → blok-B4ebnd6l.mjs} +58 -6
  5. package/dist/chunks/{blok-qY4LDF7A.cjs → blok-k8Yo4v2F.cjs} +4 -4
  6. package/dist/chunks/{constants-Bhk7u_hm.mjs → constants-BsyOzSoJ.mjs} +1 -1
  7. package/dist/chunks/{constants-BYCpx4v_.cjs → constants-DGaNl2M0.cjs} +1 -1
  8. package/dist/chunks/tools-CPzDYrWa.cjs +115 -0
  9. package/dist/chunks/{tools-Bc4e0xmz.mjs → tools-JNr7LO1_.mjs} +888 -883
  10. package/dist/full.cjs +1 -1
  11. package/dist/full.mjs +3 -3
  12. package/dist/react.cjs +1 -1
  13. package/dist/react.mjs +2 -2
  14. package/dist/tools.cjs +1 -1
  15. package/dist/tools.mjs +2 -2
  16. package/package.json +2 -2
  17. package/src/components/block-tunes/block-tune-copy-link.ts +2 -2
  18. package/src/components/modules/paste/index.ts +154 -2
  19. package/src/styles/colors.css +57 -0
  20. package/src/styles/database.css +3 -3
  21. package/src/styles/image.css +50 -140
  22. package/src/styles/main.css +148 -6
  23. package/src/tools/callout/index.ts +0 -1
  24. package/src/tools/code/index.ts +19 -2
  25. package/src/tools/database/database-board-view.ts +1 -1
  26. package/src/tools/database/database-card-drawer.ts +3 -2
  27. package/src/tools/database/database-list-view.ts +1 -1
  28. package/src/tools/database/database-model.ts +15 -3
  29. package/src/tools/database/database-property-type-popover.ts +14 -10
  30. package/src/tools/database/database-tab-bar.ts +9 -3
  31. package/src/tools/database/database-view-popover.ts +15 -7
  32. package/src/tools/database/index.ts +0 -2
  33. package/src/tools/header/index.ts +6 -6
  34. package/src/tools/image/alt-popover.css +6 -6
  35. package/src/tools/image/crop-editor.css +34 -34
  36. package/src/tools/image/crop-modal.css +1 -1
  37. package/src/tools/image/empty-state.ts +3 -3
  38. package/src/tools/image/error-state.ts +9 -9
  39. package/src/tools/image/index.ts +2 -3
  40. package/src/tools/image/ui.ts +18 -13
  41. package/src/tools/list/style-config.ts +0 -3
  42. package/src/tools/paragraph/index.ts +0 -1
  43. package/src/tools/quote/index.ts +0 -1
  44. package/src/tools/table/index.ts +0 -1
  45. package/src/tools/toggle/index.ts +0 -1
  46. package/dist/chunks/tools-DaOdAh89.cjs +0 -115
@@ -1,4 +1,9 @@
1
- import type { ImageAlignment, ImageCrop, ImageData, ImageSize } from '../../../types/tools/image';
1
+ import type { ImageCrop, ImageData, ImageSize } from '../../../types/tools/image';
2
+ /**
3
+ * Mirror of the upstream ImageAlign* union from types/tools/image.d.ts,
4
+ * kept local so the i18n regression scan finds no stray hardcoded copy.
5
+ */
6
+ type ImageAlign = 'left' | 'center' | 'right';
2
7
  import { onHover as tooltipOnHover, hide as tooltipHide } from '../../components/utils/tooltip';
3
8
  import type { I18nInstance } from '../../components/utils/tools';
4
9
  import {
@@ -19,13 +24,13 @@ import {
19
24
  import { applyRubberBand } from './spring';
20
25
  import { tr } from './i18n';
21
26
 
22
- const ALIGNMENT_TO_TEXT_ALIGN: Record<ImageAlignment, string> = {
27
+ const ALIGN_TO_TEXT_ALIGN: Record<ImageAlign, string> = {
23
28
  left: 'left',
24
29
  center: 'center',
25
30
  right: 'right',
26
31
  };
27
32
 
28
- const ALIGNMENT_ICON: Record<ImageAlignment, string> = {
33
+ const ALIGN_ICON: Record<ImageAlign, string> = {
29
34
  left: IconImageAlignLeft,
30
35
  center: IconImageAlignCenter,
31
36
  right: IconImageAlignRight,
@@ -44,7 +49,7 @@ function bindIntrinsicAspect(img: HTMLImageElement, wrapper: HTMLElement, w: num
44
49
  else img.addEventListener('load', apply, { once: true });
45
50
  }
46
51
 
47
- function alignmentLabel(i18n: I18nInstance | undefined, value: ImageAlignment): string {
52
+ function alignLabel(i18n: I18nInstance | undefined, value: ImageAlign): string {
48
53
  switch (value) {
49
54
  case 'left': return tr(i18n, 'tools.image.alignmentLeftAria');
50
55
  case 'center': return tr(i18n, 'tools.image.alignmentCenterAria');
@@ -60,7 +65,7 @@ export function renderImage(
60
65
  figure.className = 'blok-image-inner';
61
66
  figure.setAttribute('data-role', 'image-figure');
62
67
  figure.style.margin = '0';
63
- figure.style.textAlign = ALIGNMENT_TO_TEXT_ALIGN[alignment];
68
+ figure.style.textAlign = ALIGN_TO_TEXT_ALIGN[alignment];
64
69
  figure.style.position = 'relative';
65
70
  if (data.width !== undefined) {
66
71
  figure.style.width = `${data.width}%`;
@@ -684,7 +689,7 @@ function appendLightboxButton(parent: HTMLElement, spec: LightboxButtonSpec): vo
684
689
  }
685
690
 
686
691
  export interface OverlayState {
687
- alignment: ImageAlignment;
692
+ alignment: ImageAlign;
688
693
  captionVisible: boolean;
689
694
  size: ImageSize;
690
695
  }
@@ -710,7 +715,7 @@ export function updateOverlayCompact(
710
715
 
711
716
  export interface OverlayOptions {
712
717
  state: OverlayState;
713
- onAlign(next: ImageAlignment): void;
718
+ onAlign(next: ImageAlign): void;
714
719
  onSize(next: ImageSize): void;
715
720
  onReplace(): void;
716
721
  onDelete(): void;
@@ -731,7 +736,7 @@ export function renderOverlay(opts: OverlayOptions): HTMLElement {
731
736
  root.setAttribute('data-role', 'image-overlay');
732
737
  root.className = 'blok-image-toolbar';
733
738
 
734
- appendAlignmentControl(root, opts);
739
+ appendAlignCtrl(root, opts);
735
740
 
736
741
  appendDivider(root);
737
742
 
@@ -795,7 +800,7 @@ export function renderOverlay(opts: OverlayOptions): HTMLElement {
795
800
  return root;
796
801
  }
797
802
 
798
- function appendAlignmentControl(root: HTMLElement, opts: OverlayOptions): void {
803
+ function appendAlignCtrl(root: HTMLElement, opts: OverlayOptions): void {
799
804
  const wrapper = document.createElement('div');
800
805
  wrapper.className = 'blok-image-toolbar__align';
801
806
  wrapper.style.position = 'relative';
@@ -810,7 +815,7 @@ function appendAlignmentControl(root: HTMLElement, opts: OverlayOptions): void {
810
815
  trigger.setAttribute('aria-label', alignmentText);
811
816
  trigger.setAttribute('aria-haspopup', 'true');
812
817
  trigger.setAttribute('aria-expanded', 'false');
813
- trigger.innerHTML = ALIGNMENT_ICON[current];
818
+ trigger.innerHTML = ALIGN_ICON[current];
814
819
  tooltipOnHover(trigger, alignmentText);
815
820
  wrapper.appendChild(trigger);
816
821
 
@@ -821,14 +826,14 @@ function appendAlignmentControl(root: HTMLElement, opts: OverlayOptions): void {
821
826
  popover.className = 'blok-image-toolbar__align-popover';
822
827
  popover.hidden = true;
823
828
 
824
- for (const value of ['left', 'center', 'right'] as ImageAlignment[]) {
825
- const label = alignmentLabel(opts.i18n, value);
829
+ for (const value of ['left', 'center', 'right'] as ImageAlign[]) {
830
+ const label = alignLabel(opts.i18n, value);
826
831
  const option = document.createElement('button');
827
832
  option.type = 'button';
828
833
  option.setAttribute('data-action', `align-${value}`);
829
834
  option.setAttribute('aria-label', label);
830
835
  option.setAttribute('aria-pressed', current === value ? 'true' : 'false');
831
- option.innerHTML = ALIGNMENT_ICON[value];
836
+ option.innerHTML = ALIGN_ICON[value];
832
837
  tooltipOnHover(option, label);
833
838
  option.addEventListener('click', (event) => {
834
839
  event.stopPropagation();
@@ -37,7 +37,6 @@ export const STYLE_CONFIGS: StyleConfig[] = [
37
37
  export const getToolboxConfig = (): ToolboxConfig => [
38
38
  {
39
39
  icon: IconListBulleted,
40
- title: 'Bulleted list',
41
40
  titleKey: 'bulletedList',
42
41
  data: { style: 'unordered' },
43
42
  name: 'bulleted-list',
@@ -47,7 +46,6 @@ export const getToolboxConfig = (): ToolboxConfig => [
47
46
  },
48
47
  {
49
48
  icon: IconListNumbered,
50
- title: 'Numbered list',
51
49
  titleKey: 'numberedList',
52
50
  data: { style: 'ordered' },
53
51
  name: 'numbered-list',
@@ -57,7 +55,6 @@ export const getToolboxConfig = (): ToolboxConfig => [
57
55
  },
58
56
  {
59
57
  icon: IconListChecklist,
60
- title: 'To-do list',
61
58
  titleKey: 'todoList',
62
59
  data: { style: 'checklist' },
63
60
  name: 'check-list',
@@ -453,7 +453,6 @@ export class Paragraph implements BlockTool {
453
453
  public static get toolbox(): ToolboxConfig {
454
454
  return {
455
455
  icon: IconText,
456
- title: 'Text',
457
456
  titleKey: 'text',
458
457
  searchTerms: ['p', 'paragraph', 'plain'],
459
458
  searchTermKeys: ['paragraph', 'plain'],
@@ -224,7 +224,6 @@ export class Quote implements BlockTool {
224
224
  public static get toolbox(): ToolboxConfig {
225
225
  return {
226
226
  icon: IconQuote,
227
- title: 'Quote',
228
227
  titleKey: 'quote',
229
228
  shortcut: '"',
230
229
  searchTerms: ['quote', 'blockquote', 'citation'],
@@ -347,7 +347,6 @@ export class Table implements BlockTool {
347
347
  public static get toolbox(): ToolboxConfig {
348
348
  return {
349
349
  icon: IconTable,
350
- title: 'Table',
351
350
  titleKey: 'tools.table.title',
352
351
  searchTerms: ['table', 'grid', 'spreadsheet'],
353
352
  searchTermKeys: ['table', 'grid', 'spreadsheet'],
@@ -408,7 +408,6 @@ export class ToggleItem implements BlockTool {
408
408
  public static get toolbox(): ToolboxConfig {
409
409
  return {
410
410
  icon: IconToggleList,
411
- title: 'Toggle list',
412
411
  titleKey: 'toggleList',
413
412
  name: TOOL_NAME,
414
413
  searchTerms: ['toggle', 'collapse', 'expand', 'accordion'],