@kubex/zinc 1.1.78 → 1.1.80

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 (34) hide show
  1. package/dist/custom-elements.json +1149 -130
  2. package/dist/vscode.html-custom-data.json +175 -1
  3. package/dist/web-types.json +396 -2
  4. package/dist/zn.d.ts +384 -0
  5. package/dist/zn.min.js +350 -295
  6. package/docs/pages/components/inline-edit.md +21 -0
  7. package/docs/pages/components/rating.md +2 -1
  8. package/docs/pages/components/slash-item.md +126 -0
  9. package/docs/pages/components/slash-menu.md +168 -0
  10. package/docs/pages/components/textarea.md +148 -0
  11. package/docs/pages/components/translations.md +34 -0
  12. package/package.json +1 -1
  13. package/src/components/inline-edit/inline-edit.component.ts +31 -0
  14. package/src/components/inline-edit/inline-edit.test.ts +83 -1
  15. package/src/components/rating/rating.component.ts +10 -1
  16. package/src/components/rating/rating.scss +6 -9
  17. package/src/components/slash-item/index.ts +12 -0
  18. package/src/components/slash-item/slash-item.component.ts +76 -0
  19. package/src/components/slash-item/slash-item.scss +5 -0
  20. package/src/components/slash-menu/index.ts +14 -0
  21. package/src/components/slash-menu/slash-menu-controller.ts +361 -0
  22. package/src/components/slash-menu/slash-menu-items.ts +122 -0
  23. package/src/components/slash-menu/slash-menu.component.ts +305 -0
  24. package/src/components/slash-menu/slash-menu.scss +120 -0
  25. package/src/components/slash-menu/slash-menu.test.ts +154 -0
  26. package/src/components/textarea/textarea.component.ts +143 -0
  27. package/src/components/textarea/textarea.test.ts +310 -2
  28. package/src/components/translations/translations.component.ts +31 -0
  29. package/src/components/translations/translations.test.ts +89 -1
  30. package/src/events/events.ts +2 -0
  31. package/src/events/zn-slash-insert.ts +9 -0
  32. package/src/events/zn-slash-select.ts +9 -0
  33. package/src/utilities/caret-position.ts +118 -0
  34. package/src/zinc.ts +3 -0
@@ -1939,6 +1939,26 @@
1939
1939
  ]
1940
1940
  },
1941
1941
  { "name": "textarea-rows", "values": [{ "name": "1" }] },
1942
+ {
1943
+ "name": "slash-items",
1944
+ "description": "Quick insertions offered by the slash menu of a `textarea` input. Accepts a JSON array of items, or the\nshorthand `Brand name={{BRAND_NAME}}, Support email={{SUPPORT_EMAIL}}`. Forwarded to the inner `zn-textarea`.",
1945
+ "values": [{ "name": "SlashMenuItem[]" }]
1946
+ },
1947
+ {
1948
+ "name": "slash-preset",
1949
+ "description": "Names of item sets registered with `registerSlashMenuPreset`, comma separated.",
1950
+ "values": []
1951
+ },
1952
+ {
1953
+ "name": "slash-trigger",
1954
+ "description": "The characters that open the slash menu.",
1955
+ "values": []
1956
+ },
1957
+ {
1958
+ "name": "slash-heading",
1959
+ "description": "The heading shown above the slash menu's items.",
1960
+ "values": []
1961
+ },
1942
1962
  {
1943
1963
  "name": "options",
1944
1964
  "values": [{ "name": "{ [key: string]: string }" }]
@@ -3677,6 +3697,120 @@
3677
3697
  }
3678
3698
  ]
3679
3699
  },
3700
+ {
3701
+ "name": "zn-slash-item",
3702
+ "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.",
3703
+ "attributes": [
3704
+ {
3705
+ "name": "label",
3706
+ "description": "The text shown in the menu.",
3707
+ "values": []
3708
+ },
3709
+ {
3710
+ "name": "value",
3711
+ "description": "The text inserted into the field. Falls back to this element's text content.",
3712
+ "values": []
3713
+ },
3714
+ {
3715
+ "name": "icon",
3716
+ "description": "Icon shown against the item, e.g. `tag@lu`.",
3717
+ "values": []
3718
+ },
3719
+ {
3720
+ "name": "description",
3721
+ "description": "Supporting text shown under the label.",
3722
+ "values": []
3723
+ },
3724
+ {
3725
+ "name": "keywords",
3726
+ "description": "Extra terms the item can be found by, comma separated.",
3727
+ "values": []
3728
+ },
3729
+ {
3730
+ "name": "group",
3731
+ "description": "Heading the item is listed under.",
3732
+ "values": []
3733
+ },
3734
+ {
3735
+ "name": "order",
3736
+ "description": "Overrides the item's position in the menu. Lower sorts first.",
3737
+ "values": []
3738
+ },
3739
+ {
3740
+ "name": "caret-offset",
3741
+ "description": "Where the caret lands after insertion, as an offset into the inserted value.",
3742
+ "values": []
3743
+ },
3744
+ {
3745
+ "name": "action",
3746
+ "description": "Identifier passed through on `zn-slash-select`, for items that do something other than insert.",
3747
+ "values": []
3748
+ },
3749
+ {
3750
+ "name": "disabled",
3751
+ "description": "Listed, but not selectable.",
3752
+ "values": []
3753
+ }
3754
+ ],
3755
+ "references": [
3756
+ {
3757
+ "name": "Documentation",
3758
+ "url": "https://zinc.style/components/slash-item"
3759
+ }
3760
+ ]
3761
+ },
3762
+ {
3763
+ "name": "zn-slash-menu",
3764
+ "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.",
3765
+ "attributes": [
3766
+ {
3767
+ "name": "open",
3768
+ "description": "Whether the menu is showing.",
3769
+ "values": []
3770
+ },
3771
+ {
3772
+ "name": "items",
3773
+ "description": "The items to list. Already filtered — the menu displays what it is given.",
3774
+ "values": [{ "name": "SlashMenuItem[]" }]
3775
+ },
3776
+ {
3777
+ "name": "query",
3778
+ "description": "The query the items were matched against, shown in the heading.",
3779
+ "values": []
3780
+ },
3781
+ {
3782
+ "name": "heading",
3783
+ "description": "The heading shown when there is no query.",
3784
+ "values": []
3785
+ },
3786
+ {
3787
+ "name": "empty-text",
3788
+ "description": "Shown in place of the list when there are no items.",
3789
+ "values": []
3790
+ },
3791
+ {
3792
+ "name": "max-items",
3793
+ "description": "The most items to render at once. Remaining matches are reported in the footer.",
3794
+ "values": []
3795
+ },
3796
+ {
3797
+ "name": "placement",
3798
+ "description": "The preferred placement of the panel.",
3799
+ "values": [{ "name": "Placement" }]
3800
+ },
3801
+ {
3802
+ "name": "distance",
3803
+ "description": "The gap between the caret and the panel.",
3804
+ "values": []
3805
+ }
3806
+ ],
3807
+ "references": [
3808
+ {
3809
+ "name": "Documentation",
3810
+ "url": "https://zinc.style/components/slash-menu"
3811
+ }
3812
+ ]
3813
+ },
3680
3814
  {
3681
3815
  "name": "zn-slideout",
3682
3816
  "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.",
@@ -4003,7 +4137,7 @@
4003
4137
  },
4004
4138
  {
4005
4139
  "name": "zn-textarea",
4006
- "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.",
4140
+ "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.",
4007
4141
  "attributes": [
4008
4142
  { "name": "title", "values": [] },
4009
4143
  {
@@ -4154,6 +4288,26 @@
4154
4288
  { "name": "url" }
4155
4289
  ]
4156
4290
  },
4291
+ {
4292
+ "name": "slash-items",
4293
+ "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.",
4294
+ "values": [{ "name": "SlashMenuItem[]" }]
4295
+ },
4296
+ {
4297
+ "name": "slash-preset",
4298
+ "description": "Names of item sets registered with `registerSlashMenuPreset`, comma separated.",
4299
+ "values": []
4300
+ },
4301
+ {
4302
+ "name": "slash-trigger",
4303
+ "description": "The characters that open the slash menu.",
4304
+ "values": []
4305
+ },
4306
+ {
4307
+ "name": "slash-heading",
4308
+ "description": "The heading shown above the slash menu's items.",
4309
+ "values": []
4310
+ },
4157
4311
  { "name": "transparent", "values": [] }
4158
4312
  ],
4159
4313
  "references": [
@@ -4475,6 +4629,26 @@
4475
4629
  ]
4476
4630
  },
4477
4631
  { "name": "textarea-rows", "values": [] },
4632
+ {
4633
+ "name": "slash-items",
4634
+ "description": "Quick insertions offered by the slash menu when `input-type` is `textarea`. Accepts a JSON array of items, or\nthe shorthand `Brand name={{BRAND_NAME}}, Support email={{SUPPORT_EMAIL}}`. Every language shares the list.",
4635
+ "values": [{ "name": "SlashMenuItem[]" }]
4636
+ },
4637
+ {
4638
+ "name": "slash-preset",
4639
+ "description": "Names of item sets registered with `registerSlashMenuPreset`, comma separated.",
4640
+ "values": []
4641
+ },
4642
+ {
4643
+ "name": "slash-trigger",
4644
+ "description": "The characters that open the slash menu.",
4645
+ "values": []
4646
+ },
4647
+ {
4648
+ "name": "slash-heading",
4649
+ "description": "The heading shown above the slash menu's items.",
4650
+ "values": []
4651
+ },
4478
4652
  {
4479
4653
  "name": "grouped",
4480
4654
  "description": "When true, hides the individual language navbar and defers language control to a parent zn-translation-group.",