@kubex/zinc 1.1.101 → 1.1.103

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 (82) hide show
  1. package/dist/custom-elements.json +261 -82
  2. package/dist/vscode.html-custom-data.json +13 -13
  3. package/dist/web-types.json +25 -25
  4. package/dist/zn.d.ts +128 -6
  5. package/dist/zn.min.css +1 -1
  6. package/dist/zn.min.js +469 -393
  7. package/docs/pages/components/remarkd-editor.md +59 -0
  8. package/package.json +1 -1
  9. package/scss/_root.scss +121 -8
  10. package/scss/shared/_base.scss +10 -4
  11. package/scss/shared/_button-mixin.scss +29 -0
  12. package/scss/shared/_button.scss +3 -33
  13. package/scss/themes/_aura.scss +87 -8
  14. package/scss/themes/_dark.scss +14 -2
  15. package/scss/themes/_light.scss +4 -3
  16. package/scss/themes/_modes.scss +32 -0
  17. package/src/components/animated-button/animated-button.component.ts +2 -1
  18. package/src/components/animated-button/animated-button.scss +1 -1
  19. package/src/components/bulk-actions/bulk-actions.component.ts +2 -1
  20. package/src/components/bulk-actions/bulk-actions.scss +0 -1
  21. package/src/components/button/button.component.ts +6 -1
  22. package/src/components/button/button.scss +1 -1
  23. package/src/components/chart/chart.component.ts +4 -0
  24. package/src/components/checkbox/checkbox.component.ts +3 -1
  25. package/src/components/checkbox/checkbox.scss +0 -2
  26. package/src/components/checkbox-group/checkbox-group.component.ts +2 -1
  27. package/src/components/checkbox-group/checkbox-group.scss +0 -1
  28. package/src/components/data-table/data-table.component.ts +3 -1
  29. package/src/components/data-table/data-table.scss +0 -1
  30. package/src/components/datepicker/datepicker.component.ts +2 -1
  31. package/src/components/datepicker/datepicker.scss +0 -1
  32. package/src/components/editor/modules/toolbar/toolbar.component.ts +3 -1
  33. package/src/components/editor/modules/toolbar/toolbar.scss +0 -1
  34. package/src/components/file/file.component.ts +2 -1
  35. package/src/components/file/file.scss +0 -1
  36. package/src/components/form-group/form-group.component.ts +2 -1
  37. package/src/components/form-group/form-group.scss +0 -1
  38. package/src/components/icon-picker/icon-picker.component.ts +8 -3
  39. package/src/components/icon-picker/icon-picker.scss +0 -1
  40. package/src/components/inline-edit/inline-edit.component.ts +2 -1
  41. package/src/components/inline-edit/inline-edit.scss +0 -1
  42. package/src/components/input/input.component.ts +2 -1
  43. package/src/components/input/input.scss +0 -1
  44. package/src/components/input-group/input-group.component.ts +2 -1
  45. package/src/components/input-group/input-group.scss +0 -1
  46. package/src/components/menu/menu.component.ts +4 -1
  47. package/src/components/menu/menu.scss +9 -1
  48. package/src/components/page/page.scss +19 -5
  49. package/src/components/priority-list/priority-list.component.ts +2 -1
  50. package/src/components/priority-list/priority-list.scss +0 -1
  51. package/src/components/query-builder/query-builder.component.ts +2 -1
  52. package/src/components/query-builder/query-builder.scss +0 -1
  53. package/src/components/radio/radio.component.ts +3 -1
  54. package/src/components/radio/radio.scss +0 -2
  55. package/src/components/radio-group/radio-group.component.ts +2 -1
  56. package/src/components/radio-group/radio-group.scss +0 -1
  57. package/src/components/rating/rating.component.ts +2 -1
  58. package/src/components/rating/rating.scss +0 -1
  59. package/src/components/remarkd-editor/actions.ts +155 -0
  60. package/src/components/remarkd-editor/feature-keys.ts +17 -0
  61. package/src/components/remarkd-editor/remarkd-editor.component.ts +509 -49
  62. package/src/components/remarkd-editor/remarkd-editor.scss +68 -1
  63. package/src/components/remarkd-editor/remarkd-editor.test.ts +677 -9
  64. package/src/components/schedule-builder/schedule-builder.component.ts +2 -1
  65. package/src/components/schedule-builder/schedule-builder.scss +0 -1
  66. package/src/components/select/select.component.ts +2 -1
  67. package/src/components/select/select.scss +0 -1
  68. package/src/components/slash-menu/slash-menu.scss +2 -0
  69. package/src/components/tabs/tabs.component.ts +3 -1
  70. package/src/components/tabs/tabs.scss +0 -1
  71. package/src/components/textarea/textarea.component.ts +2 -1
  72. package/src/components/textarea/textarea.scss +0 -1
  73. package/src/components/tile/tile.component.ts +33 -20
  74. package/src/components/tile/tile.scss +2 -0
  75. package/src/components/tile/tile.test.ts +64 -3
  76. package/src/components/toggle/toggle.component.ts +2 -1
  77. package/src/components/toggle/toggle.scss +0 -1
  78. package/src/components/translations/translations.component.ts +2 -1
  79. package/src/components/translations/translations.scss +0 -1
  80. package/src/internal/theme.ts +37 -12
  81. package/src/internal/toolbar-overflow.ts +100 -0
  82. package/src/internal/zinc-element.ts +7 -5
@@ -0,0 +1,155 @@
1
+ import type {SlashMenuItem} from '../slash-menu';
2
+
3
+ export type ActionGroup =
4
+ 'text' | 'lists' | 'admonitions' | 'blocks' | 'structured' | 'media' | 'objects' | 'breaks' | 'logic' | 'inline';
5
+
6
+ /** What an inline action wraps the selection in. `after` defaults to `before`. */
7
+ export interface InlineMark {
8
+ before: string;
9
+ after?: string;
10
+ placeholder?: string;
11
+ }
12
+
13
+ export interface EditorAction {
14
+ /** Stable id, used for toolbar keys and tests. */
15
+ key: string;
16
+ label: string;
17
+ icon: string;
18
+ group: ActionGroup;
19
+ /** Extra search terms for the slash menu, e.g. "bold" finds Strong. */
20
+ keywords?: string[];
21
+ /** Block actions: spliced in as a new block. */
22
+ prefix?: string;
23
+ /** Inline actions: applied to the selection in the open block. */
24
+ inline?: InlineMark;
25
+ /** Where the caret lands within `prefix`. Defaults to the end. */
26
+ caretOffset?: number;
27
+ /** Actions that open their own picker instead of inserting text. */
28
+ opens?: 'image' | 'include';
29
+ }
30
+
31
+ /** Toolbar order, most-used first — the last groups are the first to collapse. */
32
+ export const ACTION_GROUPS: { id: ActionGroup; label: string }[] = [
33
+ {id: 'text', label: 'Text'},
34
+ // Bold/italic/code are the most-reached actions in any editor — kept right after Text so
35
+ // they are among the last groups to collapse, not the first.
36
+ {id: 'inline', label: 'Inline'},
37
+ {id: 'lists', label: 'Lists'},
38
+ {id: 'admonitions', label: 'Admonitions'},
39
+ {id: 'blocks', label: 'Blocks'},
40
+ {id: 'structured', label: 'Structured'},
41
+ {id: 'media', label: 'Media'},
42
+ {id: 'objects', label: 'Objects'},
43
+ {id: 'breaks', label: 'Breaks'},
44
+ {id: 'logic', label: 'Logic'},
45
+ ];
46
+
47
+ export const EDITOR_ACTIONS: EditorAction[] = [
48
+ // Text
49
+ {key: 'text', label: 'Text', icon: 'text@lu', group: 'text', prefix: ''},
50
+ {key: 'paragraphs', label: 'Paragraph', icon: 'pilcrow@lu', group: 'text', prefix: ''},
51
+ {key: 'heading', label: 'Heading 1', icon: 'heading-1@lu', group: 'text', prefix: '# '},
52
+ {key: 'h2', label: 'Heading 2', icon: 'heading-2@lu', group: 'text', prefix: '## '},
53
+ {key: 'h3', label: 'Heading 3', icon: 'heading-3@lu', group: 'text', prefix: '### '},
54
+ {key: 'asciidoc-section', label: 'Section', icon: 'section@lu', group: 'text', prefix: '== '},
55
+ {key: 'attributes-title', label: 'Title', icon: 'captions@lu', group: 'text', prefix: '.'},
56
+
57
+ // Lists
58
+ {key: 'unordered-list', label: 'Bullet list', icon: 'list@lu', group: 'lists', prefix: '- ', keywords: ['bullet', 'ul']},
59
+ {key: 'ordered-list', label: 'Numbered list', icon: 'list-ordered@lu', group: 'lists', prefix: '1. ', keywords: ['ol']},
60
+ {key: 'checkboxes', label: 'Checklist', icon: 'list-todo@lu', group: 'lists', prefix: '- [ ] ', keywords: ['task', 'todo']},
61
+ {key: 'definition-list', label: 'Definition list', icon: 'book-a@lu', group: 'lists', prefix: 'Term:: Definition'},
62
+
63
+ // Admonitions
64
+ {key: 'admonition', label: 'Note', icon: 'info@lu', group: 'admonitions', prefix: 'NOTE: '},
65
+ {key: 'tip', label: 'Tip', icon: 'lightbulb@lu', group: 'admonitions', prefix: 'TIP: '},
66
+ {key: 'warning', label: 'Warning', icon: 'triangle-alert@lu', group: 'admonitions', prefix: 'WARNING: '},
67
+ {key: 'important', label: 'Important', icon: 'circle-alert@lu', group: 'admonitions', prefix: 'IMPORTANT: '},
68
+ {key: 'caution', label: 'Caution', icon: 'shield-alert@lu', group: 'admonitions', prefix: 'CAUTION: '},
69
+ {key: 'danger', label: 'Danger', icon: 'octagon-alert@lu', group: 'admonitions', prefix: 'DANGER: '},
70
+ {key: 'success', label: 'Success', icon: 'circle-check@lu', group: 'admonitions', prefix: 'SUCCESS: '},
71
+ {key: 'notice', label: 'Notice', icon: 'megaphone@lu', group: 'admonitions', prefix: 'NOTICE: '},
72
+
73
+ // Blocks — caretOffset lands inside the delimiters
74
+ {key: 'code-fence', label: 'Code', icon: 'code@lu', group: 'blocks', prefix: '```\n\n```', caretOffset: 4},
75
+ {key: 'blockquotes', label: 'Quote', icon: 'quote@lu', group: 'blocks', prefix: '____\n\n____', caretOffset: 5},
76
+ {key: 'verse', label: 'Verse', icon: 'feather@lu', group: 'blocks', prefix: '[verse]\n____\n\n____', caretOffset: 13},
77
+ {key: 'sidebar-block', label: 'Sidebar', icon: 'panel-right@lu', group: 'blocks', prefix: '****\n\n****', caretOffset: 5},
78
+ {key: 'example-block', label: 'Example', icon: 'square-dashed@lu', group: 'blocks', prefix: '====\n\n====', caretOffset: 5},
79
+ {key: 'literal-block', label: 'Literal', icon: 'file-code@lu', group: 'blocks', prefix: '....\n\n....', caretOffset: 5},
80
+ {key: 'listing-block', label: 'Listing', icon: 'terminal@lu', group: 'blocks', prefix: '----\n\n----', caretOffset: 5},
81
+ {key: 'generic-container', label: 'Container', icon: 'box@lu', group: 'blocks', prefix: '!!!!\n\n!!!!', caretOffset: 5},
82
+ {key: 'hardbreaks', label: 'Hard breaks', icon: 'wrap-text@lu', group: 'blocks', prefix: '[%hardbreaks]\n', keywords: ['line breaks']},
83
+
84
+ // Structured
85
+ {key: 'tabs', label: 'Tabs', icon: 'app-window@lu', group: 'structured', prefix: '_|_#first [name=First]\nFirst content', caretOffset: 16},
86
+ {key: 'steps', label: 'Steps', icon: 'list-checks@lu', group: 'structured', prefix: '_|- First step\nDo first', caretOffset: 4},
87
+ {key: 'callout-block', label: 'Callout', icon: 'message-square-code@lu', group: 'structured', prefix: '<1> '},
88
+
89
+ // Media
90
+ {key: 'asciidoc-image', label: 'Image', icon: 'image@lu', group: 'media', opens: 'image'},
91
+ {key: 'video', label: 'Video', icon: 'video@lu', group: 'media', prefix: '{{video:ID source=youtube}}', caretOffset: 8},
92
+ {key: 'include', label: 'Include', icon: 'blocks@lu', group: 'media', opens: 'include'},
93
+ // The path placeholder is load-bearing: `t::partial::` with an empty path makes parse() throw.
94
+ {key: 'partial', label: 'Partial', icon: 'file-stack@lu', group: 'media', prefix: 't::partial::path/to/file.remarkd', caretOffset: 12},
95
+ {key: 'reference-list', label: 'Reference list', icon: 'book-marked@lu', group: 'media', prefix: '{{reflist}}'},
96
+
97
+ // Objects
98
+ {key: 'button-object', label: 'Button', icon: 'mouse-pointer-click@lu', group: 'objects', prefix: '{{button:action text="Label" href=/}}', caretOffset: 9},
99
+ {key: 'object-macros', label: 'Link object', icon: 'external-link@lu', group: 'objects', prefix: '{{link:https:// text=Label}}', caretOffset: 7},
100
+ {key: 'meter', label: 'Meter', icon: 'gauge@lu', group: 'objects', prefix: '{{meter id=progress min=0 max=10 value=5}}', caretOffset: 11},
101
+ {key: 'object-attributes', label: 'Break object', icon: 'separator-horizontal@lu', group: 'objects', prefix: '{{br}}'},
102
+
103
+ // Breaks
104
+ {key: 'horizontal-rule', label: 'Divider', icon: 'minus@lu', group: 'breaks', prefix: '---', keywords: ['rule', 'hr']},
105
+ {key: 'page-break', label: 'Page break', icon: 'scissors-line-dashed@lu', group: 'breaks', prefix: '<<<'},
106
+ {key: 'line-continuation', label: 'Line continuation', icon: 'corner-down-left@lu', group: 'breaks', prefix: ' \\'},
107
+
108
+ // Logic — marked in the preview, never evaluated
109
+ {key: 'document-attributes', label: 'Variable', icon: 'variable@lu', group: 'logic', prefix: ':name: value', caretOffset: 1, keywords: ['attribute', 'variable']},
110
+ {key: 'conditionals', label: 'If defined', icon: 'git-branch@lu', group: 'logic', prefix: 'ifdef::flag[]\n\nendif::[]', caretOffset: 7},
111
+ {key: 'ifndef', label: 'If not defined', icon: 'git-branch-minus@lu', group: 'logic', prefix: 'ifndef::flag[]\n\nendif::[]', caretOffset: 8},
112
+ {key: 'iftrue', label: 'If true', icon: 'toggle-right@lu', group: 'logic', prefix: 'iftrue::flag[Shown]', caretOffset: 8},
113
+ {key: 'iffalse', label: 'If false', icon: 'toggle-left@lu', group: 'logic', prefix: 'iffalse::flag[Shown]', caretOffset: 9},
114
+ {key: 'ifempty', label: 'If empty', icon: 'square@lu', group: 'logic', prefix: 'ifempty::flag[Shown]', caretOffset: 9},
115
+ {key: 'ifnempty', label: 'If not empty', icon: 'square-check@lu', group: 'logic', prefix: 'ifnempty::flag[Shown]', caretOffset: 10},
116
+ {key: 'ifeval', label: 'If expression', icon: 'equal@lu', group: 'logic', prefix: 'ifeval::[1 > 0]\n\nendif::[]', caretOffset: 9},
117
+
118
+ // Inline — applied to the selection in the open block
119
+ {key: 'inline-formatting', label: 'Strong', icon: 'bold@lu', group: 'inline', keywords: ['bold'], inline: {before: '**', placeholder: 'text'}},
120
+ {key: 'emphasis', label: 'Emphasis', icon: 'italic@lu', group: 'inline', keywords: ['italic'], inline: {before: '__', placeholder: 'text'}},
121
+ {key: 'inline-code', label: 'Code', icon: 'square-code@lu', group: 'inline', inline: {before: '`', placeholder: 'code'}},
122
+ {key: 'underline', label: 'Underline', icon: 'underline@lu', group: 'inline', inline: {before: '___', placeholder: 'text'}},
123
+ {key: 'strike', label: 'Strikethrough', icon: 'strikethrough@lu', group: 'inline', keywords: ['delete'], inline: {before: '~~', placeholder: 'text'}},
124
+ {key: 'subscript', label: 'Subscript', icon: 'subscript@lu', group: 'inline', inline: {before: '~', placeholder: '2'}},
125
+ {key: 'superscript', label: 'Superscript', icon: 'superscript@lu', group: 'inline', inline: {before: '^', placeholder: '2'}},
126
+ {key: 'keyboard', label: 'Keyboard', icon: 'keyboard@lu', group: 'inline', keywords: ['kbd', 'shortcut'], inline: {before: 'kbd:[', after: ']', placeholder: 'Ctrl+C'}},
127
+ {key: 'footnote', label: 'Footnote', icon: 'asterisk@lu', group: 'inline', inline: {before: 'footnote:[', after: ']', placeholder: 'Note'}},
128
+ {key: 'tooltip', label: 'Tooltip', icon: 'message-circle-question-mark@lu', group: 'inline', keywords: ['term'], inline: {before: '{', after: '}(Explanation)', placeholder: 'Term'}},
129
+ {key: 'cross-reference', label: 'Cross reference', icon: 'link-2@lu', group: 'inline', keywords: ['xref'], inline: {before: '<<', after: '>>', placeholder: 'section,Label'}},
130
+ {key: 'links-and-images', label: 'Link', icon: 'link@lu', group: 'inline', inline: {before: '[', after: '](https://)', placeholder: 'Label'}},
131
+ {key: 'passthrough', label: 'Passthrough', icon: 'shield@lu', group: 'inline', keywords: ['raw', 'literal'], inline: {before: 'pass:[', after: ']', placeholder: 'raw'}},
132
+ {key: 'curly-bang-passthrough', label: 'Literal braces', icon: 'braces@lu', group: 'inline', inline: {before: '{!', after: '!}', placeholder: 'raw'}},
133
+ ];
134
+
135
+ /** The registry as slash menu entries. Picker actions insert nothing; the menu emits their action id. */
136
+ export function slashItems(actions: EditorAction[]): SlashMenuItem[] {
137
+ const label = (id: ActionGroup) => ACTION_GROUPS.find(group => group.id === id)?.label;
138
+ return actions.map(action => {
139
+ if (action.opens) {
140
+ return {label: action.label, icon: action.icon, action: action.opens, group: label(action.group), keywords: action.keywords};
141
+ }
142
+ // Inline actions have no textarea selection to wrap from the slash menu, so insert the
143
+ // whole construct with the caret at the placeholder — a bare `before` would leave the
144
+ // mark unclosed (`**` with nothing selected to wrap).
145
+ const {before, after = before, placeholder = ''} = action.inline ?? {before: action.prefix ?? ''};
146
+ return {
147
+ label: action.label,
148
+ icon: action.icon,
149
+ group: label(action.group),
150
+ keywords: action.keywords,
151
+ value: action.inline ? before + placeholder + after : before,
152
+ caretOffset: action.inline ? before.length : action.caretOffset,
153
+ };
154
+ });
155
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The remarkd feature fixtures, from `node_modules/remarkd-js/requirements/features/`.
3
+ * Regenerate with: ls node_modules/remarkd-js/requirements/features
4
+ */
5
+ export const FEATURE_KEYS: string[] = [
6
+ 'accordion', 'admonition', 'asciidoc-image', 'asciidoc-section', 'attributes-title', 'autolink',
7
+ 'blockquotes', 'button-object', 'callout-block', 'checkboxes', 'code-fence', 'comments',
8
+ 'conditionals', 'conditionals-advanced', 'cross-reference', 'curly-bang-passthrough',
9
+ 'definition-list', 'document-attributes', 'emoji-aliases', 'example-block', 'footnote',
10
+ 'generic-container', 'hardbreaks', 'heading', 'highlight', 'horizontal-rule', 'id-block',
11
+ 'image-alignment', 'include', 'inline-advanced', 'inline-formatting', 'keyboard',
12
+ 'line-continuation', 'links-and-images', 'listing-block', 'literal-block', 'object-attributes',
13
+ 'object-fallbacks', 'object-macros', 'ordered-list', 'page-break', 'paragraphs', 'partial',
14
+ 'passthrough', 'pros-cons', 'reference-list', 'sidebar-block', 'smart-quotes', 'steps',
15
+ 'subscript', 'superscript', 'table', 'tabs', 'tooltip', 'typographic-symbols',
16
+ 'unordered-list', 'url-formatting-chars', 'verse', 'video',
17
+ ];