@haiyue/ui 0.2.2 → 0.3.0
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/CHANGELOG.md +30 -0
- package/README.md +506 -2
- package/dist/adapters/web/renderer.js +1 -8
- package/dist/adapters/web/styles.d.ts +2 -3
- package/dist/adapters/web/styles.js +26 -23
- package/dist/alert.d.ts +39 -0
- package/dist/alert.js +144 -0
- package/dist/anchor.d.ts +60 -0
- package/dist/anchor.js +274 -0
- package/dist/auto-complete.d.ts +83 -0
- package/dist/auto-complete.js +267 -0
- package/dist/avatar.d.ts +45 -0
- package/dist/avatar.js +135 -0
- package/dist/badge.js +5 -5
- package/dist/border-beam.js +1 -1
- package/dist/breadcrumb.js +5 -5
- package/dist/button-group.js +8 -8
- package/dist/button.js +10 -10
- package/dist/card.d.ts +29 -0
- package/dist/card.js +101 -0
- package/dist/carousel.js +6 -6
- package/dist/cascader.js +12 -12
- package/dist/checkbox.d.ts +12 -0
- package/dist/checkbox.js +22 -6
- package/dist/collapse.js +6 -6
- package/dist/context-menu.js +3 -3
- package/dist/date-picker.js +13 -13
- package/dist/descriptions.d.ts +44 -0
- package/dist/descriptions.js +169 -0
- package/dist/dialog.js +11 -11
- package/dist/divider.js +2 -2
- package/dist/draggable.js +1 -1
- package/dist/drawer.js +12 -12
- package/dist/dropdown.js +3 -3
- package/dist/empty.d.ts +20 -0
- package/dist/empty.js +58 -0
- package/dist/expandable.js +4 -4
- package/dist/form-item.d.ts +60 -0
- package/dist/form-item.js +212 -0
- package/dist/form.d.ts +41 -0
- package/dist/form.js +154 -0
- package/dist/history-controls.js +5 -5
- package/dist/image-preview.d.ts +22 -0
- package/dist/image-preview.js +38 -0
- package/dist/image.d.ts +52 -0
- package/dist/image.js +152 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +72 -0
- package/dist/input.d.ts +11 -0
- package/dist/input.js +29 -15
- package/dist/internal/anchored-popup.d.ts +19 -0
- package/dist/internal/anchored-popup.js +89 -0
- package/dist/internal/form-control.d.ts +22 -0
- package/dist/internal/form-control.js +52 -0
- package/dist/internal/image-viewer.d.ts +51 -0
- package/dist/internal/image-viewer.js +210 -0
- package/dist/internal/pagination.d.ts +35 -0
- package/dist/internal/pagination.js +169 -0
- package/dist/internal/popover-base.d.ts +87 -0
- package/dist/internal/popover-base.js +365 -0
- package/dist/internal/presentation.d.ts +2 -0
- package/dist/internal/presentation.js +28 -0
- package/dist/mentions.d.ts +115 -0
- package/dist/mentions.js +485 -0
- package/dist/menu-shared.d.ts +1 -1
- package/dist/menu-shared.js +3 -3
- package/dist/menu.d.ts +63 -0
- package/dist/menu.js +339 -0
- package/dist/modal.js +10 -10
- package/dist/notification.js +9 -9
- package/dist/pagination.d.ts +34 -0
- package/dist/pagination.js +73 -0
- package/dist/popconfirm.d.ts +6 -0
- package/dist/popconfirm.js +7 -0
- package/dist/popover.d.ts +6 -0
- package/dist/popover.js +7 -0
- package/dist/progress.d.ts +30 -0
- package/dist/progress.js +102 -0
- package/dist/qr-code.js +3 -3
- package/dist/radio.d.ts +10 -0
- package/dist/radio.js +18 -5
- package/dist/range.js +7 -7
- package/dist/rate.js +3 -3
- package/dist/resizable.js +4 -4
- package/dist/result.d.ts +22 -0
- package/dist/result.js +88 -0
- package/dist/ribbon.d.ts +19 -0
- package/dist/ribbon.js +106 -0
- package/dist/segmented.d.ts +39 -0
- package/dist/segmented.js +192 -0
- package/dist/select.d.ts +12 -0
- package/dist/select.js +31 -13
- package/dist/skeleton.js +10 -10
- package/dist/spin.d.ts +26 -0
- package/dist/spin.js +80 -0
- package/dist/steps.js +13 -13
- package/dist/switch.d.ts +44 -0
- package/dist/switch.js +104 -0
- package/dist/table.d.ts +0 -2
- package/dist/table.js +46 -87
- package/dist/tabs.js +7 -7
- package/dist/tag.js +8 -8
- package/dist/time-picker.js +10 -10
- package/dist/timeline.js +12 -12
- package/dist/toast.js +9 -9
- package/dist/tooltip.js +4 -4
- package/dist/tour.js +11 -11
- package/dist/tree-node.js +2 -2
- package/dist/tree-select.d.ts +94 -0
- package/dist/tree-select.js +398 -0
- package/dist/tree.js +6 -5
- package/dist/upload.d.ts +107 -0
- package/dist/upload.js +353 -0
- package/dist/virtual-keyboard.js +5 -5
- package/dist/virtual-list.js +4 -4
- package/dist/virtual-mouse.js +5 -5
- package/package.json +82 -1
- package/themes/haiyue-dark.css +51 -0
- package/themes/haiyue-light.css +51 -0
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const componentCSS = "\n:host { --hy-input-font:var(--hy-font-size,14px)/var(--hy-line-height,22px) system-ui,sans-serif; --hy-input-radius:var(--hy-radius,8px); font:inherit;\n --hy-panel-bg-color:var(--hy-surface-color,#171d28);\n --hy-menu-bg-color:var(--hy-surface-color,#171d28); --hy-dialog-bg-color:var(--hy-surface-color,#171d28);\n --hy-dialog-body-color:var(--hy-text-color,#d8e2f2); --hy-dialog-footer-bg-color:var(--hy-surface-color,#171d28);\n --hy-accent-strong-color:var(--hy-accent-color,#8177f2);\n --hy-active-text-color:var(--hy-text-color,#d8e2f2); --hy-hover-bg-color:var(--hy-input-bg-color,#121822);\n --hy-focus-border-color:var(--hy-focus-ring-color,#8177f2); --hy-dialog-radius:var(--hy-radius,8px); }\nbutton, input, select { font:inherit; min-height:2em; border-radius:var(--hy-radius,4px); }\n/* The semantic host owns the touch target. Its actual interactive element\n must fill it too; otherwise a 44px portable Button still paints at 28px. */\n:host(hy-button), :host(hy-input), :host(hy-select) { display:inline-flex; }\n:host(hy-button) button, :host(hy-input) input, :host(hy-select) select {\n box-sizing:border-box; width:100%; min-height:inherit; height:100%; padding-inline:12px;\n}\n:host(hy-select) .wrap, :host(hy-input) .control { width:100%; min-height:inherit; height:100%; box-sizing:border-box; }\n:host(hy-input) input { min-height:0; }\nselect { height:auto; padding-block:4px; }\n:host(hy-input) input { height:auto; align-self:stretch; padding-block:0; border-radius:0; outline:none; }\n.box, .box::after, .handle { transition:var(--hy-portable-transition,background .12s ease); }\n:host(hy-checkbox) { width:auto; }\n:host(hy-checkbox) label, :host(hy-checkbox) .label { white-space:normal; }\n:host(hy-checkbox) input { min-height:0; }\n:host(hy-tabs) { height:auto; grid-template-rows:auto minmax(0,1fr); }\n:host(hy-tabs) .tabs { align-items:stretch; }\n:host(hy-tabs) button { height:auto; white-space:normal; }\n:host(hy-range) .handle { min-height:0; }\n:host(hy-dialog) .header { padding:16px 20px; }\n:host(hy-dialog) h2 { font-size:calc(var(--hy-font-size,14px) + 6px); }\n:host(hy-dialog) .body { display:flex; flex-direction:column; gap:var(--hy-gap,8px); padding:20px; }\n:host(hy-dialog) .body > slot { display:contents; }\n:host(hy-dialog) .footer { box-sizing:border-box; min-height:0; padding:12px 20px; }\n\n/* Portable variants leave individual Web Component APIs unchanged. */\n:host(hy-button) button { border:1px solid var(--hy-border-color); background:var(--hy-surface-color); color:var(--hy-text-color); border-radius:var(--hy-radius,8px); transition:background .12s ease; }\n:host(hy-button[data-hy-variant=primary]) button { background:var(--hy-accent-color); border-color:transparent; color:var(--hy-on-accent-color,#fff); }\n:host(hy-button[data-hy-variant=danger]) button { background:var(--hy-invalid-border-color); border-color:transparent; color:var(--hy-on-accent-color,#fff); }\n:host(hy-button[data-hy-variant=quiet]) button { background:transparent; border-color:transparent; }\n:host(hy-button) button:hover:not(:disabled), :host(hy-button) button:active:not(:disabled) { background:var(--hy-pressed-bg-color,var(--hy-selected-bg-color)); }\n:host(hy-button) button:disabled { opacity:.45; }\n:host(hy-button[data-hy-size=compact]) button { padding-inline:8px; }\n:host(hy-button[icon-only]) button { padding:0; width:100%; }\n:host(hy-tabs) button { min-height:44px; padding:8px 14px; border:0; border-radius:0; background:transparent; color:var(--hy-secondary-text-color); border-bottom:2px solid transparent; }\n:host(hy-tabs) button[aria-selected=true] { color:var(--hy-text-color); border-bottom-color:var(--hy-accent-color); }\n:host(hy-tabs[data-hy-variant=segmented]) .tabs { padding:4px; gap:4px; border-radius:var(--hy-radius,8px); background:var(--hy-input-bg-color); }\n:host(hy-tabs[data-hy-variant=segmented]) button { border:0; border-radius:var(--hy-radius,8px); }\n:host(hy-tabs[data-hy-variant=segmented]) button[aria-selected=true] { background:var(--hy-selected-bg-color,var(--hy-accent-color)); }\nbutton:focus-visible, select:focus-visible { outline:2px solid var(--hy-focus-ring-color,#8177f2); outline-offset:1px; }\n[aria-invalid=true] { border-color:var(--hy-invalid-border-color,#d65c7c); }\n";
|
|
1
|
+
export declare const rootCSS = "\n[data-hy-portable-root] { box-sizing:border-box; min-width:0; min-height:0; width:100%; height:100%;\n color:var(--hy-text-color,#d8e2f2); background:var(--hy-surface-color,#171d28);\n font:calc(var(--hy-font-size,var(--hy-font-size-md, 14px)) * var(--_hy-web-font-scale, 1))/calc(var(--hy-line-height,22px) * var(--_hy-web-font-scale, 1)) var(--hy-font-family, system-ui, sans-serif); }\n[data-hy-portable-root] [data-hy-key] { box-sizing:border-box; min-width:0; min-height:0; }\n[data-hy-portable-root] [data-hy-key][hidden] { display:none !important; }\n[data-hy-portable-root] [data-hy-kind=Row] { display:flex; flex-direction:row; }\n[data-hy-portable-root] [data-hy-kind=RadioGroup] { display:flex; flex-wrap:wrap; gap:var(--hy-gap,var(--hy-space-4, 8px)); }\n[data-hy-portable-root] [data-hy-kind=RadioGroup] hy-radio { font:inherit; min-height:44px; }\n[data-hy-portable-root] [data-hy-kind=Column] { display:flex; flex-direction:column; }\n[data-hy-portable-root] [data-hy-kind=Grid], [data-hy-portable-root] [data-hy-kind=Overlay] { display:grid; }\n[data-hy-portable-root] [data-hy-kind=Text] { display:block; overflow-wrap:anywhere; white-space:pre-wrap; }\n[data-hy-portable-root] [data-hy-kind=Icon] { width:1.25em; height:1.25em; object-fit:contain; }\n[data-hy-portable-root] [data-hy-kind=FormGroup] { border:0; margin:0; padding:0; display:flex; flex-direction:column; gap:var(--hy-gap,var(--hy-space-4, 8px)); }\n[data-hy-portable-root] [data-hy-kind=FormGroup] > legend { padding:0; }\n[data-hy-portable-root] [data-hy-help] { color:var(--hy-secondary-text-color); font-size:var(--hy-caption-font-size,var(--hy-font-size-sm, 12px)); line-height:var(--hy-caption-line-height,18px); }\n[data-hy-portable-root] [data-hy-error] { color:var(--hy-invalid-border-color,#d65c7c); font-size:.9em; }\n[data-hy-portable-root] textarea { box-sizing:border-box; width:100%; min-height:5em; resize:vertical; padding:var(--hy-space-4, 8px);\n color:var(--hy-text-color,#d8e2f2); background:var(--hy-input-bg-color,#121822); border:1px solid var(--hy-border-color,#303746);\n border-radius:var(--hy-radius,var(--hy-radius-sm, 4px)); font:inherit; }\n[data-hy-portable-root] textarea:focus-visible { outline:2px solid var(--hy-focus-ring-color,#8177f2); outline-offset:1px; }\n[data-hy-portable-root] [data-hy-text-style=title] { font-size:var(--hy-title-font-size,calc(var(--hy-font-size-xl, 20px) + 2px)); line-height:var(--hy-title-line-height,30px); font-weight:var(--hy-title-font-weight,var(--hy-font-weight-bold, 700)); }\n[data-hy-portable-root] [data-hy-text-style=caption] { font-size:var(--hy-caption-font-size,var(--hy-font-size-sm, 12px)); line-height:var(--hy-caption-line-height,18px); font-weight:var(--hy-caption-font-weight,var(--hy-font-weight-normal, 400)); }\n[data-hy-portable-root] [data-hy-text-style=body] { font-size:var(--hy-body-font-size,calc(var(--hy-font-size,var(--hy-font-size-md, 14px)) * var(--_hy-web-font-scale, 1))); line-height:var(--hy-body-line-height,calc(var(--hy-line-height,22px) * var(--_hy-web-font-scale, 1))); font-weight:var(--hy-body-font-weight,var(--hy-font-weight-normal, 400)); }\n[data-hy-portable-root] [data-hy-tone=muted] { color:var(--hy-secondary-text-color); }\n[data-hy-portable-root] [data-hy-tone=danger] { color:var(--hy-invalid-border-color); }\n[data-hy-portable-root] [data-hy-kind=Button] [slot=icon] svg { display:block; width:20px; height:20px; }\n[data-hy-portable-root] [data-hy-slot-group] { display:contents; }\n[data-hy-portable-root][data-hy-reduced-motion] { --hy-portable-transition:none; }\n@media(prefers-reduced-motion:reduce) { [data-hy-portable-root] { --hy-portable-transition:none; } }\n";
|
|
2
|
+
export declare const componentCSS = "\n:host { --hy-input-font:calc(var(--hy-font-size,var(--hy-font-size-md, 14px)) * var(--_hy-web-font-scale, 1))/calc(var(--hy-line-height,22px) * var(--_hy-web-font-scale, 1)) var(--hy-font-family, system-ui, sans-serif); --hy-input-radius:var(--hy-radius,var(--hy-radius-lg, 8px)); font:inherit;\n --hy-panel-bg-color:var(--hy-surface-color,#171d28);\n --hy-menu-bg-color:var(--hy-surface-color,#171d28); --hy-dialog-bg-color:var(--hy-surface-color,#171d28);\n --hy-dialog-body-color:var(--hy-text-color,#d8e2f2); --hy-dialog-footer-bg-color:var(--hy-surface-color,#171d28);\n --hy-accent-strong-color:var(--hy-accent-color,#8177f2);\n --hy-active-text-color:var(--hy-text-color,#d8e2f2); --hy-hover-bg-color:var(--hy-input-bg-color,#121822);\n --hy-focus-border-color:var(--hy-focus-ring-color,#8177f2); --hy-dialog-radius:var(--hy-radius,var(--hy-radius-lg, 8px)); }\nbutton, input, select { font:inherit; min-height:2em; border-radius:var(--hy-radius,var(--hy-radius-sm, 4px)); }\n/* The semantic host owns the touch target. Its actual interactive element\n must fill it too; otherwise a 44px portable Button still paints at 28px. */\n:host(hy-button), :host(hy-input), :host(hy-select) { display:inline-flex; }\n:host(hy-button) button, :host(hy-input) input, :host(hy-select) select {\n box-sizing:border-box; width:100%; min-height:inherit; height:100%; padding-inline:var(--hy-space-6, 12px);\n}\n:host(hy-select) .wrap, :host(hy-input) .control { width:100%; min-height:inherit; height:100%; box-sizing:border-box; }\n:host(hy-input) input { min-height:0; }\nselect { height:auto; padding-block:var(--hy-space-2, 4px); }\n:host(hy-input) input { height:auto; align-self:stretch; padding-block:0; border-radius:0; outline:none; }\n.box, .box::after, .handle { transition:var(--hy-portable-transition,background .12s ease); }\n:host(hy-checkbox) { width:auto; }\n:host(hy-checkbox) label, :host(hy-checkbox) .label { white-space:normal; }\n:host(hy-checkbox) input { min-height:0; }\n:host(hy-tabs) { height:auto; grid-template-rows:auto minmax(0,1fr); }\n:host(hy-tabs) .tabs { align-items:stretch; }\n:host(hy-tabs) button { height:auto; white-space:normal; }\n:host(hy-range) .handle { min-height:0; }\n:host(hy-dialog) .header { padding:var(--hy-space-8, 16px) var(--hy-space-10, 20px); }\n:host(hy-dialog) h2 { font-size:calc(calc(var(--hy-font-size,var(--hy-font-size-md, 14px)) * var(--_hy-web-font-scale, 1)) + 6px); }\n:host(hy-dialog) .body { display:flex; flex-direction:column; gap:var(--hy-gap,var(--hy-space-4, 8px)); padding:var(--hy-space-10, 20px); }\n:host(hy-dialog) .body > slot { display:contents; }\n:host(hy-dialog) .footer { box-sizing:border-box; min-height:0; padding:var(--hy-space-6, 12px) var(--hy-space-10, 20px); }\n\n/* Portable variants leave individual Web Component APIs unchanged. */\n:host(hy-button) button { border:1px solid var(--hy-border-color); background:var(--hy-surface-color); color:var(--hy-text-color); border-radius:var(--hy-radius,var(--hy-radius-lg, 8px)); transition:background .12s ease; }\n:host(hy-button[data-hy-variant=primary]) button { background:var(--hy-accent-color); border-color:transparent; color:var(--hy-on-accent-color,#fff); }\n:host(hy-button[data-hy-variant=danger]) button { background:var(--hy-invalid-border-color); border-color:transparent; color:var(--hy-on-accent-color,#fff); }\n:host(hy-button[data-hy-variant=quiet]) button { background:transparent; border-color:transparent; }\n:host(hy-button) button:hover:not(:disabled), :host(hy-button) button:active:not(:disabled) { background:var(--hy-pressed-bg-color,var(--hy-selected-bg-color)); }\n:host(hy-button:is([data-hy-variant=primary], [data-hy-variant=danger])) button:is(:hover, :active):not(:disabled) { color:var(--hy-selected-text-color,var(--hy-on-accent-color,#fff)); }\n:host(hy-button) button:disabled { opacity:.45; }\n:host(hy-button[data-hy-size=compact]) button { padding-inline:var(--hy-space-4, 8px); }\n:host(hy-button[icon-only]) button { padding:0; width:100%; }\n:host(hy-tabs) button { min-height:44px; padding:var(--hy-space-4, 8px) var(--hy-space-7, 14px); border:0; border-radius:0; background:transparent; color:var(--hy-secondary-text-color); border-bottom:2px solid transparent; }\n:host(hy-tabs) button[aria-selected=true] { color:var(--hy-text-color); border-bottom-color:var(--hy-accent-color); }\n:host(hy-tabs[data-hy-variant=segmented]) .tabs { padding:var(--hy-space-2, 4px); gap:var(--hy-space-2, 4px); border-radius:var(--hy-radius,var(--hy-radius-lg, 8px)); background:var(--hy-input-bg-color); }\n:host(hy-tabs[data-hy-variant=segmented]) button { border:0; border-radius:var(--hy-radius,var(--hy-radius-lg, 8px)); }\n:host(hy-tabs[data-hy-variant=segmented]) button[aria-selected=true] { background:var(--hy-selected-bg-color,var(--hy-accent-color)); }\nbutton:focus-visible, select:focus-visible { outline:2px solid var(--hy-focus-ring-color,#8177f2); outline-offset:1px; }\n[aria-invalid=true] { border-color:var(--hy-invalid-border-color,#d65c7c); }\n";
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
/** Only the renderer-owned wrapper and owned ShadowRoots receive these rules. */
|
|
2
|
+
const fontSize = 'calc(var(--hy-font-size,var(--hy-font-size-md, 14px)) * var(--_hy-web-font-scale, 1))';
|
|
3
|
+
const lineHeight = 'calc(var(--hy-line-height,22px) * var(--_hy-web-font-scale, 1))';
|
|
2
4
|
export const rootCSS = `
|
|
3
5
|
[data-hy-portable-root] { box-sizing:border-box; min-width:0; min-height:0; width:100%; height:100%;
|
|
4
6
|
color:var(--hy-text-color,#d8e2f2); background:var(--hy-surface-color,#171d28);
|
|
5
|
-
font
|
|
7
|
+
font:${fontSize}/${lineHeight} var(--hy-font-family, system-ui, sans-serif); }
|
|
6
8
|
[data-hy-portable-root] [data-hy-key] { box-sizing:border-box; min-width:0; min-height:0; }
|
|
7
9
|
[data-hy-portable-root] [data-hy-key][hidden] { display:none !important; }
|
|
8
10
|
[data-hy-portable-root] [data-hy-kind=Row] { display:flex; flex-direction:row; }
|
|
9
|
-
[data-hy-portable-root] [data-hy-kind=RadioGroup] { display:flex; flex-wrap:wrap; gap:var(--hy-gap,8px); }
|
|
11
|
+
[data-hy-portable-root] [data-hy-kind=RadioGroup] { display:flex; flex-wrap:wrap; gap:var(--hy-gap,var(--hy-space-4, 8px)); }
|
|
10
12
|
[data-hy-portable-root] [data-hy-kind=RadioGroup] hy-radio { font:inherit; min-height:44px; }
|
|
11
13
|
[data-hy-portable-root] [data-hy-kind=Column] { display:flex; flex-direction:column; }
|
|
12
14
|
[data-hy-portable-root] [data-hy-kind=Grid], [data-hy-portable-root] [data-hy-kind=Overlay] { display:grid; }
|
|
13
15
|
[data-hy-portable-root] [data-hy-kind=Text] { display:block; overflow-wrap:anywhere; white-space:pre-wrap; }
|
|
14
16
|
[data-hy-portable-root] [data-hy-kind=Icon] { width:1.25em; height:1.25em; object-fit:contain; }
|
|
15
|
-
[data-hy-portable-root] [data-hy-kind=FormGroup] { border:0; margin:0; padding:0; display:flex; flex-direction:column; gap:var(--hy-gap,8px); }
|
|
17
|
+
[data-hy-portable-root] [data-hy-kind=FormGroup] { border:0; margin:0; padding:0; display:flex; flex-direction:column; gap:var(--hy-gap,var(--hy-space-4, 8px)); }
|
|
16
18
|
[data-hy-portable-root] [data-hy-kind=FormGroup] > legend { padding:0; }
|
|
17
|
-
[data-hy-portable-root] [data-hy-help] { color:var(--hy-secondary-text-color); font-size:var(--hy-caption-font-size,12px); line-height:var(--hy-caption-line-height,18px); }
|
|
19
|
+
[data-hy-portable-root] [data-hy-help] { color:var(--hy-secondary-text-color); font-size:var(--hy-caption-font-size,var(--hy-font-size-sm, 12px)); line-height:var(--hy-caption-line-height,18px); }
|
|
18
20
|
[data-hy-portable-root] [data-hy-error] { color:var(--hy-invalid-border-color,#d65c7c); font-size:.9em; }
|
|
19
|
-
[data-hy-portable-root] textarea { box-sizing:border-box; width:100%; min-height:5em; resize:vertical; padding:8px;
|
|
21
|
+
[data-hy-portable-root] textarea { box-sizing:border-box; width:100%; min-height:5em; resize:vertical; padding:var(--hy-space-4, 8px);
|
|
20
22
|
color:var(--hy-text-color,#d8e2f2); background:var(--hy-input-bg-color,#121822); border:1px solid var(--hy-border-color,#303746);
|
|
21
|
-
border-radius:var(--hy-radius,4px); font:inherit; }
|
|
23
|
+
border-radius:var(--hy-radius,var(--hy-radius-sm, 4px)); font:inherit; }
|
|
22
24
|
[data-hy-portable-root] textarea:focus-visible { outline:2px solid var(--hy-focus-ring-color,#8177f2); outline-offset:1px; }
|
|
23
|
-
[data-hy-portable-root] [data-hy-text-style=title] { font-size:var(--hy-title-font-size,
|
|
24
|
-
[data-hy-portable-root] [data-hy-text-style=caption] { font-size:var(--hy-caption-font-size,12px); line-height:var(--hy-caption-line-height,18px); font-weight:var(--hy-caption-font-weight,400); }
|
|
25
|
-
[data-hy-portable-root] [data-hy-text-style=body] { font-size:var(--hy-body-font-size
|
|
25
|
+
[data-hy-portable-root] [data-hy-text-style=title] { font-size:var(--hy-title-font-size,calc(var(--hy-font-size-xl, 20px) + 2px)); line-height:var(--hy-title-line-height,30px); font-weight:var(--hy-title-font-weight,var(--hy-font-weight-bold, 700)); }
|
|
26
|
+
[data-hy-portable-root] [data-hy-text-style=caption] { font-size:var(--hy-caption-font-size,var(--hy-font-size-sm, 12px)); line-height:var(--hy-caption-line-height,18px); font-weight:var(--hy-caption-font-weight,var(--hy-font-weight-normal, 400)); }
|
|
27
|
+
[data-hy-portable-root] [data-hy-text-style=body] { font-size:var(--hy-body-font-size,${fontSize}); line-height:var(--hy-body-line-height,${lineHeight}); font-weight:var(--hy-body-font-weight,var(--hy-font-weight-normal, 400)); }
|
|
26
28
|
[data-hy-portable-root] [data-hy-tone=muted] { color:var(--hy-secondary-text-color); }
|
|
27
29
|
[data-hy-portable-root] [data-hy-tone=danger] { color:var(--hy-invalid-border-color); }
|
|
28
30
|
[data-hy-portable-root] [data-hy-kind=Button] [slot=icon] svg { display:block; width:20px; height:20px; }
|
|
@@ -31,23 +33,23 @@ export const rootCSS = `
|
|
|
31
33
|
@media(prefers-reduced-motion:reduce) { [data-hy-portable-root] { --hy-portable-transition:none; } }
|
|
32
34
|
`;
|
|
33
35
|
export const componentCSS = `
|
|
34
|
-
:host { --hy-input-font
|
|
36
|
+
:host { --hy-input-font:${fontSize}/${lineHeight} var(--hy-font-family, system-ui, sans-serif); --hy-input-radius:var(--hy-radius,var(--hy-radius-lg, 8px)); font:inherit;
|
|
35
37
|
--hy-panel-bg-color:var(--hy-surface-color,#171d28);
|
|
36
38
|
--hy-menu-bg-color:var(--hy-surface-color,#171d28); --hy-dialog-bg-color:var(--hy-surface-color,#171d28);
|
|
37
39
|
--hy-dialog-body-color:var(--hy-text-color,#d8e2f2); --hy-dialog-footer-bg-color:var(--hy-surface-color,#171d28);
|
|
38
40
|
--hy-accent-strong-color:var(--hy-accent-color,#8177f2);
|
|
39
41
|
--hy-active-text-color:var(--hy-text-color,#d8e2f2); --hy-hover-bg-color:var(--hy-input-bg-color,#121822);
|
|
40
|
-
--hy-focus-border-color:var(--hy-focus-ring-color,#8177f2); --hy-dialog-radius:var(--hy-radius,8px); }
|
|
41
|
-
button, input, select { font:inherit; min-height:2em; border-radius:var(--hy-radius,4px); }
|
|
42
|
+
--hy-focus-border-color:var(--hy-focus-ring-color,#8177f2); --hy-dialog-radius:var(--hy-radius,var(--hy-radius-lg, 8px)); }
|
|
43
|
+
button, input, select { font:inherit; min-height:2em; border-radius:var(--hy-radius,var(--hy-radius-sm, 4px)); }
|
|
42
44
|
/* The semantic host owns the touch target. Its actual interactive element
|
|
43
45
|
must fill it too; otherwise a 44px portable Button still paints at 28px. */
|
|
44
46
|
:host(hy-button), :host(hy-input), :host(hy-select) { display:inline-flex; }
|
|
45
47
|
:host(hy-button) button, :host(hy-input) input, :host(hy-select) select {
|
|
46
|
-
box-sizing:border-box; width:100%; min-height:inherit; height:100%; padding-inline:12px;
|
|
48
|
+
box-sizing:border-box; width:100%; min-height:inherit; height:100%; padding-inline:var(--hy-space-6, 12px);
|
|
47
49
|
}
|
|
48
50
|
:host(hy-select) .wrap, :host(hy-input) .control { width:100%; min-height:inherit; height:100%; box-sizing:border-box; }
|
|
49
51
|
:host(hy-input) input { min-height:0; }
|
|
50
|
-
select { height:auto; padding-block:4px; }
|
|
52
|
+
select { height:auto; padding-block:var(--hy-space-2, 4px); }
|
|
51
53
|
:host(hy-input) input { height:auto; align-self:stretch; padding-block:0; border-radius:0; outline:none; }
|
|
52
54
|
.box, .box::after, .handle { transition:var(--hy-portable-transition,background .12s ease); }
|
|
53
55
|
:host(hy-checkbox) { width:auto; }
|
|
@@ -57,25 +59,26 @@ select { height:auto; padding-block:4px; }
|
|
|
57
59
|
:host(hy-tabs) .tabs { align-items:stretch; }
|
|
58
60
|
:host(hy-tabs) button { height:auto; white-space:normal; }
|
|
59
61
|
:host(hy-range) .handle { min-height:0; }
|
|
60
|
-
:host(hy-dialog) .header { padding:16px 20px; }
|
|
61
|
-
:host(hy-dialog) h2 { font-size:calc(
|
|
62
|
-
:host(hy-dialog) .body { display:flex; flex-direction:column; gap:var(--hy-gap,8px); padding:20px; }
|
|
62
|
+
:host(hy-dialog) .header { padding:var(--hy-space-8, 16px) var(--hy-space-10, 20px); }
|
|
63
|
+
:host(hy-dialog) h2 { font-size:calc(${fontSize} + 6px); }
|
|
64
|
+
:host(hy-dialog) .body { display:flex; flex-direction:column; gap:var(--hy-gap,var(--hy-space-4, 8px)); padding:var(--hy-space-10, 20px); }
|
|
63
65
|
:host(hy-dialog) .body > slot { display:contents; }
|
|
64
|
-
:host(hy-dialog) .footer { box-sizing:border-box; min-height:0; padding:12px 20px; }
|
|
66
|
+
:host(hy-dialog) .footer { box-sizing:border-box; min-height:0; padding:var(--hy-space-6, 12px) var(--hy-space-10, 20px); }
|
|
65
67
|
|
|
66
68
|
/* Portable variants leave individual Web Component APIs unchanged. */
|
|
67
|
-
:host(hy-button) button { border:1px solid var(--hy-border-color); background:var(--hy-surface-color); color:var(--hy-text-color); border-radius:var(--hy-radius,8px); transition:background .12s ease; }
|
|
69
|
+
:host(hy-button) button { border:1px solid var(--hy-border-color); background:var(--hy-surface-color); color:var(--hy-text-color); border-radius:var(--hy-radius,var(--hy-radius-lg, 8px)); transition:background .12s ease; }
|
|
68
70
|
:host(hy-button[data-hy-variant=primary]) button { background:var(--hy-accent-color); border-color:transparent; color:var(--hy-on-accent-color,#fff); }
|
|
69
71
|
:host(hy-button[data-hy-variant=danger]) button { background:var(--hy-invalid-border-color); border-color:transparent; color:var(--hy-on-accent-color,#fff); }
|
|
70
72
|
:host(hy-button[data-hy-variant=quiet]) button { background:transparent; border-color:transparent; }
|
|
71
73
|
:host(hy-button) button:hover:not(:disabled), :host(hy-button) button:active:not(:disabled) { background:var(--hy-pressed-bg-color,var(--hy-selected-bg-color)); }
|
|
74
|
+
:host(hy-button:is([data-hy-variant=primary], [data-hy-variant=danger])) button:is(:hover, :active):not(:disabled) { color:var(--hy-selected-text-color,var(--hy-on-accent-color,#fff)); }
|
|
72
75
|
:host(hy-button) button:disabled { opacity:.45; }
|
|
73
|
-
:host(hy-button[data-hy-size=compact]) button { padding-inline:8px; }
|
|
76
|
+
:host(hy-button[data-hy-size=compact]) button { padding-inline:var(--hy-space-4, 8px); }
|
|
74
77
|
:host(hy-button[icon-only]) button { padding:0; width:100%; }
|
|
75
|
-
:host(hy-tabs) button { min-height:44px; padding:8px 14px; border:0; border-radius:0; background:transparent; color:var(--hy-secondary-text-color); border-bottom:2px solid transparent; }
|
|
78
|
+
:host(hy-tabs) button { min-height:44px; padding:var(--hy-space-4, 8px) var(--hy-space-7, 14px); border:0; border-radius:0; background:transparent; color:var(--hy-secondary-text-color); border-bottom:2px solid transparent; }
|
|
76
79
|
:host(hy-tabs) button[aria-selected=true] { color:var(--hy-text-color); border-bottom-color:var(--hy-accent-color); }
|
|
77
|
-
:host(hy-tabs[data-hy-variant=segmented]) .tabs { padding:4px; gap:4px; border-radius:var(--hy-radius,8px); background:var(--hy-input-bg-color); }
|
|
78
|
-
:host(hy-tabs[data-hy-variant=segmented]) button { border:0; border-radius:var(--hy-radius,8px); }
|
|
80
|
+
:host(hy-tabs[data-hy-variant=segmented]) .tabs { padding:var(--hy-space-2, 4px); gap:var(--hy-space-2, 4px); border-radius:var(--hy-radius,var(--hy-radius-lg, 8px)); background:var(--hy-input-bg-color); }
|
|
81
|
+
:host(hy-tabs[data-hy-variant=segmented]) button { border:0; border-radius:var(--hy-radius,var(--hy-radius-lg, 8px)); }
|
|
79
82
|
:host(hy-tabs[data-hy-variant=segmented]) button[aria-selected=true] { background:var(--hy-selected-bg-color,var(--hy-accent-color)); }
|
|
80
83
|
button:focus-visible, select:focus-visible { outline:2px solid var(--hy-focus-ring-color,#8177f2); outline-offset:1px; }
|
|
81
84
|
[aria-invalid=true] { border-color:var(--hy-invalid-border-color,#d65c7c); }
|
package/dist/alert.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type HYAlertType = 'success' | 'info' | 'warning' | 'error';
|
|
2
|
+
export interface HYAlertCloseDetail {
|
|
3
|
+
readonly type: HYAlertType;
|
|
4
|
+
readonly message: string;
|
|
5
|
+
}
|
|
6
|
+
/** A semantic, optionally dismissible status message. */
|
|
7
|
+
export declare class HYAlert extends HTMLElement {
|
|
8
|
+
private readonly _surface;
|
|
9
|
+
private readonly _icon;
|
|
10
|
+
private readonly _content;
|
|
11
|
+
private readonly _messageSlot;
|
|
12
|
+
private readonly _descriptionSlot;
|
|
13
|
+
private readonly _actionSlot;
|
|
14
|
+
private readonly _close;
|
|
15
|
+
static get observedAttributes(): string[];
|
|
16
|
+
constructor();
|
|
17
|
+
connectedCallback(): void;
|
|
18
|
+
disconnectedCallback(): void;
|
|
19
|
+
attributeChangedCallback(): void;
|
|
20
|
+
get type(): HYAlertType;
|
|
21
|
+
set type(value: HYAlertType);
|
|
22
|
+
get message(): string;
|
|
23
|
+
set message(value: string);
|
|
24
|
+
get description(): string;
|
|
25
|
+
set description(value: string);
|
|
26
|
+
get showIcon(): boolean;
|
|
27
|
+
set showIcon(value: boolean);
|
|
28
|
+
get closable(): boolean;
|
|
29
|
+
set closable(value: boolean);
|
|
30
|
+
get closeText(): string;
|
|
31
|
+
set closeText(value: string);
|
|
32
|
+
get banner(): boolean;
|
|
33
|
+
set banner(value: boolean);
|
|
34
|
+
close(): boolean;
|
|
35
|
+
private readonly _onClose;
|
|
36
|
+
private readonly _syncSlotState;
|
|
37
|
+
private _render;
|
|
38
|
+
}
|
|
39
|
+
export declare function defineAlertComponents(): void;
|
package/dist/alert.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
const ALERT_ICONS = {
|
|
2
|
+
success: '✓',
|
|
3
|
+
info: 'i',
|
|
4
|
+
warning: '!',
|
|
5
|
+
error: '×',
|
|
6
|
+
};
|
|
7
|
+
/** A semantic, optionally dismissible status message. */
|
|
8
|
+
export class HYAlert extends HTMLElement {
|
|
9
|
+
_surface = document.createElement('div');
|
|
10
|
+
_icon = document.createElement('span');
|
|
11
|
+
_content = document.createElement('div');
|
|
12
|
+
_messageSlot = document.createElement('slot');
|
|
13
|
+
_descriptionSlot = document.createElement('slot');
|
|
14
|
+
_actionSlot = document.createElement('slot');
|
|
15
|
+
_close = document.createElement('button');
|
|
16
|
+
static get observedAttributes() {
|
|
17
|
+
return ['type', 'message', 'description', 'show-icon', 'closable', 'close-text', 'banner'];
|
|
18
|
+
}
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
22
|
+
const style = document.createElement('style');
|
|
23
|
+
style.textContent = `
|
|
24
|
+
:host { display: block; min-width: 0; color: var(--hy-text-color, #d8e2f2); font: var(--hy-font-size-sm, 12px)/var(--hy-line-height-relaxed, 1.5) var(--hy-font-family, system-ui, sans-serif); }
|
|
25
|
+
:host([hidden]) { display: none; }
|
|
26
|
+
.alert { --_tone: var(--hy-info-color, #4ba3d3); --_tone-bg: var(--hy-alert-info-bg, color-mix(in srgb, var(--_tone) 13%, var(--hy-surface-color, #121822))); display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: var(--hy-space-5, 10px); align-items: start; box-sizing: border-box; min-height: 42px; padding: var(--hy-space-5, 10px) var(--hy-space-6, 12px); border: 1px solid color-mix(in srgb, var(--_tone) 42%, var(--hy-border-color, #303746)); border-radius: var(--hy-alert-radius, var(--hy-radius-md, 6px)); background: var(--_tone-bg); }
|
|
27
|
+
.alert.success { --_tone: var(--hy-success-color, #45b883); --_tone-bg: var(--hy-alert-success-bg, color-mix(in srgb, var(--_tone) 13%, var(--hy-surface-color, #121822))); }
|
|
28
|
+
.alert.warning { --_tone: var(--hy-warning-color, #d5a642); --_tone-bg: var(--hy-alert-warning-bg, color-mix(in srgb, var(--_tone) 14%, var(--hy-surface-color, #121822))); }
|
|
29
|
+
.alert.error { --_tone: var(--hy-error-color, #e06b72); --_tone-bg: var(--hy-alert-error-bg, color-mix(in srgb, var(--_tone) 13%, var(--hy-surface-color, #121822))); }
|
|
30
|
+
:host([banner]) .alert { border-inline: 0; border-radius: 0; }
|
|
31
|
+
.icon { display: none; width: 18px; height: 18px; place-items: center; margin-top: 1px; border-radius: 50%; color: var(--hy-alert-icon-text-color, var(--hy-on-status-color, #fff)); background: var(--_tone); font-size: calc(var(--hy-font-size-xs, 10px) + 1px); font-weight: var(--hy-font-weight-heavy, 800); line-height: var(--hy-line-height-tight, 1); }
|
|
32
|
+
.icon.visible { display: grid; }
|
|
33
|
+
.content { min-width: 0; }
|
|
34
|
+
.message { display: block; color: var(--hy-alert-message-color, var(--hy-text-color, #d8e2f2)); font-weight: var(--hy-font-weight-semibold, 600); overflow-wrap: anywhere; }
|
|
35
|
+
.description { display: block; margin-top: var(--hy-space-1, 2px); color: var(--hy-alert-description-color, var(--hy-secondary-text-color, #8fa7c8)); overflow-wrap: anywhere; }
|
|
36
|
+
.description.empty { display: none; }
|
|
37
|
+
.action { align-self: center; }
|
|
38
|
+
.action.empty { display: none; }
|
|
39
|
+
button { min-width: var(--hy-control-height-xs, 24px); height: var(--hy-control-height-xs, 24px); margin: calc(-1 * var(--hy-space-1, 2px)) calc(-1 * var(--hy-space-2, 4px)) calc(-1 * var(--hy-space-1, 2px)) 0; padding: 0 calc(var(--hy-space-2, 4px) + 1px); border: 0; border-radius: var(--hy-radius-sm, 4px); color: var(--hy-alert-close-color, var(--hy-secondary-text-color, #8fa7c8)); background: transparent; font: inherit; cursor: pointer; }
|
|
40
|
+
button:hover { color: var(--hy-alert-close-hover-color, var(--hy-text-color, #d8e2f2)); background: color-mix(in srgb, var(--_tone) 14%, transparent); }
|
|
41
|
+
button:focus-visible { outline: 2px solid var(--hy-focus-border-color, #3d6fa8); outline-offset: 1px; }
|
|
42
|
+
button[hidden] { display: none; }
|
|
43
|
+
::slotted([slot="icon"]) { color: var(--_tone); }
|
|
44
|
+
`;
|
|
45
|
+
this._surface.className = 'alert info';
|
|
46
|
+
this._surface.part.add('alert');
|
|
47
|
+
this._surface.setAttribute('role', 'alert');
|
|
48
|
+
this._icon.className = 'icon';
|
|
49
|
+
this._icon.part.add('icon');
|
|
50
|
+
const iconSlot = document.createElement('slot');
|
|
51
|
+
iconSlot.name = 'icon';
|
|
52
|
+
this._icon.append(iconSlot);
|
|
53
|
+
this._content.className = 'content';
|
|
54
|
+
this._content.part.add('content');
|
|
55
|
+
this._messageSlot.name = 'message';
|
|
56
|
+
this._messageSlot.className = 'message';
|
|
57
|
+
this._messageSlot.part.add('message');
|
|
58
|
+
this._descriptionSlot.className = 'description';
|
|
59
|
+
this._descriptionSlot.part.add('description');
|
|
60
|
+
this._actionSlot.name = 'action';
|
|
61
|
+
this._actionSlot.className = 'action';
|
|
62
|
+
this._actionSlot.part.add('action');
|
|
63
|
+
this._content.append(this._messageSlot, this._descriptionSlot);
|
|
64
|
+
this._close.type = 'button';
|
|
65
|
+
this._close.part.add('close-button');
|
|
66
|
+
this._surface.append(this._icon, this._content, this._actionSlot, this._close);
|
|
67
|
+
root.append(style, this._surface);
|
|
68
|
+
}
|
|
69
|
+
connectedCallback() {
|
|
70
|
+
this._close.addEventListener('click', this._onClose);
|
|
71
|
+
this._descriptionSlot.addEventListener('slotchange', this._syncSlotState);
|
|
72
|
+
this._actionSlot.addEventListener('slotchange', this._syncSlotState);
|
|
73
|
+
this._render();
|
|
74
|
+
}
|
|
75
|
+
disconnectedCallback() {
|
|
76
|
+
this._close.removeEventListener('click', this._onClose);
|
|
77
|
+
this._descriptionSlot.removeEventListener('slotchange', this._syncSlotState);
|
|
78
|
+
this._actionSlot.removeEventListener('slotchange', this._syncSlotState);
|
|
79
|
+
}
|
|
80
|
+
attributeChangedCallback() { this._render(); }
|
|
81
|
+
get type() {
|
|
82
|
+
const value = this.getAttribute('type');
|
|
83
|
+
return value === 'success' || value === 'warning' || value === 'error' ? value : 'info';
|
|
84
|
+
}
|
|
85
|
+
set type(value) { this.setAttribute('type', value); }
|
|
86
|
+
get message() { return this.getAttribute('message') ?? ''; }
|
|
87
|
+
set message(value) { if (value)
|
|
88
|
+
this.setAttribute('message', value);
|
|
89
|
+
else
|
|
90
|
+
this.removeAttribute('message'); }
|
|
91
|
+
get description() { return this.getAttribute('description') ?? ''; }
|
|
92
|
+
set description(value) { if (value)
|
|
93
|
+
this.setAttribute('description', value);
|
|
94
|
+
else
|
|
95
|
+
this.removeAttribute('description'); }
|
|
96
|
+
get showIcon() { return this.hasAttribute('show-icon'); }
|
|
97
|
+
set showIcon(value) { this.toggleAttribute('show-icon', Boolean(value)); }
|
|
98
|
+
get closable() { return this.hasAttribute('closable'); }
|
|
99
|
+
set closable(value) { this.toggleAttribute('closable', Boolean(value)); }
|
|
100
|
+
get closeText() { return this.getAttribute('close-text') ?? ''; }
|
|
101
|
+
set closeText(value) { if (value)
|
|
102
|
+
this.setAttribute('close-text', value);
|
|
103
|
+
else
|
|
104
|
+
this.removeAttribute('close-text'); }
|
|
105
|
+
get banner() { return this.hasAttribute('banner'); }
|
|
106
|
+
set banner(value) { this.toggleAttribute('banner', Boolean(value)); }
|
|
107
|
+
close() {
|
|
108
|
+
const event = new CustomEvent('alert-close', {
|
|
109
|
+
detail: { type: this.type, message: this.message },
|
|
110
|
+
bubbles: true,
|
|
111
|
+
composed: true,
|
|
112
|
+
cancelable: true,
|
|
113
|
+
});
|
|
114
|
+
if (!this.dispatchEvent(event))
|
|
115
|
+
return false;
|
|
116
|
+
this.hidden = true;
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
_onClose = () => { this.close(); };
|
|
120
|
+
_syncSlotState = () => {
|
|
121
|
+
const hasDescription = Boolean(this.description) || this._descriptionSlot.assignedNodes({ flatten: true }).some(node => node.textContent?.trim());
|
|
122
|
+
const hasAction = this._actionSlot.assignedNodes({ flatten: true }).some(node => node.nodeType !== Node.TEXT_NODE || node.textContent?.trim());
|
|
123
|
+
this._descriptionSlot.classList.toggle('empty', !hasDescription);
|
|
124
|
+
this._actionSlot.classList.toggle('empty', !hasAction);
|
|
125
|
+
};
|
|
126
|
+
_render() {
|
|
127
|
+
this._surface.className = `alert ${this.type}`;
|
|
128
|
+
this._messageSlot.textContent = this.message;
|
|
129
|
+
this._descriptionSlot.textContent = this.description;
|
|
130
|
+
this._icon.classList.toggle('visible', this.showIcon || this.banner);
|
|
131
|
+
const iconSlot = this._icon.querySelector('slot');
|
|
132
|
+
if (iconSlot)
|
|
133
|
+
iconSlot.textContent = ALERT_ICONS[this.type];
|
|
134
|
+
this._close.hidden = !this.closable;
|
|
135
|
+
this._close.textContent = this.closeText || '×';
|
|
136
|
+
this._close.setAttribute('aria-label', this.closeText || 'Close alert');
|
|
137
|
+
this._syncSlotState();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
export function defineAlertComponents() {
|
|
141
|
+
if (!customElements.get('hy-alert'))
|
|
142
|
+
customElements.define('hy-alert', HYAlert);
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=alert.js.map
|
package/dist/anchor.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type HYAnchorDirection = 'vertical' | 'horizontal';
|
|
2
|
+
export interface HYAnchorItem {
|
|
3
|
+
readonly href: string;
|
|
4
|
+
readonly title: string;
|
|
5
|
+
readonly key?: string;
|
|
6
|
+
readonly disabled?: boolean;
|
|
7
|
+
readonly children?: readonly HYAnchorItem[];
|
|
8
|
+
}
|
|
9
|
+
export interface HYAnchorChangeDetail {
|
|
10
|
+
readonly href: string;
|
|
11
|
+
readonly item: HYAnchorItem | null;
|
|
12
|
+
}
|
|
13
|
+
export interface HYAnchorClickDetail extends HYAnchorChangeDetail {
|
|
14
|
+
readonly nativeEvent: MouseEvent;
|
|
15
|
+
}
|
|
16
|
+
/** Hash-link navigation that tracks targets inside the viewport or an owned scroll container. */
|
|
17
|
+
export declare class HYAnchor extends HTMLElement {
|
|
18
|
+
private readonly _nav;
|
|
19
|
+
private readonly _list;
|
|
20
|
+
private _items;
|
|
21
|
+
private _scrollContainer;
|
|
22
|
+
private _listeners;
|
|
23
|
+
private _frame;
|
|
24
|
+
private _programmaticHref;
|
|
25
|
+
private _scrollEndTimer;
|
|
26
|
+
static get observedAttributes(): string[];
|
|
27
|
+
constructor();
|
|
28
|
+
connectedCallback(): void;
|
|
29
|
+
disconnectedCallback(): void;
|
|
30
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
31
|
+
get items(): HYAnchorItem[];
|
|
32
|
+
set items(value: HYAnchorItem[]);
|
|
33
|
+
get activeHref(): string;
|
|
34
|
+
set activeHref(value: string);
|
|
35
|
+
get offsetTop(): number;
|
|
36
|
+
set offsetTop(value: number);
|
|
37
|
+
get bounds(): number;
|
|
38
|
+
set bounds(value: number);
|
|
39
|
+
get direction(): HYAnchorDirection;
|
|
40
|
+
set direction(value: HYAnchorDirection);
|
|
41
|
+
get smooth(): boolean;
|
|
42
|
+
set smooth(value: boolean);
|
|
43
|
+
get scrollContainer(): HTMLElement | Window | null;
|
|
44
|
+
set scrollContainer(value: HTMLElement | Window | null);
|
|
45
|
+
scrollToAnchor(href: string): boolean;
|
|
46
|
+
refresh(): void;
|
|
47
|
+
private _normalizeItems;
|
|
48
|
+
private _readItemsAttribute;
|
|
49
|
+
private _flatten;
|
|
50
|
+
private _render;
|
|
51
|
+
private _onClick;
|
|
52
|
+
private _resolveTarget;
|
|
53
|
+
private _connect;
|
|
54
|
+
private _disconnect;
|
|
55
|
+
private _measure;
|
|
56
|
+
private _scheduleScrollEnd;
|
|
57
|
+
private _finishProgrammaticScroll;
|
|
58
|
+
private _setActive;
|
|
59
|
+
}
|
|
60
|
+
export declare function defineAnchorComponents(): void;
|