@kubex/zinc 1.0.102 → 1.0.104
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.
- package/dist/custom-elements.json +552 -1
- package/dist/vscode.html-custom-data.json +88 -0
- package/dist/web-types.json +202 -1
- package/dist/zn.d.ts +103 -0
- package/dist/zn.min.js +476 -345
- package/docs/pages/components/markdown-editor.md +301 -0
- package/docs/pages/components/sp.md +36 -0
- package/package.json +2 -1
- package/src/components/markdown-editor/index.ts +12 -0
- package/src/components/markdown-editor/markdown-editor.component.ts +332 -0
- package/src/components/markdown-editor/markdown-editor.scss +212 -0
- package/src/components/markdown-editor/markdown-editor.test.ts +22 -0
- package/src/components/sp/sp.component.ts +2 -0
- package/src/components/sp/sp.scss +13 -0
- package/src/zinc.ts +1 -0
package/dist/web-types.json
CHANGED
|
@@ -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.0.
|
|
4
|
+
"version": "1.0.104",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -4479,6 +4479,187 @@
|
|
|
4479
4479
|
]
|
|
4480
4480
|
}
|
|
4481
4481
|
},
|
|
4482
|
+
{
|
|
4483
|
+
"name": "zn-markdown-editor",
|
|
4484
|
+
"description": "A markdown editor with live preview, split view, and a fullscreen mode.\n---\n\n\n### **Events:**\n - **zn-view-mode-change** - Emitted when the user switches between editor / split / preview.\n- **zn-change** - Emitted when the markdown content changes.\n- **zn-input** - Emitted on each keystroke in the editor.\n\n### **Methods:**\n - **focus(options: _FocusOptions_)** - Sets focus on the editor.\n- **blur()** - Removes focus from the editor.\n\n### **Slots:**\n - **label** - The editor label. Alternatively, use the `label` attribute.\n- **help-text** - Help text shown below the editor. Alternatively, use the `help-text` attribute.\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.\n- **toolbar** - The toolbar containing the view-mode and fullscreen controls.\n- **editor** - The textarea wrapper.\n- **preview** - The rendered markdown preview.",
|
|
4485
|
+
"doc-url": "",
|
|
4486
|
+
"attributes": [
|
|
4487
|
+
{
|
|
4488
|
+
"name": "name",
|
|
4489
|
+
"description": "The name of the control, submitted as part of form data.",
|
|
4490
|
+
"value": { "type": "string", "default": "''" }
|
|
4491
|
+
},
|
|
4492
|
+
{
|
|
4493
|
+
"name": "value",
|
|
4494
|
+
"description": "The current markdown content.",
|
|
4495
|
+
"value": { "type": "string", "default": "''" }
|
|
4496
|
+
},
|
|
4497
|
+
{
|
|
4498
|
+
"name": "label",
|
|
4499
|
+
"description": "The control's label. If you need HTML, use the `label` slot.",
|
|
4500
|
+
"value": { "type": "string", "default": "''" }
|
|
4501
|
+
},
|
|
4502
|
+
{
|
|
4503
|
+
"name": "help-text",
|
|
4504
|
+
"description": "Help text displayed below the editor. If you need HTML, use the `help-text` slot.",
|
|
4505
|
+
"value": { "type": "string", "default": "''" }
|
|
4506
|
+
},
|
|
4507
|
+
{
|
|
4508
|
+
"name": "placeholder",
|
|
4509
|
+
"description": "Placeholder text shown when the editor is empty.",
|
|
4510
|
+
"value": {
|
|
4511
|
+
"type": "string",
|
|
4512
|
+
"default": "'Enter markdown content...'"
|
|
4513
|
+
}
|
|
4514
|
+
},
|
|
4515
|
+
{
|
|
4516
|
+
"name": "rows",
|
|
4517
|
+
"description": "Number of rows for the textarea.",
|
|
4518
|
+
"value": { "type": "number", "default": "20" }
|
|
4519
|
+
},
|
|
4520
|
+
{
|
|
4521
|
+
"name": "view-mode",
|
|
4522
|
+
"description": "Which view to show.",
|
|
4523
|
+
"value": { "type": "ViewMode", "default": "'editor'" }
|
|
4524
|
+
},
|
|
4525
|
+
{
|
|
4526
|
+
"name": "storage-key",
|
|
4527
|
+
"description": "Key used to persist the selected view mode to `localStorage`. Set to an empty string to disable persistence.",
|
|
4528
|
+
"value": {
|
|
4529
|
+
"type": "string",
|
|
4530
|
+
"default": "'zn-markdown-editor-view-mode'"
|
|
4531
|
+
}
|
|
4532
|
+
},
|
|
4533
|
+
{
|
|
4534
|
+
"name": "required",
|
|
4535
|
+
"description": "Makes the editor required for form submission.",
|
|
4536
|
+
"value": { "type": "boolean", "default": "false" }
|
|
4537
|
+
},
|
|
4538
|
+
{
|
|
4539
|
+
"name": "readonly",
|
|
4540
|
+
"description": "Makes the editor read-only.",
|
|
4541
|
+
"value": { "type": "boolean", "default": "false" }
|
|
4542
|
+
},
|
|
4543
|
+
{
|
|
4544
|
+
"name": "disabled",
|
|
4545
|
+
"description": "Disables the editor.",
|
|
4546
|
+
"value": { "type": "boolean", "default": "false" }
|
|
4547
|
+
}
|
|
4548
|
+
],
|
|
4549
|
+
"slots": [
|
|
4550
|
+
{
|
|
4551
|
+
"name": "label",
|
|
4552
|
+
"description": "The editor label. Alternatively, use the `label` attribute."
|
|
4553
|
+
},
|
|
4554
|
+
{
|
|
4555
|
+
"name": "help-text",
|
|
4556
|
+
"description": "Help text shown below the editor. Alternatively, use the `help-text` attribute."
|
|
4557
|
+
}
|
|
4558
|
+
],
|
|
4559
|
+
"events": [
|
|
4560
|
+
{
|
|
4561
|
+
"name": "zn-view-mode-change",
|
|
4562
|
+
"type": "CustomEvent",
|
|
4563
|
+
"description": "Emitted when the user switches between editor / split / preview."
|
|
4564
|
+
},
|
|
4565
|
+
{
|
|
4566
|
+
"name": "zn-change",
|
|
4567
|
+
"description": "Emitted when the markdown content changes."
|
|
4568
|
+
},
|
|
4569
|
+
{
|
|
4570
|
+
"name": "zn-input",
|
|
4571
|
+
"description": "Emitted on each keystroke in the editor."
|
|
4572
|
+
}
|
|
4573
|
+
],
|
|
4574
|
+
"js": {
|
|
4575
|
+
"properties": [
|
|
4576
|
+
{ "name": "textarea", "type": "ZnTextarea" },
|
|
4577
|
+
{ "name": "previewEl", "type": "HTMLDivElement" },
|
|
4578
|
+
{
|
|
4579
|
+
"name": "name",
|
|
4580
|
+
"description": "The name of the control, submitted as part of form data.",
|
|
4581
|
+
"type": "string"
|
|
4582
|
+
},
|
|
4583
|
+
{
|
|
4584
|
+
"name": "value",
|
|
4585
|
+
"description": "The current markdown content.",
|
|
4586
|
+
"type": "string"
|
|
4587
|
+
},
|
|
4588
|
+
{
|
|
4589
|
+
"name": "defaultValue",
|
|
4590
|
+
"description": "The default value — used when resetting the form.",
|
|
4591
|
+
"type": "string"
|
|
4592
|
+
},
|
|
4593
|
+
{
|
|
4594
|
+
"name": "label",
|
|
4595
|
+
"description": "The control's label. If you need HTML, use the `label` slot.",
|
|
4596
|
+
"type": "string"
|
|
4597
|
+
},
|
|
4598
|
+
{
|
|
4599
|
+
"name": "helpText",
|
|
4600
|
+
"description": "Help text displayed below the editor. If you need HTML, use the `help-text` slot.",
|
|
4601
|
+
"type": "string"
|
|
4602
|
+
},
|
|
4603
|
+
{
|
|
4604
|
+
"name": "placeholder",
|
|
4605
|
+
"description": "Placeholder text shown when the editor is empty.",
|
|
4606
|
+
"type": "string"
|
|
4607
|
+
},
|
|
4608
|
+
{
|
|
4609
|
+
"name": "rows",
|
|
4610
|
+
"description": "Number of rows for the textarea.",
|
|
4611
|
+
"type": "number"
|
|
4612
|
+
},
|
|
4613
|
+
{
|
|
4614
|
+
"name": "viewMode",
|
|
4615
|
+
"description": "Which view to show.",
|
|
4616
|
+
"type": "ViewMode"
|
|
4617
|
+
},
|
|
4618
|
+
{
|
|
4619
|
+
"name": "storageKey",
|
|
4620
|
+
"description": "Key used to persist the selected view mode to `localStorage`. Set to an empty string to disable persistence.",
|
|
4621
|
+
"type": "string"
|
|
4622
|
+
},
|
|
4623
|
+
{
|
|
4624
|
+
"name": "required",
|
|
4625
|
+
"description": "Makes the editor required for form submission.",
|
|
4626
|
+
"type": "boolean"
|
|
4627
|
+
},
|
|
4628
|
+
{
|
|
4629
|
+
"name": "readonly",
|
|
4630
|
+
"description": "Makes the editor read-only.",
|
|
4631
|
+
"type": "boolean"
|
|
4632
|
+
},
|
|
4633
|
+
{
|
|
4634
|
+
"name": "disabled",
|
|
4635
|
+
"description": "Disables the editor.",
|
|
4636
|
+
"type": "boolean"
|
|
4637
|
+
},
|
|
4638
|
+
{
|
|
4639
|
+
"name": "expanded",
|
|
4640
|
+
"description": "Whether the editor is currently expanded to cover its containing positioned ancestor.",
|
|
4641
|
+
"type": "boolean"
|
|
4642
|
+
},
|
|
4643
|
+
{ "name": "validity", "type": "ValidityState" },
|
|
4644
|
+
{ "name": "validationMessage", "type": "string" }
|
|
4645
|
+
],
|
|
4646
|
+
"events": [
|
|
4647
|
+
{
|
|
4648
|
+
"name": "zn-view-mode-change",
|
|
4649
|
+
"type": "CustomEvent",
|
|
4650
|
+
"description": "Emitted when the user switches between editor / split / preview."
|
|
4651
|
+
},
|
|
4652
|
+
{
|
|
4653
|
+
"name": "zn-change",
|
|
4654
|
+
"description": "Emitted when the markdown content changes."
|
|
4655
|
+
},
|
|
4656
|
+
{
|
|
4657
|
+
"name": "zn-input",
|
|
4658
|
+
"description": "Emitted on each keystroke in the editor."
|
|
4659
|
+
}
|
|
4660
|
+
]
|
|
4661
|
+
}
|
|
4662
|
+
},
|
|
4482
4663
|
{
|
|
4483
4664
|
"name": "zn-menu",
|
|
4484
4665
|
"description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--example** - An example CSS custom property. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
|
|
@@ -6849,6 +7030,18 @@
|
|
|
6849
7030
|
"name": "row",
|
|
6850
7031
|
"value": { "type": "boolean", "default": "false" }
|
|
6851
7032
|
},
|
|
7033
|
+
{
|
|
7034
|
+
"name": "align",
|
|
7035
|
+
"value": {
|
|
7036
|
+
"type": "'start' | 'center' | 'end' | 'stretch' | 'baseline'"
|
|
7037
|
+
}
|
|
7038
|
+
},
|
|
7039
|
+
{
|
|
7040
|
+
"name": "justify",
|
|
7041
|
+
"value": {
|
|
7042
|
+
"type": "'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'"
|
|
7043
|
+
}
|
|
7044
|
+
},
|
|
6852
7045
|
{
|
|
6853
7046
|
"name": "grow",
|
|
6854
7047
|
"value": { "type": "boolean", "default": "false" }
|
|
@@ -6922,6 +7115,14 @@
|
|
|
6922
7115
|
{ "name": "divide", "type": "boolean" },
|
|
6923
7116
|
{ "name": "gap", "type": "keyof typeof defaultSizes" },
|
|
6924
7117
|
{ "name": "row", "type": "boolean" },
|
|
7118
|
+
{
|
|
7119
|
+
"name": "align",
|
|
7120
|
+
"type": "'start' | 'center' | 'end' | 'stretch' | 'baseline'"
|
|
7121
|
+
},
|
|
7122
|
+
{
|
|
7123
|
+
"name": "justify",
|
|
7124
|
+
"type": "'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'"
|
|
7125
|
+
},
|
|
6925
7126
|
{ "name": "grow", "type": "boolean" },
|
|
6926
7127
|
{ "name": "padX", "type": "boolean" },
|
|
6927
7128
|
{ "name": "padY", "type": "boolean" },
|
package/dist/zn.d.ts
CHANGED
|
@@ -4341,6 +4341,8 @@ declare module "components/sp/sp.component" {
|
|
|
4341
4341
|
divide: boolean;
|
|
4342
4342
|
gap: keyof typeof defaultSizes;
|
|
4343
4343
|
row: boolean;
|
|
4344
|
+
align: 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
4345
|
+
justify: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
4344
4346
|
grow: boolean;
|
|
4345
4347
|
padX: boolean;
|
|
4346
4348
|
padY: boolean;
|
|
@@ -7673,6 +7675,106 @@ declare module "components/priority-list/index" {
|
|
|
7673
7675
|
}
|
|
7674
7676
|
}
|
|
7675
7677
|
}
|
|
7678
|
+
declare module "components/markdown-editor/markdown-editor.component" {
|
|
7679
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
7680
|
+
import ZincElement from "internal/zinc-element";
|
|
7681
|
+
import type { ZincFormControl } from "internal/zinc-element";
|
|
7682
|
+
import type ZnTextarea from "components/textarea/index";
|
|
7683
|
+
type ViewMode = 'editor' | 'split' | 'preview';
|
|
7684
|
+
/**
|
|
7685
|
+
* @summary A markdown editor with live preview, split view, and a fullscreen mode.
|
|
7686
|
+
* @documentation https://zinc.style/components/markdown-editor
|
|
7687
|
+
* @status experimental
|
|
7688
|
+
* @since 1.0
|
|
7689
|
+
*
|
|
7690
|
+
* @dependency zn-textarea
|
|
7691
|
+
* @dependency zn-button-group
|
|
7692
|
+
* @dependency zn-icon
|
|
7693
|
+
*
|
|
7694
|
+
* @event zn-change - Emitted when the markdown content changes.
|
|
7695
|
+
* @event zn-input - Emitted on each keystroke in the editor.
|
|
7696
|
+
* @event zn-view-mode-change - Emitted when the user switches between editor / split / preview.
|
|
7697
|
+
*
|
|
7698
|
+
* @slot label - The editor label. Alternatively, use the `label` attribute.
|
|
7699
|
+
* @slot help-text - Help text shown below the editor. Alternatively, use the `help-text` attribute.
|
|
7700
|
+
*
|
|
7701
|
+
* @csspart base - The component's base wrapper.
|
|
7702
|
+
* @csspart toolbar - The toolbar containing the view-mode and fullscreen controls.
|
|
7703
|
+
* @csspart editor - The textarea wrapper.
|
|
7704
|
+
* @csspart preview - The rendered markdown preview.
|
|
7705
|
+
*/
|
|
7706
|
+
export default class ZnMarkdownEditor extends ZincElement implements ZincFormControl {
|
|
7707
|
+
static styles: CSSResultGroup;
|
|
7708
|
+
private readonly formControlController;
|
|
7709
|
+
private readonly hasSlotController;
|
|
7710
|
+
private debounceTimer;
|
|
7711
|
+
textarea: ZnTextarea;
|
|
7712
|
+
previewEl: HTMLDivElement;
|
|
7713
|
+
/** The name of the control, submitted as part of form data. */
|
|
7714
|
+
name: string;
|
|
7715
|
+
/** The current markdown content. */
|
|
7716
|
+
value: string;
|
|
7717
|
+
/** The default value — used when resetting the form. */
|
|
7718
|
+
defaultValue: string;
|
|
7719
|
+
/** The control's label. If you need HTML, use the `label` slot. */
|
|
7720
|
+
label: string;
|
|
7721
|
+
/** Help text displayed below the editor. If you need HTML, use the `help-text` slot. */
|
|
7722
|
+
helpText: string;
|
|
7723
|
+
/** Placeholder text shown when the editor is empty. */
|
|
7724
|
+
placeholder: string;
|
|
7725
|
+
/** Number of rows for the textarea. */
|
|
7726
|
+
rows: number;
|
|
7727
|
+
/** Which view to show. */
|
|
7728
|
+
viewMode: ViewMode;
|
|
7729
|
+
/**
|
|
7730
|
+
* Key used to persist the selected view mode to `localStorage`. Set to an empty string to disable persistence.
|
|
7731
|
+
*/
|
|
7732
|
+
storageKey: string;
|
|
7733
|
+
/** Makes the editor required for form submission. */
|
|
7734
|
+
required: boolean;
|
|
7735
|
+
/** Makes the editor read-only. */
|
|
7736
|
+
readonly: boolean;
|
|
7737
|
+
/** Disables the editor. */
|
|
7738
|
+
disabled: boolean;
|
|
7739
|
+
/** Whether the editor is currently expanded to cover its containing positioned ancestor. */
|
|
7740
|
+
expanded: boolean;
|
|
7741
|
+
get validity(): ValidityState;
|
|
7742
|
+
get validationMessage(): string;
|
|
7743
|
+
checkValidity(): boolean;
|
|
7744
|
+
getForm(): HTMLFormElement | null;
|
|
7745
|
+
reportValidity(): boolean;
|
|
7746
|
+
setCustomValidity(message: string): void;
|
|
7747
|
+
/** Sets focus on the editor. */
|
|
7748
|
+
focus(options?: FocusOptions): void;
|
|
7749
|
+
/** Removes focus from the editor. */
|
|
7750
|
+
blur(): void;
|
|
7751
|
+
connectedCallback(): void;
|
|
7752
|
+
disconnectedCallback(): void;
|
|
7753
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
7754
|
+
private readStoredViewMode;
|
|
7755
|
+
private writeStoredViewMode;
|
|
7756
|
+
private renderPreview;
|
|
7757
|
+
private handleInput;
|
|
7758
|
+
private handleChange;
|
|
7759
|
+
private handleViewToggle;
|
|
7760
|
+
private handleExpandToggle;
|
|
7761
|
+
handleViewModeChange(): Promise<void>;
|
|
7762
|
+
handleValueChange(): Promise<void>;
|
|
7763
|
+
handleMarkedReady(): void;
|
|
7764
|
+
render(): import("lit").TemplateResult<1>;
|
|
7765
|
+
private renderViewButton;
|
|
7766
|
+
}
|
|
7767
|
+
}
|
|
7768
|
+
declare module "components/markdown-editor/index" {
|
|
7769
|
+
import ZnMarkdownEditor from "components/markdown-editor/markdown-editor.component";
|
|
7770
|
+
export * from "components/markdown-editor/markdown-editor.component";
|
|
7771
|
+
export default ZnMarkdownEditor;
|
|
7772
|
+
global {
|
|
7773
|
+
interface HTMLElementTagNameMap {
|
|
7774
|
+
'zn-markdown-editor': ZnMarkdownEditor;
|
|
7775
|
+
}
|
|
7776
|
+
}
|
|
7777
|
+
}
|
|
7676
7778
|
declare module "events/zn-after-hide" {
|
|
7677
7779
|
export type ZnAfterHideEvent = CustomEvent<Record<PropertyKey, never>>;
|
|
7678
7780
|
global {
|
|
@@ -7870,6 +7972,7 @@ declare module "zinc" {
|
|
|
7870
7972
|
export { default as TranslationGroup } from "components/translation-group/index";
|
|
7871
7973
|
export { default as OptGroup } from "components/opt-group/index";
|
|
7872
7974
|
export { default as PriorityList } from "components/priority-list/index";
|
|
7975
|
+
export { default as MarkdownEditor } from "components/markdown-editor/index";
|
|
7873
7976
|
export { default as ZincElement } from "internal/zinc-element";
|
|
7874
7977
|
export * from "utilities/on";
|
|
7875
7978
|
export * from "utilities/query";
|