@atom-forge/brickee 0.0.2 → 0.0.3

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 (62) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README-AI.md +10 -7
  3. package/dist/Editor.svelte +691 -833
  4. package/dist/LinkPrompt.svelte +1 -14
  5. package/dist/Preview.svelte +27 -54
  6. package/dist/Preview.svelte.d.ts +2 -4
  7. package/dist/PropsBar.svelte +35 -219
  8. package/dist/code.js +1 -1
  9. package/dist/dom.d.ts +8 -0
  10. package/dist/dom.js +9 -0
  11. package/dist/editor/BlockMenu.svelte +102 -0
  12. package/dist/editor/BlockMenu.svelte.d.ts +32 -0
  13. package/dist/editor/FormatBar.svelte +41 -0
  14. package/dist/editor/FormatBar.svelte.d.ts +16 -0
  15. package/dist/editor/drag.svelte.d.ts +63 -0
  16. package/dist/editor/drag.svelte.js +95 -0
  17. package/dist/editor/history.d.ts +24 -0
  18. package/dist/editor/history.js +86 -0
  19. package/dist/editor/sweep.svelte.d.ts +21 -0
  20. package/dist/editor/sweep.svelte.js +56 -0
  21. package/dist/html.d.ts +12 -0
  22. package/dist/html.js +206 -0
  23. package/dist/i18n.js +1 -1
  24. package/dist/index.d.ts +2 -1
  25. package/dist/index.js +3 -2
  26. package/dist/kit/Empty.svelte +4 -15
  27. package/dist/kit/Frame.svelte +7 -37
  28. package/dist/locales/hu.js +4 -1
  29. package/dist/markdown.d.ts +20 -4
  30. package/dist/markdown.js +380 -85
  31. package/dist/model.js +2 -3
  32. package/dist/plugins/Gap.svelte +5 -8
  33. package/dist/plugins/GapPreview.svelte +4 -6
  34. package/dist/plugins/Map.svelte +2 -17
  35. package/dist/plugins/MapPreview.svelte +8 -10
  36. package/dist/plugins/Table.svelte +233 -256
  37. package/dist/plugins/TablePreview.svelte +28 -28
  38. package/dist/plugins/YouTube.svelte +3 -31
  39. package/dist/plugins/YouTubePreview.svelte +45 -43
  40. package/dist/plugins/index.js +3 -1
  41. package/dist/types.d.ts +21 -3
  42. package/dist/types.js +8 -1
  43. package/dist/view.js +1 -1
  44. package/docs/en/bundled-plugins.md +1 -1
  45. package/docs/en/documents-and-markdown.md +20 -14
  46. package/docs/en/editor-and-preview.md +6 -7
  47. package/docs/en/getting-started.md +8 -0
  48. package/docs/en/index.md +1 -1
  49. package/docs/en/recipes-and-pitfalls.md +2 -2
  50. package/docs/en/server-side.md +0 -17
  51. package/docs/en/upgrading.md +14 -0
  52. package/docs/en/writing-plugins.md +36 -10
  53. package/docs/hu/bundled-plugins.md +1 -1
  54. package/docs/hu/documents-and-markdown.md +20 -14
  55. package/docs/hu/editor-and-preview.md +6 -7
  56. package/docs/hu/getting-started.md +8 -0
  57. package/docs/hu/index.md +1 -1
  58. package/docs/hu/recipes-and-pitfalls.md +2 -2
  59. package/docs/hu/server-side.md +0 -17
  60. package/docs/hu/upgrading.md +14 -0
  61. package/docs/hu/writing-plugins.md +36 -10
  62. package/package.json +9 -1
@@ -7,18 +7,7 @@
7
7
  const tr = useText();
8
8
  </script>
9
9
 
10
- <div class="empty"><I size={18} /> {tr(text)}</div>
11
-
12
- <style>
13
- .empty {
14
- display: flex;
15
- align-items: center;
16
- justify-content: center;
17
- gap: 8px;
18
- min-height: 96px;
19
- border: 1px dashed var(--color-frame, #d4d4da);
20
- border-radius: 10px;
21
- color: var(--color-muted-contrast, #a0a0a8);
22
- font: 14px system-ui, sans-serif;
23
- }
24
- </style>
10
+ <div class="flex min-h-24 items-center justify-center gap-2 rounded-[10px] border border-dashed border-frame font-sans text-sm leading-[normal] text-muted-contrast">
11
+ <I size={18} />
12
+ {tr(text)}
13
+ </div>
@@ -31,46 +31,16 @@
31
31
  const fields = claimFields();
32
32
  </script>
33
33
 
34
- <div class="frame">
34
+ <!-- left padding: room for the inner blocks' handle bar (22px left of the row, which reaches 8px out); the fields reach
35
+ to the frame's edges, its padding taken back -->
36
+ <div class="relative rounded-[10px] border border-frame pt-[0.8em] pr-[1.1em] pb-[0.4em] pl-[calc(30px+0.5em)]">
35
37
  {#if fields}
36
- <div class="fields">{@render fields()}</div>
38
+ <div class="mt-[calc(-0.8em+4px)] mr-[calc(-1.1em+4px)] mb-[0.5em] ml-[calc(-30px-0.5em+4px)]">{@render fields()}</div>
37
39
  {:else if heading || empty || image}
38
- <div class="head">
39
- {#if image}<img src={image} alt="" draggable="false" />{/if}
40
- <span class:muted={!heading}>{heading || empty}</span>
40
+ <div class="mr-[9em] mb-[0.3em] flex items-center gap-2 font-sans text-[13px] leading-[1.4] font-semibold text-surface-contrast">
41
+ {#if image}<img class="h-7 w-11 rounded object-cover" src={image} alt="" draggable="false" />{/if}
42
+ <span class={heading ? '' : 'font-normal text-muted-contrast'}>{heading || empty}</span>
41
43
  </div>
42
44
  {/if}
43
45
  <Editor bind:value={blocks} {readonly} {palette} {plugins} nested placeholder={placeholder ?? tr('Write inside…')} />
44
46
  </div>
45
-
46
- <style>
47
- .frame {
48
- position: relative;
49
- border: 1px solid var(--color-frame, #e5e5ea);
50
- border-radius: 10px;
51
- /* left: room for the inner blocks' handle bar (22px left of the row, which reaches 8px out) */
52
- padding: 0.8em 1.1em 0.4em calc(30px + 0.5em);
53
- }
54
- /* the fields reach to the frame's edges, the frame's padding taken back */
55
- .fields {
56
- margin: calc(-0.8em + 4px) calc(-1.1em + 4px) 0.5em calc(-30px - 0.5em + 4px);
57
- }
58
- .head {
59
- display: flex;
60
- align-items: center;
61
- gap: 8px;
62
- margin: 0 9em 0.3em 0;
63
- font: 600 13px/1.4 system-ui, sans-serif;
64
- color: var(--color-surface-contrast, #1d1d1f);
65
- }
66
- .head img {
67
- height: 28px;
68
- width: 44px;
69
- object-fit: cover;
70
- border-radius: 4px;
71
- }
72
- .muted {
73
- font-weight: 400;
74
- color: var(--color-muted-contrast, #a0a0a8);
75
- }
76
- </style>
@@ -4,6 +4,10 @@ export const hu = {
4
4
  'Add a block below': 'Új blokk alá',
5
5
  'Drag to move, click to select': 'Húzd az áthelyezéshez, kattints a kijelöléshez',
6
6
  Done: 'Kész',
7
+ 'Move up': 'Mozgatás fel',
8
+ 'Move down': 'Mozgatás le',
9
+ 'Select the block': 'A blokk kijelölése',
10
+ 'Unknown block: {type}': 'Ismeretlen blokk: {type}',
7
11
  inherited: 'örökölt',
8
12
  Settings: 'Beállítások',
9
13
  'Hide settings': 'Beállítások elrejtése',
@@ -134,7 +138,6 @@ export const hu = {
134
138
  'Add a column': 'Új oszlop',
135
139
  'Add a row': 'Új sor',
136
140
  // előnézet
137
- 'For supporters only': 'Csak támogatóknak',
138
141
  'YouTube video': 'YouTube-videó',
139
142
  video: 'videó',
140
143
  'Play {title}': 'Lejátszás: {title}',
@@ -1,12 +1,21 @@
1
1
  import { type Block, type BlockPlugin, type StoredBlock } from './types';
2
2
  /** Inline markdown -> inline html (b, i, u, sub, sup, strike, code, a, br). Backslash escapes are honoured; links are
3
- * http(s), mailto, tel or site-relative only. */
3
+ * http(s), mailto, tel or site-relative only. Images become links (the package has no notion of images), footnote
4
+ * references superscripts, and inline HTML its marks (other tags are dropped). */
4
5
  export declare function inline(md: string): string;
6
+ /** A link target as markdown reads it back: spaces and unbalanced parentheses encoded. */
7
+ export declare function mdUrl(href: string): string;
8
+ /** Plain text as inline markdown: what would read as a mark is escaped (`_` only at a word's edge: snake_case stays). */
9
+ export declare function escText(t: string): string;
10
+ /** Inline markdown for a code span: a fence longer than any backtick run inside, padded when it starts or ends with one. */
11
+ export declare function codeSpan(text: string): string;
5
12
  /** Inline html -> inline markdown (browser only). `code` keeps the text verbatim, as in a code block. */
6
13
  export declare function htmlToMarkdown(html: string, code?: boolean): string;
14
+ /** A line of text, escaped where markdown would read it as a block start (`1. ` as `1\. `). */
15
+ export declare function escLine(t: string): string;
7
16
  /** One block -> its markdown snippet, without indentation. `n` is the ordinal of a numbered item. */
8
17
  export declare function blockToMd(b: Block, n?: number): string;
9
- /** One markdown snippet -> block fields. */
18
+ /** One markdown line -> block fields (a heading, a list item, a quote, a rule or a paragraph). */
10
19
  export declare function mdToBlock(md: string): Pick<Block, 'type' | 'html' | 'checked' | 'props'>;
11
20
  /** Inline html -> the same letters without formatting (line breaks kept), as a code block holds them. */
12
21
  export declare function plainHtml(html: string): string;
@@ -14,8 +23,15 @@ export declare function plainHtml(html: string): string;
14
23
  export declare function toStored(b: Block): StoredBlock;
15
24
  /** Stored block -> editor block with a fresh id. Unknown types (md: or plugin) are kept as they are. */
16
25
  export declare function fromStored(s: StoredBlock): Block;
17
- /** Markdown text -> blocks. Supports headings, lists, todos, quotes, fenced code, hr and basic inline marks. */
18
- export declare function fromMarkdown(src: string): Block[];
26
+ /**
27
+ * Markdown text -> blocks (CommonMark and GFM, as far as blocks can hold them): headings (also setext), lists with
28
+ * their nesting and start number, to-dos, quotes (also nested), fenced and indented code, rules, and paragraphs whose
29
+ * lines are kept as line breaks. Reference links are resolved, footnotes become superscripts. A GFM table goes to the
30
+ * first of `plugins` that takes it (`fromTable`), or stays text.
31
+ */
32
+ export declare function fromMarkdown(src: string, opts?: {
33
+ plugins?: BlockPlugin[];
34
+ }): Block[];
19
35
  /** Blocks -> markdown text (browser only: uses the DOM to read the inline html). A plugin block is written by its
20
36
  * plugin's `markdown`; one without it is left out. */
21
37
  export declare function toMarkdown(blocks: Block[], opts?: {