@kubex/zinc 1.1.79 → 1.1.81

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 (38) hide show
  1. package/dist/custom-elements.json +1398 -109
  2. package/dist/vscode.html-custom-data.json +202 -3
  3. package/dist/web-types.json +478 -4
  4. package/dist/zn.d.ts +467 -8
  5. package/dist/zn.min.js +388 -316
  6. package/docs/pages/components/inline-edit.md +22 -0
  7. package/docs/pages/components/input.md +21 -0
  8. package/docs/pages/components/remarkd-editor.md +43 -0
  9. package/docs/pages/components/slash-item.md +126 -0
  10. package/docs/pages/components/slash-menu.md +161 -0
  11. package/docs/pages/components/textarea.md +148 -0
  12. package/docs/pages/components/translations.md +34 -0
  13. package/package.json +1 -1
  14. package/src/components/inline-edit/inline-edit.component.ts +36 -0
  15. package/src/components/inline-edit/inline-edit.test.ts +83 -1
  16. package/src/components/input/input.component.ts +143 -0
  17. package/src/components/input/input.test.ts +113 -1
  18. package/src/components/remarkd-editor/remarkd-editor.component.ts +157 -95
  19. package/src/components/remarkd-editor/remarkd-editor.scss +24 -36
  20. package/src/components/remarkd-editor/remarkd-editor.test.ts +110 -6
  21. package/src/components/slash-item/index.ts +12 -0
  22. package/src/components/slash-item/slash-item.component.ts +76 -0
  23. package/src/components/slash-item/slash-item.scss +5 -0
  24. package/src/components/slash-menu/index.ts +14 -0
  25. package/src/components/slash-menu/slash-menu-controller.ts +361 -0
  26. package/src/components/slash-menu/slash-menu-items.ts +122 -0
  27. package/src/components/slash-menu/slash-menu.component.ts +327 -0
  28. package/src/components/slash-menu/slash-menu.scss +120 -0
  29. package/src/components/slash-menu/slash-menu.test.ts +154 -0
  30. package/src/components/textarea/textarea.component.ts +143 -0
  31. package/src/components/textarea/textarea.test.ts +310 -2
  32. package/src/components/translations/translations.component.ts +31 -0
  33. package/src/components/translations/translations.test.ts +89 -1
  34. package/src/events/events.ts +2 -0
  35. package/src/events/zn-slash-insert.ts +9 -0
  36. package/src/events/zn-slash-select.ts +9 -0
  37. package/src/utilities/caret-position.ts +118 -0
  38. package/src/zinc.ts +3 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@kubex/zinc",
4
- "version": "1.1.79",
4
+ "version": "1.1.81",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -4571,6 +4571,26 @@
4571
4571
  }
4572
4572
  },
4573
4573
  { "name": "textarea-rows", "value": { "type": "1" } },
4574
+ {
4575
+ "name": "slash-items",
4576
+ "description": "Quick insertions offered by the slash menu of a `text` or `textarea` input. Accepts a JSON array of items, or\nthe shorthand `Brand name={{BRAND_NAME}}, Support email={{SUPPORT_EMAIL}}`.",
4577
+ "value": { "type": "SlashMenuItem[]", "default": "[]" }
4578
+ },
4579
+ {
4580
+ "name": "slash-preset",
4581
+ "description": "Names of item sets registered with `registerSlashMenuPreset`, comma separated.",
4582
+ "value": { "type": "string", "default": "''" }
4583
+ },
4584
+ {
4585
+ "name": "slash-trigger",
4586
+ "description": "The characters that open the slash menu.",
4587
+ "value": { "type": "string", "default": "'/'" }
4588
+ },
4589
+ {
4590
+ "name": "slash-heading",
4591
+ "description": "The heading shown above the slash menu's items.",
4592
+ "value": { "type": "string", "default": "'Insert'" }
4593
+ },
4574
4594
  {
4575
4595
  "name": "options",
4576
4596
  "value": { "type": "{ [key: string]: string }", "default": "{}" }
@@ -4666,6 +4686,31 @@
4666
4686
  "type": "'select' | 'text' | 'data-select' | 'number' | 'textarea'"
4667
4687
  },
4668
4688
  { "name": "textareaRows", "type": "1" },
4689
+ {
4690
+ "name": "slashItems",
4691
+ "description": "Quick insertions offered by the slash menu of a `text` or `textarea` input. Accepts a JSON array of items, or\nthe shorthand `Brand name={{BRAND_NAME}}, Support email={{SUPPORT_EMAIL}}`.",
4692
+ "type": "SlashMenuItem[]"
4693
+ },
4694
+ {
4695
+ "name": "slashPreset",
4696
+ "description": "Names of item sets registered with `registerSlashMenuPreset`, comma separated.",
4697
+ "type": "string"
4698
+ },
4699
+ {
4700
+ "name": "slashTrigger",
4701
+ "description": "The characters that open the slash menu.",
4702
+ "type": "string"
4703
+ },
4704
+ {
4705
+ "name": "slashHeading",
4706
+ "description": "The heading shown above the slash menu's items.",
4707
+ "type": "string"
4708
+ },
4709
+ {
4710
+ "name": "slashItemsProvider",
4711
+ "description": "Resolves additional slash menu items each time the menu opens. JavaScript only.",
4712
+ "type": "(query: string) => SlashMenuItem[] | Promise<SlashMenuItem[]> | undefined"
4713
+ },
4669
4714
  { "name": "options", "type": "{ [key: string]: string }" },
4670
4715
  { "name": "selectProvider", "type": "string" },
4671
4716
  { "name": "iconPosition", "type": "'start' | 'end' | 'none'" },
@@ -4730,7 +4775,7 @@
4730
4775
  },
4731
4776
  {
4732
4777
  "name": "zn-input",
4733
- "description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-blur** - Emitted when the control loses focus.\n- **zn-change** - Emitted when an alteration to the control's value is committed by the user.\n- **zn-clear** - Emitted when the clear button is activated.\n- **zn-focus** - Emitted when the control gains focus.\n- **zn-input** - Emitted when the control receives input.\n- **zn-invalid** - Emitted when the form control has been checked for validity and its constraints aren't satisfied.\n\n### **Methods:**\n - **focus(options: _FocusOptions_)** - Sets focus on the input.\n- **blur()** - Removes focus from the input.\n- **select()** - Selects all the text in the input.\n- **setSelectionRange(selectionStart: _number_, selectionEnd: _number_, selectionDirection: _'forward' | 'backward' | 'none'_)** - Sets the start and end positions of the text selection (0-based).\n- **setRangeText(replacement: _string_, start: _number_, end: _number_, selectMode: _'select' | 'start' | 'end' | 'preserve'_)** - Replaces a range of text with a new string.\n- **showPicker()** - Displays the browser picker for an input element (only works if the browser supports it for the input type).\n- **stepUp()** - Increments the value of a numeric input type by the value of the step attribute.\n- **stepDown()** - Decrements the value of a numeric input type by the value of the step attribute.\n- **checkValidity(): _boolean_** - Checks the validity but does not show a validation message. Returns `true` when valid and `false` when invalid.\n- **getForm(): _HTMLFormElement | null_** - Gets the associated form, if one exists.\n- **reportValidity()** - Checks for validity and shows the browser's validation message if the control is invalid.\n- **setCustomValidity(message: _string_)** - Sets a custom validation message. Pass an empty string to restore validity.\n\n### **Slots:**\n - **label** - The input's label. Alternatively, you can use the `label` attribute.\n- **label-tooltip** - Used to add text that is displayed in a tooltip next to the label. Alternatively, you can use the `label-tooltip` attribute.\n- **context-note** - Used to add contextual text that is displayed above the input, on the right. Alternatively, you can use the `context-note` attribute. Range inputs display their live value here unless this is set.\n- **prefix** - Used to prepend a presentational icon or similar element to the input.\n- **suffix** - Used to append a presentational icon or similar element to the input.\n- **clear-icon** - An icon to use in lieu of the default clear icon.\n- **show-password-icon** - An icon to use in lieu of the default show password icon.\n- **hide-password-icon** - An icon to use in lieu of the default hide password icon.\n- **help-text** - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute.\n\n### **CSS Properties:**\n - **--zn-range-track-height** - The height of a range input's track. _(default: undefined)_\n- **--zn-range-track-color** - The color of a range input's track. _(default: undefined)_\n- **--zn-range-thumb-size** - The diameter of a range input's thumb. _(default: undefined)_\n- **--zn-range-thumb-color** - The color of a range input's thumb. _(default: undefined)_\n- **--zn-range-thumb-ring-width** - The width of the ring drawn around a range input's thumb. _(default: undefined)_\n\n### **CSS Parts:**\n - **form-control** - The form control that wraps the label, input, and help text.\n- **form-control-label** - The label's wrapper.\n- **form-control-input** - The input's wrapper.\n- **form-control-help-text** - The help text's wrapper.\n- **base** - The component's base wrapper.\n- **input** - The internal `<input>` control.\n- **prefix** - The container that wraps the prefix.\n- **clear-button** - The clear button.\n- **password-toggle-button** - The password toggle button.\n- **suffix** - The container that wraps the suffix.",
4778
+ "description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-blur** - Emitted when the control loses focus.\n- **zn-change** - Emitted when an alteration to the control's value is committed by the user.\n- **zn-clear** - Emitted when the clear button is activated.\n- **zn-focus** - Emitted when the control gains focus.\n- **zn-input** - Emitted when the control receives input.\n- **zn-invalid** - Emitted when the form control has been checked for validity and its constraints aren't satisfied.\n- **zn-slash-select** - Emitted when a slash menu item is chosen. Cancelable — call `preventDefault()` to suppress the insertion and handle the item yourself.\n- **zn-slash-insert** - Emitted after a slash menu item's value has been inserted.\n\n### **Methods:**\n - **resolveSlashItems(search): _Promise<SlashMenuItem[]>_** - The insertions the slash menu offers, gathered from every source, in the order they were declared.\n- **showSlashMenu()** - Opens the slash menu at the caret, inserting the trigger if it isn't already there.\n- **hideSlashMenu()** - Closes the slash menu.\n- **focus(options: _FocusOptions_)** - Sets focus on the input.\n- **blur()** - Removes focus from the input.\n- **select()** - Selects all the text in the input.\n- **setSelectionRange(selectionStart: _number_, selectionEnd: _number_, selectionDirection: _'forward' | 'backward' | 'none'_)** - Sets the start and end positions of the text selection (0-based).\n- **setRangeText(replacement: _string_, start: _number_, end: _number_, selectMode: _'select' | 'start' | 'end' | 'preserve'_)** - Replaces a range of text with a new string.\n- **showPicker()** - Displays the browser picker for an input element (only works if the browser supports it for the input type).\n- **stepUp()** - Increments the value of a numeric input type by the value of the step attribute.\n- **stepDown()** - Decrements the value of a numeric input type by the value of the step attribute.\n- **checkValidity(): _boolean_** - Checks the validity but does not show a validation message. Returns `true` when valid and `false` when invalid.\n- **getForm(): _HTMLFormElement | null_** - Gets the associated form, if one exists.\n- **reportValidity()** - Checks for validity and shows the browser's validation message if the control is invalid.\n- **setCustomValidity(message: _string_)** - Sets a custom validation message. Pass an empty string to restore validity.\n\n### **Slots:**\n - **label** - The input's label. Alternatively, you can use the `label` attribute.\n- **label-tooltip** - Used to add text that is displayed in a tooltip next to the label. Alternatively, you can use the `label-tooltip` attribute.\n- **context-note** - Used to add contextual text that is displayed above the input, on the right. Alternatively, you can use the `context-note` attribute. Range inputs display their live value here unless this is set.\n- **prefix** - Used to prepend a presentational icon or similar element to the input.\n- **suffix** - Used to append a presentational icon or similar element to the input.\n- **clear-icon** - An icon to use in lieu of the default clear icon.\n- **show-password-icon** - An icon to use in lieu of the default show password icon.\n- **hide-password-icon** - An icon to use in lieu of the default hide password icon.\n- **help-text** - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute.\n- **slash-items** - `<zn-slash-item>` elements describing the insertions offered by the slash menu. Items are picked up wherever they sit inside the input, so this slot name is optional.\n- **slash-menu** - A `<zn-slash-menu>` to use instead of the built-in one, so its heading, sizing and styling can be set in markup. Any `<zn-slash-item>` children of it become the menu's items.\n\n### **CSS Properties:**\n - **--zn-range-track-height** - The height of a range input's track. _(default: undefined)_\n- **--zn-range-track-color** - The color of a range input's track. _(default: undefined)_\n- **--zn-range-thumb-size** - The diameter of a range input's thumb. _(default: undefined)_\n- **--zn-range-thumb-color** - The color of a range input's thumb. _(default: undefined)_\n- **--zn-range-thumb-ring-width** - The width of the ring drawn around a range input's thumb. _(default: undefined)_\n\n### **CSS Parts:**\n - **form-control** - The form control that wraps the label, input, and help text.\n- **slash-menu** - The slash menu shown at the caret.\n- **form-control-label** - The label's wrapper.\n- **form-control-input** - The input's wrapper.\n- **form-control-help-text** - The help text's wrapper.\n- **base** - The component's base wrapper.\n- **input** - The internal `<input>` control.\n- **prefix** - The container that wraps the prefix.\n- **clear-button** - The clear button.\n- **password-toggle-button** - The password toggle button.\n- **suffix** - The container that wraps the suffix.",
4734
4779
  "doc-url": "",
4735
4780
  "attributes": [
4736
4781
  {
@@ -4927,6 +4972,26 @@
4927
4972
  "type": "'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'"
4928
4973
  }
4929
4974
  },
4975
+ {
4976
+ "name": "slash-items",
4977
+ "description": "Quick insertions offered by the slash menu. Accepts a JSON array of items, or the shorthand\n`Brand name={{BRAND_NAME}}, Support email={{SUPPORT_EMAIL}}`. Can also be set as an array of\n`SlashMenuItem` objects in JavaScript.",
4978
+ "value": { "type": "SlashMenuItem[]", "default": "[]" }
4979
+ },
4980
+ {
4981
+ "name": "slash-preset",
4982
+ "description": "Names of item sets registered with `registerSlashMenuPreset`, comma separated.",
4983
+ "value": { "type": "string", "default": "''" }
4984
+ },
4985
+ {
4986
+ "name": "slash-trigger",
4987
+ "description": "The characters that open the slash menu.",
4988
+ "value": { "type": "string", "default": "'/'" }
4989
+ },
4990
+ {
4991
+ "name": "slash-heading",
4992
+ "description": "The heading shown above the slash menu's items.",
4993
+ "value": { "type": "string", "default": "'Insert'" }
4994
+ },
4930
4995
  {
4931
4996
  "name": "trigger-submit",
4932
4997
  "description": "When enabled, pressing enter will always submit the surrounding form, even when the form uses\nenter-navigation to move between fields.",
@@ -4969,6 +5034,14 @@
4969
5034
  {
4970
5035
  "name": "help-text",
4971
5036
  "description": "Text that describes how to use the input. Alternatively, you can use the `help-text` attribute."
5037
+ },
5038
+ {
5039
+ "name": "slash-items",
5040
+ "description": "`<zn-slash-item>` elements describing the insertions offered by the slash menu. Items are picked up wherever they sit inside the input, so this slot name is optional."
5041
+ },
5042
+ {
5043
+ "name": "slash-menu",
5044
+ "description": "A `<zn-slash-menu>` to use instead of the built-in one, so its heading, sizing and styling can be set in markup. Any `<zn-slash-item>` children of it become the menu's items."
4972
5045
  }
4973
5046
  ],
4974
5047
  "events": [
@@ -4995,12 +5068,21 @@
4995
5068
  {
4996
5069
  "name": "zn-invalid",
4997
5070
  "description": "Emitted when the form control has been checked for validity and its constraints aren't satisfied."
5071
+ },
5072
+ {
5073
+ "name": "zn-slash-select",
5074
+ "description": "Emitted when a slash menu item is chosen. Cancelable — call `preventDefault()` to suppress the insertion and handle the item yourself."
5075
+ },
5076
+ {
5077
+ "name": "zn-slash-insert",
5078
+ "description": "Emitted after a slash menu item's value has been inserted."
4998
5079
  }
4999
5080
  ],
5000
5081
  "js": {
5001
5082
  "properties": [
5002
5083
  { "name": "input", "type": "HTMLInputElement" },
5003
5084
  { "name": "colorPicker", "type": "HTMLInputElement" },
5085
+ { "name": "slashMenuElement", "type": "ZnSlashMenu | null" },
5004
5086
  { "name": "title", "type": "string" },
5005
5087
  {
5006
5088
  "name": "type",
@@ -5182,6 +5264,31 @@
5182
5264
  "description": "Tells the browser what type of data will be entered by the user, allowing it to display the appropriate virtual\nkeyboard on supportive devices.",
5183
5265
  "type": "'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'"
5184
5266
  },
5267
+ {
5268
+ "name": "slashItems",
5269
+ "description": "Quick insertions offered by the slash menu. Accepts a JSON array of items, or the shorthand\n`Brand name={{BRAND_NAME}}, Support email={{SUPPORT_EMAIL}}`. Can also be set as an array of\n`SlashMenuItem` objects in JavaScript.",
5270
+ "type": "SlashMenuItem[]"
5271
+ },
5272
+ {
5273
+ "name": "slashPreset",
5274
+ "description": "Names of item sets registered with `registerSlashMenuPreset`, comma separated.",
5275
+ "type": "string"
5276
+ },
5277
+ {
5278
+ "name": "slashTrigger",
5279
+ "description": "The characters that open the slash menu.",
5280
+ "type": "string"
5281
+ },
5282
+ {
5283
+ "name": "slashHeading",
5284
+ "description": "The heading shown above the slash menu's items.",
5285
+ "type": "string"
5286
+ },
5287
+ {
5288
+ "name": "slashItemsProvider",
5289
+ "description": "Resolves additional items each time the menu opens, for lists that come from elsewhere (e.g. an\nAPI). Receives the current query and may return a promise. JavaScript only.",
5290
+ "type": "(query: string) => SlashMenuItem[] | Promise<SlashMenuItem[]> | undefined"
5291
+ },
5185
5292
  {
5186
5293
  "name": "triggerSubmit",
5187
5294
  "description": "When enabled, pressing enter will always submit the surrounding form, even when the form uses\nenter-navigation to move between fields.",
@@ -5228,6 +5335,14 @@
5228
5335
  {
5229
5336
  "name": "zn-invalid",
5230
5337
  "description": "Emitted when the form control has been checked for validity and its constraints aren't satisfied."
5338
+ },
5339
+ {
5340
+ "name": "zn-slash-select",
5341
+ "description": "Emitted when a slash menu item is chosen. Cancelable — call `preventDefault()` to suppress the insertion and handle the item yourself."
5342
+ },
5343
+ {
5344
+ "name": "zn-slash-insert",
5345
+ "description": "Emitted after a slash menu item's value has been inserted."
5231
5346
  }
5232
5347
  ]
5233
5348
  }
@@ -7803,7 +7918,7 @@
7803
7918
  },
7804
7919
  {
7805
7920
  "name": "zn-remarkd-editor",
7806
- "description": "A Notion-style block editor for remarkd content. Blocks render inline; click one to edit its source.\n---\n\n\n### **Events:**\n - **zn-input** - Emitted on each keystroke while editing a block.\n- **zn-change** - Emitted when a block edit is committed and the value changes.\n\n### **Methods:**\n - **focus()** - Starts editing the first block, or a new block if the document is empty.\n- **blur()** - Commits any in-progress block edit.\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.\n- **toolbar** - The always-visible block-insert toolbar.\n- **block** - A rendered block wrapper.\n- **rendered** - The rendered remarkd output of a block.\n- **input** - The textarea shown while editing a block.\n- **slash-menu** - The context menu opened by typing \"/\" in a block.\n- **image-controls** - The caption / alignment / size panel shown when an image block is clicked.",
7921
+ "description": "A Notion-style block editor for remarkd content. Blocks render inline; click one to edit its source.\n---\n\n\n### **Events:**\n - **zn-input** - Emitted on each keystroke while editing a block.\n- **zn-change** - Emitted when a block edit is committed and the value changes.\n\n### **Methods:**\n - **focus()** - Starts editing the first block, or a new block if the document is empty.\n- **blur()** - Commits any in-progress block or raw edit.\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.\n- **toolbar** - The always-visible block-insert toolbar.\n- **raw-toggle** - The button that switches between the block view and the raw source view.\n- **block** - A rendered block wrapper.\n- **rendered** - The rendered remarkd output of a block.\n- **input** - The textarea shown while editing a block.\n- **raw** - The full-document textarea shown in raw source mode.\n- **slash-menu** - The `zn-slash-menu` opened by typing \"/\" in an empty block.\n- **image-controls** - The caption / alignment / size panel shown when an image block is clicked.",
7807
7922
  "doc-url": "",
7808
7923
  "attributes": [
7809
7924
  {
@@ -7826,6 +7941,11 @@
7826
7941
  "description": "Endpoint for image uploads — required for image support. Posting the file\nmetadata here must return `{uploadPath, uploadUrl}`; the file is then PUT\nto `uploadUrl` and the returned `uploadPath` is embedded as the image URL.",
7827
7942
  "value": { "type": "string", "default": "''" }
7828
7943
  },
7944
+ {
7945
+ "name": "allow-raw",
7946
+ "description": "Adds a toolbar toggle that swaps the block view for the full remarkd source.",
7947
+ "value": { "type": "boolean", "default": "false" }
7948
+ },
7829
7949
  {
7830
7950
  "name": "required",
7831
7951
  "description": "Makes the editor required for form submission.",
@@ -7879,6 +7999,11 @@
7879
7999
  "description": "Endpoint for image uploads — required for image support. Posting the file\nmetadata here must return `{uploadPath, uploadUrl}`; the file is then PUT\nto `uploadUrl` and the returned `uploadPath` is embedded as the image URL.",
7880
8000
  "type": "string"
7881
8001
  },
8002
+ {
8003
+ "name": "allowRaw",
8004
+ "description": "Adds a toolbar toggle that swaps the block view for the full remarkd source.",
8005
+ "type": "boolean"
8006
+ },
7882
8007
  {
7883
8008
  "name": "required",
7884
8009
  "description": "Makes the editor required for form submission.",
@@ -8670,6 +8795,240 @@
8670
8795
  "events": []
8671
8796
  }
8672
8797
  },
8798
+ {
8799
+ "name": "zn-slash-item",
8800
+ "description": "Declares a single insertion for a slash menu. Renders nothing itself — it describes an\nentry for the component it is slotted into, e.g. `<zn-textarea>`'s `slash-items` slot.\n---\n\n\n### **Methods:**\n - **toSlashMenuItem(): _SlashMenuItem_** - The item as the slash menu consumes it.\n\n### **Slots:**\n - _default_ - The text to insert, for values that are long or span multiple lines. Ignored when the `value` attribute is set.",
8801
+ "doc-url": "",
8802
+ "attributes": [
8803
+ {
8804
+ "name": "label",
8805
+ "description": "The text shown in the menu.",
8806
+ "value": { "type": "string", "default": "''" }
8807
+ },
8808
+ {
8809
+ "name": "value",
8810
+ "description": "The text inserted into the field. Falls back to this element's text content.",
8811
+ "value": { "type": "string" }
8812
+ },
8813
+ {
8814
+ "name": "icon",
8815
+ "description": "Icon shown against the item, e.g. `tag@lu`.",
8816
+ "value": { "type": "string" }
8817
+ },
8818
+ {
8819
+ "name": "description",
8820
+ "description": "Supporting text shown under the label.",
8821
+ "value": { "type": "string" }
8822
+ },
8823
+ {
8824
+ "name": "keywords",
8825
+ "description": "Extra terms the item can be found by, comma separated.",
8826
+ "value": { "type": "string" }
8827
+ },
8828
+ {
8829
+ "name": "group",
8830
+ "description": "Heading the item is listed under.",
8831
+ "value": { "type": "string" }
8832
+ },
8833
+ {
8834
+ "name": "order",
8835
+ "description": "Overrides the item's position in the menu. Lower sorts first.",
8836
+ "value": { "type": "number" }
8837
+ },
8838
+ {
8839
+ "name": "caret-offset",
8840
+ "description": "Where the caret lands after insertion, as an offset into the inserted value.",
8841
+ "value": { "type": "number" }
8842
+ },
8843
+ {
8844
+ "name": "action",
8845
+ "description": "Identifier passed through on `zn-slash-select`, for items that do something other than insert.",
8846
+ "value": { "type": "string" }
8847
+ },
8848
+ {
8849
+ "name": "disabled",
8850
+ "description": "Listed, but not selectable.",
8851
+ "value": { "type": "boolean", "default": "false" }
8852
+ }
8853
+ ],
8854
+ "slots": [
8855
+ {
8856
+ "name": "",
8857
+ "description": "The text to insert, for values that are long or span multiple lines. Ignored when the `value` attribute is set."
8858
+ }
8859
+ ],
8860
+ "events": [],
8861
+ "js": {
8862
+ "properties": [
8863
+ {
8864
+ "name": "label",
8865
+ "description": "The text shown in the menu.",
8866
+ "type": "string"
8867
+ },
8868
+ {
8869
+ "name": "value",
8870
+ "description": "The text inserted into the field. Falls back to this element's text content.",
8871
+ "type": "string"
8872
+ },
8873
+ {
8874
+ "name": "icon",
8875
+ "description": "Icon shown against the item, e.g. `tag@lu`.",
8876
+ "type": "string"
8877
+ },
8878
+ {
8879
+ "name": "description",
8880
+ "description": "Supporting text shown under the label.",
8881
+ "type": "string"
8882
+ },
8883
+ {
8884
+ "name": "keywords",
8885
+ "description": "Extra terms the item can be found by, comma separated.",
8886
+ "type": "string"
8887
+ },
8888
+ {
8889
+ "name": "group",
8890
+ "description": "Heading the item is listed under.",
8891
+ "type": "string"
8892
+ },
8893
+ {
8894
+ "name": "order",
8895
+ "description": "Overrides the item's position in the menu. Lower sorts first.",
8896
+ "type": "number"
8897
+ },
8898
+ {
8899
+ "name": "caretOffset",
8900
+ "description": "Where the caret lands after insertion, as an offset into the inserted value.",
8901
+ "type": "number"
8902
+ },
8903
+ {
8904
+ "name": "action",
8905
+ "description": "Identifier passed through on `zn-slash-select`, for items that do something other than insert.",
8906
+ "type": "string"
8907
+ },
8908
+ {
8909
+ "name": "disabled",
8910
+ "description": "Listed, but not selectable.",
8911
+ "type": "boolean"
8912
+ }
8913
+ ],
8914
+ "events": []
8915
+ }
8916
+ },
8917
+ {
8918
+ "name": "zn-slash-menu",
8919
+ "description": "A keyboard-driven list of insertions, anchored to the caret of the field that opened it.\n---\n\n\n### **Events:**\n - **SLASH_ITEM_SELECT**\n- **zn-slash-item-select** - Emitted when an item is chosen. Does not cross shadow boundaries; the component driving the menu (e.g. `zn-textarea`) re-emits it as `zn-slash-select`.\n\n### **Methods:**\n - **setActiveIndex(index: _number_)** - Sets the active item by index, wrapping at both ends and skipping disabled items.\n- **moveActive(delta: _number_)** - Moves the active item by `delta` places.\n- **selectActive()** - Chooses the active item, as pressing Enter would.\n- **reposition()** - Recalculates the panel's position against its anchor.\n\n### **CSS Properties:**\n - **--slash-menu-width** - The width of the panel. _(default: undefined)_\n- **--slash-menu-max-height** - The maximum height of the panel before it scrolls. _(default: undefined)_\n\n### **CSS Parts:**\n - **panel** - The floating panel that holds the list.\n- **heading** - The panel's heading.\n- **item** - An item in the list.\n- **group-heading** - A group heading between items.\n- **footer** - The truncation footer, shown when not every match fits.",
8920
+ "doc-url": "",
8921
+ "attributes": [
8922
+ {
8923
+ "name": "open",
8924
+ "description": "Whether the menu is showing.",
8925
+ "value": { "type": "boolean", "default": "false" }
8926
+ },
8927
+ {
8928
+ "name": "items",
8929
+ "description": "The items to list. Already filtered — the menu displays what it is given.",
8930
+ "value": { "type": "SlashMenuItem[]", "default": "[]" }
8931
+ },
8932
+ {
8933
+ "name": "query",
8934
+ "description": "The query the items were matched against, shown in the heading.",
8935
+ "value": { "type": "string", "default": "''" }
8936
+ },
8937
+ {
8938
+ "name": "heading",
8939
+ "description": "The heading shown when there is no query.",
8940
+ "value": { "type": "string", "default": "'Insert'" }
8941
+ },
8942
+ {
8943
+ "name": "empty-text",
8944
+ "description": "Shown in place of the list when there are no items.",
8945
+ "value": { "type": "string", "default": "'No matches'" }
8946
+ },
8947
+ {
8948
+ "name": "max-items",
8949
+ "description": "The most items to render at once. Remaining matches are reported in the footer.",
8950
+ "value": { "type": "number", "default": "25" }
8951
+ },
8952
+ {
8953
+ "name": "placement",
8954
+ "description": "The preferred placement of the panel.",
8955
+ "value": { "type": "Placement", "default": "'bottom-start'" }
8956
+ },
8957
+ {
8958
+ "name": "distance",
8959
+ "description": "The gap between the caret and the panel.",
8960
+ "value": { "type": "number", "default": "4" }
8961
+ }
8962
+ ],
8963
+ "events": [
8964
+ { "name": "SLASH_ITEM_SELECT", "type": "CustomEvent" },
8965
+ {
8966
+ "name": "zn-slash-item-select",
8967
+ "description": "Emitted when an item is chosen. Does not cross shadow boundaries; the component driving the menu (e.g. `zn-textarea`) re-emits it as `zn-slash-select`."
8968
+ }
8969
+ ],
8970
+ "js": {
8971
+ "properties": [
8972
+ {
8973
+ "name": "open",
8974
+ "description": "Whether the menu is showing.",
8975
+ "type": "boolean"
8976
+ },
8977
+ {
8978
+ "name": "items",
8979
+ "description": "The items to list. Already filtered — the menu displays what it is given.",
8980
+ "type": "SlashMenuItem[]"
8981
+ },
8982
+ {
8983
+ "name": "query",
8984
+ "description": "The query the items were matched against, shown in the heading.",
8985
+ "type": "string"
8986
+ },
8987
+ {
8988
+ "name": "heading",
8989
+ "description": "The heading shown when there is no query.",
8990
+ "type": "string"
8991
+ },
8992
+ {
8993
+ "name": "emptyText",
8994
+ "description": "Shown in place of the list when there are no items.",
8995
+ "type": "string"
8996
+ },
8997
+ {
8998
+ "name": "maxItems",
8999
+ "description": "The most items to render at once. Remaining matches are reported in the footer.",
9000
+ "type": "number"
9001
+ },
9002
+ {
9003
+ "name": "anchor",
9004
+ "description": "The element or caret rect the panel is positioned against.",
9005
+ "type": "Element | VirtualElement | null"
9006
+ },
9007
+ {
9008
+ "name": "placement",
9009
+ "description": "The preferred placement of the panel.",
9010
+ "type": "Placement"
9011
+ },
9012
+ {
9013
+ "name": "distance",
9014
+ "description": "The gap between the caret and the panel.",
9015
+ "type": "number"
9016
+ },
9017
+ {
9018
+ "name": "activeItem",
9019
+ "description": "The item that Enter would insert.",
9020
+ "type": "SlashMenuItem | undefined"
9021
+ }
9022
+ ],
9023
+ "events": [
9024
+ { "name": "SLASH_ITEM_SELECT", "type": "CustomEvent" },
9025
+ {
9026
+ "name": "zn-slash-item-select",
9027
+ "description": "Emitted when an item is chosen. Does not cross shadow boundaries; the component driving the menu (e.g. `zn-textarea`) re-emits it as `zn-slash-select`."
9028
+ }
9029
+ ]
9030
+ }
9031
+ },
8673
9032
  {
8674
9033
  "name": "zn-slideout",
8675
9034
  "description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-show** - Emitted when the slideout is opens.\n- **zn-close** - Emitted when the slideout is closed.\n- **zn-request-close** - Emitted when the user attempts to close the slideout by clicking the close button, clicking the overlay, or pressing escape. Calling `event.preventDefault()` will keep the slideout open. Avoid using this unless closing the slideout will result in destructive behavior such as data loss.\n\n### **Methods:**\n - **show()** - Shows the slideout.\n- **hide()** - Hides the slideout.\n\n### **Slots:**\n - _default_ - The default slot.\n- **label** - The slideout's label. Alternatively you can use the `label` attribute.\n\n### **CSS Properties:**\n - **--width** - The preferred width of the slideout. Note the slideout will shrink to accommodate smaller screens. _(default: undefined)_\n- **--header-spacing** - The amount of padding to use for the header. _(default: undefined)_\n- **--body-spacing** - The amount of padding to use for the body. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.\n- **header** - The slideout's header. This element wraps the title and header actions.\n- **close-button** - The slideout's close button.\n- **close-button__base** - The close buttons exported `base` part.\n- **body** - The slideout's body.",
@@ -9495,7 +9854,7 @@
9495
9854
  },
9496
9855
  {
9497
9856
  "name": "zn-textarea",
9498
- "description": "Textareas collect data from the user and allow multiple lines of text.\n---\n\n\n### **Events:**\n - **zn-blur** - Emitted when the control loses focus.\n- **zn-change** - Emitted when an alteration to the control's value is committed by the user.\n- **zn-focus** - Emitted when the control gains focus.\n- **zn-input** - Emitted when the control receives input.\n- **zn-invalid** - Emitted when the form control has been checked for validity and its constraints aren't satisfied.\n\n### **Methods:**\n - **focus(options: _FocusOptions_)** - Sets focus on the textarea.\n- **blur()** - Removes focus from the textarea.\n- **select()** - Selects all the text in the textarea.\n- **scrollPosition(position: _{ top?: number; left?: number }_): _{ top: number; left: number } | undefined_** - Gets or sets the textarea scroll position.\n- **setSelectionRange(selectionStart: _number_, selectionEnd: _number_, selectionDirection: _'forward' | 'backward' | 'none'_)** - Sets the start and end positions of the text selection (0-based).\n- **setRangeText(replacement: _string_, start: _number_, end: _number_, selectMode: _'select' | 'start' | 'end' | 'preserve'_)** - Replaces a range of text with a new string.\n- **checkValidity()** - Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid.\n- **getForm(): _HTMLFormElement | null_** - Gets the associated form, if one exists.\n- **reportValidity()** - Checks for validity and shows the browser's validation message if the control is invalid.\n- **setCustomValidity(message: _string_)** - Sets a custom validation message. Pass an empty string to restore validity.\n\n### **Slots:**\n - **label** - The textareas label. Alternatively, you can use the `label` attribute.\n- **label-tooltip** - Used to add text that is displayed in a tooltip next to the label. Alternatively, you can use the `label-tooltip` attribute.\n- **context-note** - Used to add contextual text that is displayed above the textarea, on the right. Alternatively, you can use the `context-note` attribute.\n- **help-text** - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute.\n\n### **CSS Parts:**\n - **form-control** - The form control that wraps the label, input, and help text.\n- **form-control-label** - The label's wrapper.\n- **form-control-input** - The input's wrapper.\n- **form-control-help-text** - The help text's wrapper.\n- **base** - The component's base wrapper.\n- **textarea** - The internal `<textarea>` control.",
9857
+ "description": "Textareas collect data from the user and allow multiple lines of text.\n---\n\n\n### **Events:**\n - **zn-blur** - Emitted when the control loses focus.\n- **zn-change** - Emitted when an alteration to the control's value is committed by the user.\n- **zn-focus** - Emitted when the control gains focus.\n- **zn-input** - Emitted when the control receives input.\n- **zn-invalid** - Emitted when the form control has been checked for validity and its constraints aren't satisfied.\n- **zn-slash-select** - Emitted when a slash menu item is chosen. Cancelable — call `preventDefault()` to suppress the insertion and handle the item yourself.\n- **zn-slash-insert** - Emitted after a slash menu item's value has been inserted.\n\n### **Methods:**\n - **resolveSlashItems(search): _Promise<SlashMenuItem[]>_** - The insertions the slash menu offers, gathered from every source, in the order they were declared.\n- **showSlashMenu()** - Opens the slash menu at the caret, inserting the trigger if it isn't already there.\n- **hideSlashMenu()** - Closes the slash menu.\n- **focus(options: _FocusOptions_)** - Sets focus on the textarea.\n- **blur()** - Removes focus from the textarea.\n- **select()** - Selects all the text in the textarea.\n- **scrollPosition(position: _{ top?: number; left?: number }_): _{ top: number; left: number } | undefined_** - Gets or sets the textarea scroll position.\n- **setSelectionRange(selectionStart: _number_, selectionEnd: _number_, selectionDirection: _'forward' | 'backward' | 'none'_)** - Sets the start and end positions of the text selection (0-based).\n- **setRangeText(replacement: _string_, start: _number_, end: _number_, selectMode: _'select' | 'start' | 'end' | 'preserve'_)** - Replaces a range of text with a new string.\n- **checkValidity()** - Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid.\n- **getForm(): _HTMLFormElement | null_** - Gets the associated form, if one exists.\n- **reportValidity()** - Checks for validity and shows the browser's validation message if the control is invalid.\n- **setCustomValidity(message: _string_)** - Sets a custom validation message. Pass an empty string to restore validity.\n\n### **Slots:**\n - **label** - The textareas label. Alternatively, you can use the `label` attribute.\n- **label-tooltip** - Used to add text that is displayed in a tooltip next to the label. Alternatively, you can use the `label-tooltip` attribute.\n- **context-note** - Used to add contextual text that is displayed above the textarea, on the right. Alternatively, you can use the `context-note` attribute.\n- **help-text** - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute.\n- **slash-items** - `<zn-slash-item>` elements describing the insertions offered by the slash menu. Items are picked up wherever they sit inside the textarea, so this slot name is optional.\n- **slash-menu** - A `<zn-slash-menu>` to use instead of the built-in one, so its heading, sizing and styling can be set in markup. Any `<zn-slash-item>` children of it become the menu's items.\n\n### **CSS Parts:**\n - **form-control** - The form control that wraps the label, input, and help text.\n- **form-control-label** - The label's wrapper.\n- **form-control-input** - The input's wrapper.\n- **form-control-help-text** - The help text's wrapper.\n- **base** - The component's base wrapper.\n- **textarea** - The internal `<textarea>` control.\n- **slash-menu** - The slash menu shown at the caret.",
9499
9858
  "doc-url": "",
9500
9859
  "attributes": [
9501
9860
  { "name": "title", "value": { "type": "string", "default": "''" } },
@@ -9630,6 +9989,26 @@
9630
9989
  "type": "'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'"
9631
9990
  }
9632
9991
  },
9992
+ {
9993
+ "name": "slash-items",
9994
+ "description": "Quick insertions offered by the slash menu. Accepts a JSON array of items, or the shorthand\n`Brand name={{BRAND_NAME}}, Support email={{SUPPORT_EMAIL}}`. Can also be set as an array of\n`SlashMenuItem` objects in JavaScript.",
9995
+ "value": { "type": "SlashMenuItem[]", "default": "[]" }
9996
+ },
9997
+ {
9998
+ "name": "slash-preset",
9999
+ "description": "Names of item sets registered with `registerSlashMenuPreset`, comma separated.",
10000
+ "value": { "type": "string", "default": "''" }
10001
+ },
10002
+ {
10003
+ "name": "slash-trigger",
10004
+ "description": "The characters that open the slash menu.",
10005
+ "value": { "type": "string", "default": "'/'" }
10006
+ },
10007
+ {
10008
+ "name": "slash-heading",
10009
+ "description": "The heading shown above the slash menu's items.",
10010
+ "value": { "type": "string", "default": "'Insert'" }
10011
+ },
9633
10012
  {
9634
10013
  "name": "transparent",
9635
10014
  "value": { "type": "boolean", "default": "false" }
@@ -9651,6 +10030,14 @@
9651
10030
  {
9652
10031
  "name": "help-text",
9653
10032
  "description": "Text that describes how to use the input. Alternatively, you can use the `help-text` attribute."
10033
+ },
10034
+ {
10035
+ "name": "slash-items",
10036
+ "description": "`<zn-slash-item>` elements describing the insertions offered by the slash menu. Items are picked up wherever they sit inside the textarea, so this slot name is optional."
10037
+ },
10038
+ {
10039
+ "name": "slash-menu",
10040
+ "description": "A `<zn-slash-menu>` to use instead of the built-in one, so its heading, sizing and styling can be set in markup. Any `<zn-slash-item>` children of it become the menu's items."
9654
10041
  }
9655
10042
  ],
9656
10043
  "events": [
@@ -9673,12 +10060,21 @@
9673
10060
  {
9674
10061
  "name": "zn-invalid",
9675
10062
  "description": "Emitted when the form control has been checked for validity and its constraints aren't satisfied."
10063
+ },
10064
+ {
10065
+ "name": "zn-slash-select",
10066
+ "description": "Emitted when a slash menu item is chosen. Cancelable — call `preventDefault()` to suppress the insertion and handle the item yourself."
10067
+ },
10068
+ {
10069
+ "name": "zn-slash-insert",
10070
+ "description": "Emitted after a slash menu item's value has been inserted."
9676
10071
  }
9677
10072
  ],
9678
10073
  "js": {
9679
10074
  "properties": [
9680
10075
  { "name": "formControl", "type": "HTMLElement" },
9681
10076
  { "name": "input", "type": "HTMLTextAreaElement" },
10077
+ { "name": "slashMenuElement", "type": "ZnSlashMenu | null" },
9682
10078
  { "name": "hasFocus", "type": "boolean" },
9683
10079
  { "name": "title", "type": "string" },
9684
10080
  {
@@ -9797,6 +10193,31 @@
9797
10193
  "description": "Tells the browser what type of data will be entered by the user, allowing it to display the appropriate virtual\nkeyboard on supportive devices.",
9798
10194
  "type": "'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'"
9799
10195
  },
10196
+ {
10197
+ "name": "slashItems",
10198
+ "description": "Quick insertions offered by the slash menu. Accepts a JSON array of items, or the shorthand\n`Brand name={{BRAND_NAME}}, Support email={{SUPPORT_EMAIL}}`. Can also be set as an array of\n`SlashMenuItem` objects in JavaScript.",
10199
+ "type": "SlashMenuItem[]"
10200
+ },
10201
+ {
10202
+ "name": "slashPreset",
10203
+ "description": "Names of item sets registered with `registerSlashMenuPreset`, comma separated.",
10204
+ "type": "string"
10205
+ },
10206
+ {
10207
+ "name": "slashTrigger",
10208
+ "description": "The characters that open the slash menu.",
10209
+ "type": "string"
10210
+ },
10211
+ {
10212
+ "name": "slashHeading",
10213
+ "description": "The heading shown above the slash menu's items.",
10214
+ "type": "string"
10215
+ },
10216
+ {
10217
+ "name": "slashItemsProvider",
10218
+ "description": "Resolves additional items each time the menu opens, for lists that come from elsewhere (e.g. an\nAPI). Receives the current query and may return a promise. JavaScript only.",
10219
+ "type": "(query: string) => SlashMenuItem[] | Promise<SlashMenuItem[]> | undefined"
10220
+ },
9800
10221
  {
9801
10222
  "name": "defaultValue",
9802
10223
  "description": "The default value of the form control. Primarily used for resetting the form control.",
@@ -9832,6 +10253,14 @@
9832
10253
  {
9833
10254
  "name": "zn-invalid",
9834
10255
  "description": "Emitted when the form control has been checked for validity and its constraints aren't satisfied."
10256
+ },
10257
+ {
10258
+ "name": "zn-slash-select",
10259
+ "description": "Emitted when a slash menu item is chosen. Cancelable — call `preventDefault()` to suppress the insertion and handle the item yourself."
10260
+ },
10261
+ {
10262
+ "name": "zn-slash-insert",
10263
+ "description": "Emitted after a slash menu item's value has been inserted."
9835
10264
  }
9836
10265
  ]
9837
10266
  }
@@ -10582,6 +11011,26 @@
10582
11011
  "name": "textarea-rows",
10583
11012
  "value": { "type": "number | undefined" }
10584
11013
  },
11014
+ {
11015
+ "name": "slash-items",
11016
+ "description": "Quick insertions offered by the slash menu on `text` and `textarea` inputs. Accepts a JSON array of items, or\nthe shorthand `Brand name={{BRAND_NAME}}, Support email={{SUPPORT_EMAIL}}`. Every language shares the list.",
11017
+ "value": { "type": "SlashMenuItem[]", "default": "[]" }
11018
+ },
11019
+ {
11020
+ "name": "slash-preset",
11021
+ "description": "Names of item sets registered with `registerSlashMenuPreset`, comma separated.",
11022
+ "value": { "type": "string", "default": "''" }
11023
+ },
11024
+ {
11025
+ "name": "slash-trigger",
11026
+ "description": "The characters that open the slash menu.",
11027
+ "value": { "type": "string", "default": "'/'" }
11028
+ },
11029
+ {
11030
+ "name": "slash-heading",
11031
+ "description": "The heading shown above the slash menu's items.",
11032
+ "value": { "type": "string", "default": "'Insert'" }
11033
+ },
10585
11034
  {
10586
11035
  "name": "grouped",
10587
11036
  "description": "When true, hides the individual language navbar and defers language control to a parent zn-translation-group.",
@@ -10613,6 +11062,31 @@
10613
11062
  "type": "'select' | 'text' | 'number' | 'textarea'"
10614
11063
  },
10615
11064
  { "name": "textareaRows", "type": "number | undefined" },
11065
+ {
11066
+ "name": "slashItems",
11067
+ "description": "Quick insertions offered by the slash menu on `text` and `textarea` inputs. Accepts a JSON array of items, or\nthe shorthand `Brand name={{BRAND_NAME}}, Support email={{SUPPORT_EMAIL}}`. Every language shares the list.",
11068
+ "type": "SlashMenuItem[]"
11069
+ },
11070
+ {
11071
+ "name": "slashPreset",
11072
+ "description": "Names of item sets registered with `registerSlashMenuPreset`, comma separated.",
11073
+ "type": "string"
11074
+ },
11075
+ {
11076
+ "name": "slashTrigger",
11077
+ "description": "The characters that open the slash menu.",
11078
+ "type": "string"
11079
+ },
11080
+ {
11081
+ "name": "slashHeading",
11082
+ "description": "The heading shown above the slash menu's items.",
11083
+ "type": "string"
11084
+ },
11085
+ {
11086
+ "name": "slashItemsProvider",
11087
+ "description": "Resolves additional slash menu items each time the menu opens. JavaScript only.",
11088
+ "type": "(query: string) => SlashMenuItem[] | Promise<SlashMenuItem[]> | undefined"
11089
+ },
10616
11090
  {
10617
11091
  "name": "grouped",
10618
11092
  "description": "When true, hides the individual language navbar and defers language control to a parent zn-translation-group.",