@weave-framework/ui 0.2.107
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/LICENSE +21 -0
- package/README.md +17 -0
- package/dist/autocomplete/autocomplete.d.ts +86 -0
- package/dist/autocomplete/autocomplete.d.ts.map +1 -0
- package/dist/autocomplete/autocomplete.js +263 -0
- package/dist/autocomplete/autocomplete.js.map +1 -0
- package/dist/badge/badge.d.ts +39 -0
- package/dist/badge/badge.d.ts.map +1 -0
- package/dist/badge/badge.js +59 -0
- package/dist/badge/badge.js.map +1 -0
- package/dist/bottom-sheet/bottom-sheet.d.ts +21 -0
- package/dist/bottom-sheet/bottom-sheet.d.ts.map +1 -0
- package/dist/bottom-sheet/bottom-sheet.js +82 -0
- package/dist/bottom-sheet/bottom-sheet.js.map +1 -0
- package/dist/button/button.d.ts +47 -0
- package/dist/button/button.d.ts.map +1 -0
- package/dist/button/button.js +47 -0
- package/dist/button/button.js.map +1 -0
- package/dist/button-toggle/button-toggle.d.ts +65 -0
- package/dist/button-toggle/button-toggle.d.ts.map +1 -0
- package/dist/button-toggle/button-toggle.js +127 -0
- package/dist/button-toggle/button-toggle.js.map +1 -0
- package/dist/card/card.d.ts +30 -0
- package/dist/card/card.d.ts.map +1 -0
- package/dist/card/card.js +32 -0
- package/dist/card/card.js.map +1 -0
- package/dist/cdk/bidi.d.ts +19 -0
- package/dist/cdk/bidi.d.ts.map +1 -0
- package/dist/cdk/bidi.js +32 -0
- package/dist/cdk/bidi.js.map +1 -0
- package/dist/cdk/breakpoints.d.ts +21 -0
- package/dist/cdk/breakpoints.d.ts.map +1 -0
- package/dist/cdk/breakpoints.js +39 -0
- package/dist/cdk/breakpoints.js.map +1 -0
- package/dist/cdk/clipboard.d.ts +8 -0
- package/dist/cdk/clipboard.d.ts.map +1 -0
- package/dist/cdk/clipboard.js +38 -0
- package/dist/cdk/clipboard.js.map +1 -0
- package/dist/cdk/data-source.d.ts +41 -0
- package/dist/cdk/data-source.d.ts.map +1 -0
- package/dist/cdk/data-source.js +36 -0
- package/dist/cdk/data-source.js.map +1 -0
- package/dist/cdk/date-adapter.d.ts +63 -0
- package/dist/cdk/date-adapter.d.ts.map +1 -0
- package/dist/cdk/date-adapter.js +155 -0
- package/dist/cdk/date-adapter.js.map +1 -0
- package/dist/cdk/drag-drop.d.ts +77 -0
- package/dist/cdk/drag-drop.d.ts.map +1 -0
- package/dist/cdk/drag-drop.js +268 -0
- package/dist/cdk/drag-drop.js.map +1 -0
- package/dist/cdk/focus-monitor.d.ts +27 -0
- package/dist/cdk/focus-monitor.d.ts.map +1 -0
- package/dist/cdk/focus-monitor.js +66 -0
- package/dist/cdk/focus-monitor.js.map +1 -0
- package/dist/cdk/focus-trap.d.ts +39 -0
- package/dist/cdk/focus-trap.d.ts.map +1 -0
- package/dist/cdk/focus-trap.js +127 -0
- package/dist/cdk/focus-trap.js.map +1 -0
- package/dist/cdk/index.d.ts +29 -0
- package/dist/cdk/index.d.ts.map +1 -0
- package/dist/cdk/index.js +29 -0
- package/dist/cdk/index.js.map +1 -0
- package/dist/cdk/interactivity.d.ts +19 -0
- package/dist/cdk/interactivity.d.ts.map +1 -0
- package/dist/cdk/interactivity.js +70 -0
- package/dist/cdk/interactivity.js.map +1 -0
- package/dist/cdk/key-manager.d.ts +41 -0
- package/dist/cdk/key-manager.d.ts.map +1 -0
- package/dist/cdk/key-manager.js +126 -0
- package/dist/cdk/key-manager.js.map +1 -0
- package/dist/cdk/live-announcer.d.ts +19 -0
- package/dist/cdk/live-announcer.d.ts.map +1 -0
- package/dist/cdk/live-announcer.js +48 -0
- package/dist/cdk/live-announcer.js.map +1 -0
- package/dist/cdk/observers.d.ts +17 -0
- package/dist/cdk/observers.d.ts.map +1 -0
- package/dist/cdk/observers.js +35 -0
- package/dist/cdk/observers.js.map +1 -0
- package/dist/cdk/overlay.d.ts +73 -0
- package/dist/cdk/overlay.d.ts.map +1 -0
- package/dist/cdk/overlay.js +154 -0
- package/dist/cdk/overlay.js.map +1 -0
- package/dist/cdk/platform.d.ts +22 -0
- package/dist/cdk/platform.d.ts.map +1 -0
- package/dist/cdk/platform.js +55 -0
- package/dist/cdk/platform.js.map +1 -0
- package/dist/cdk/portal.d.ts +31 -0
- package/dist/cdk/portal.d.ts.map +1 -0
- package/dist/cdk/portal.js +55 -0
- package/dist/cdk/portal.js.map +1 -0
- package/dist/cdk/positioning.d.ts +53 -0
- package/dist/cdk/positioning.d.ts.map +1 -0
- package/dist/cdk/positioning.js +140 -0
- package/dist/cdk/positioning.js.map +1 -0
- package/dist/cdk/scroll.d.ts +43 -0
- package/dist/cdk/scroll.d.ts.map +1 -0
- package/dist/cdk/scroll.js +97 -0
- package/dist/cdk/scroll.js.map +1 -0
- package/dist/cdk/selection-model.d.ts +50 -0
- package/dist/cdk/selection-model.d.ts.map +1 -0
- package/dist/cdk/selection-model.js +77 -0
- package/dist/cdk/selection-model.js.map +1 -0
- package/dist/cdk/virtual-scroll.d.ts +50 -0
- package/dist/cdk/virtual-scroll.d.ts.map +1 -0
- package/dist/cdk/virtual-scroll.js +92 -0
- package/dist/cdk/virtual-scroll.js.map +1 -0
- package/dist/checkbox/checkbox.d.ts +65 -0
- package/dist/checkbox/checkbox.d.ts.map +1 -0
- package/dist/checkbox/checkbox.js +82 -0
- package/dist/checkbox/checkbox.js.map +1 -0
- package/dist/chips/chips.d.ts +65 -0
- package/dist/chips/chips.d.ts.map +1 -0
- package/dist/chips/chips.js +119 -0
- package/dist/chips/chips.js.map +1 -0
- package/dist/context-menu/context-menu.d.ts +32 -0
- package/dist/context-menu/context-menu.d.ts.map +1 -0
- package/dist/context-menu/context-menu.js +63 -0
- package/dist/context-menu/context-menu.js.map +1 -0
- package/dist/datepicker/datepicker.d.ts +100 -0
- package/dist/datepicker/datepicker.d.ts.map +1 -0
- package/dist/datepicker/datepicker.js +440 -0
- package/dist/datepicker/datepicker.js.map +1 -0
- package/dist/dialog/dialog.d.ts +27 -0
- package/dist/dialog/dialog.d.ts.map +1 -0
- package/dist/dialog/dialog.js +47 -0
- package/dist/dialog/dialog.js.map +1 -0
- package/dist/dialog/modal-core.d.ts +42 -0
- package/dist/dialog/modal-core.d.ts.map +1 -0
- package/dist/dialog/modal-core.js +103 -0
- package/dist/dialog/modal-core.js.map +1 -0
- package/dist/expansion/expansion.d.ts +71 -0
- package/dist/expansion/expansion.d.ts.map +1 -0
- package/dist/expansion/expansion.js +127 -0
- package/dist/expansion/expansion.js.map +1 -0
- package/dist/form-field/form-field.d.ts +48 -0
- package/dist/form-field/form-field.d.ts.map +1 -0
- package/dist/form-field/form-field.js +89 -0
- package/dist/form-field/form-field.js.map +1 -0
- package/dist/grid-list/grid-list.d.ts +25 -0
- package/dist/grid-list/grid-list.d.ts.map +1 -0
- package/dist/grid-list/grid-list.js +22 -0
- package/dist/grid-list/grid-list.js.map +1 -0
- package/dist/icon/icon.d.ts +40 -0
- package/dist/icon/icon.d.ts.map +1 -0
- package/dist/icon/icon.js +99 -0
- package/dist/icon/icon.js.map +1 -0
- package/dist/icon/icons.d.ts +60 -0
- package/dist/icon/icons.d.ts.map +1 -0
- package/dist/icon/icons.js +126 -0
- package/dist/icon/icons.js.map +1 -0
- package/dist/icon/lucide-icons.d.ts +11 -0
- package/dist/icon/lucide-icons.d.ts.map +1 -0
- package/dist/icon/lucide-icons.js +65 -0
- package/dist/icon/lucide-icons.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/input/input.d.ts +90 -0
- package/dist/input/input.d.ts.map +1 -0
- package/dist/input/input.js +138 -0
- package/dist/input/input.js.map +1 -0
- package/dist/internal/compose.d.ts +26 -0
- package/dist/internal/compose.d.ts.map +1 -0
- package/dist/internal/compose.js +32 -0
- package/dist/internal/compose.js.map +1 -0
- package/dist/list/list.d.ts +70 -0
- package/dist/list/list.d.ts.map +1 -0
- package/dist/list/list.js +144 -0
- package/dist/list/list.js.map +1 -0
- package/dist/menu/menu-core.d.ts +56 -0
- package/dist/menu/menu-core.d.ts.map +1 -0
- package/dist/menu/menu-core.js +122 -0
- package/dist/menu/menu-core.js.map +1 -0
- package/dist/menu/menu.d.ts +31 -0
- package/dist/menu/menu.d.ts.map +1 -0
- package/dist/menu/menu.js +68 -0
- package/dist/menu/menu.js.map +1 -0
- package/dist/menubar/menubar.d.ts +49 -0
- package/dist/menubar/menubar.d.ts.map +1 -0
- package/dist/menubar/menubar.js +162 -0
- package/dist/menubar/menubar.js.map +1 -0
- package/dist/paginator/paginator.d.ts +89 -0
- package/dist/paginator/paginator.d.ts.map +1 -0
- package/dist/paginator/paginator.js +159 -0
- package/dist/paginator/paginator.js.map +1 -0
- package/dist/popover-edit/popover-edit.d.ts +33 -0
- package/dist/popover-edit/popover-edit.d.ts.map +1 -0
- package/dist/popover-edit/popover-edit.js +107 -0
- package/dist/popover-edit/popover-edit.js.map +1 -0
- package/dist/progress-bar/progress-bar.d.ts +32 -0
- package/dist/progress-bar/progress-bar.d.ts.map +1 -0
- package/dist/progress-bar/progress-bar.js +42 -0
- package/dist/progress-bar/progress-bar.js.map +1 -0
- package/dist/progress-spinner/progress-spinner.d.ts +25 -0
- package/dist/progress-spinner/progress-spinner.d.ts.map +1 -0
- package/dist/progress-spinner/progress-spinner.js +25 -0
- package/dist/progress-spinner/progress-spinner.js.map +1 -0
- package/dist/radio/radio.d.ts +68 -0
- package/dist/radio/radio.d.ts.map +1 -0
- package/dist/radio/radio.js +81 -0
- package/dist/radio/radio.js.map +1 -0
- package/dist/ripple/ripple.d.ts +20 -0
- package/dist/ripple/ripple.d.ts.map +1 -0
- package/dist/ripple/ripple.js +41 -0
- package/dist/ripple/ripple.js.map +1 -0
- package/dist/select/select.d.ts +83 -0
- package/dist/select/select.d.ts.map +1 -0
- package/dist/select/select.js +320 -0
- package/dist/select/select.js.map +1 -0
- package/dist/shared/options.d.ts +44 -0
- package/dist/shared/options.d.ts.map +1 -0
- package/dist/shared/options.js +59 -0
- package/dist/shared/options.js.map +1 -0
- package/dist/shared/positions.d.ts +20 -0
- package/dist/shared/positions.d.ts.map +1 -0
- package/dist/shared/positions.js +27 -0
- package/dist/shared/positions.js.map +1 -0
- package/dist/sidenav/sidenav.d.ts +65 -0
- package/dist/sidenav/sidenav.d.ts.map +1 -0
- package/dist/sidenav/sidenav.js +120 -0
- package/dist/sidenav/sidenav.js.map +1 -0
- package/dist/slide-toggle/slide-toggle.d.ts +56 -0
- package/dist/slide-toggle/slide-toggle.d.ts.map +1 -0
- package/dist/slide-toggle/slide-toggle.js +62 -0
- package/dist/slide-toggle/slide-toggle.js.map +1 -0
- package/dist/slider/slider.d.ts +69 -0
- package/dist/slider/slider.d.ts.map +1 -0
- package/dist/slider/slider.js +184 -0
- package/dist/slider/slider.js.map +1 -0
- package/dist/snackbar/snackbar.d.ts +25 -0
- package/dist/snackbar/snackbar.d.ts.map +1 -0
- package/dist/snackbar/snackbar.js +135 -0
- package/dist/snackbar/snackbar.js.map +1 -0
- package/dist/stepper/stepper.d.ts +87 -0
- package/dist/stepper/stepper.d.ts.map +1 -0
- package/dist/stepper/stepper.js +142 -0
- package/dist/stepper/stepper.js.map +1 -0
- package/dist/table/table.d.ts +140 -0
- package/dist/table/table.d.ts.map +1 -0
- package/dist/table/table.js +312 -0
- package/dist/table/table.js.map +1 -0
- package/dist/tabs/tabs.d.ts +64 -0
- package/dist/tabs/tabs.d.ts.map +1 -0
- package/dist/tabs/tabs.js +126 -0
- package/dist/tabs/tabs.js.map +1 -0
- package/dist/timepicker/timepicker.d.ts +83 -0
- package/dist/timepicker/timepicker.d.ts.map +1 -0
- package/dist/timepicker/timepicker.js +303 -0
- package/dist/timepicker/timepicker.js.map +1 -0
- package/dist/toolbar/toolbar.d.ts +34 -0
- package/dist/toolbar/toolbar.d.ts.map +1 -0
- package/dist/toolbar/toolbar.js +35 -0
- package/dist/toolbar/toolbar.js.map +1 -0
- package/dist/tooltip/tooltip.d.ts +30 -0
- package/dist/tooltip/tooltip.d.ts.map +1 -0
- package/dist/tooltip/tooltip.js +109 -0
- package/dist/tooltip/tooltip.js.map +1 -0
- package/dist/tree/tree.d.ts +100 -0
- package/dist/tree/tree.d.ts.map +1 -0
- package/dist/tree/tree.js +288 -0
- package/dist/tree/tree.js.map +1 -0
- package/package.json +230 -0
- package/src/styles/_api.scss +384 -0
- package/src/styles/_helpers.scss +101 -0
- package/src/styles/_index.scss +12 -0
- package/src/styles/_ref.scss +20 -0
- package/src/styles/_sass-utils.scss +14 -0
- package/src/styles/_token-utils.scss +24 -0
- package/src/styles/components/autocomplete/_index.scss +10 -0
- package/src/styles/components/autocomplete/_styles.scss +46 -0
- package/src/styles/components/autocomplete/_tokens.scss +28 -0
- package/src/styles/components/badge/_index.scss +12 -0
- package/src/styles/components/badge/_styles.scss +72 -0
- package/src/styles/components/badge/_tokens.scss +27 -0
- package/src/styles/components/bottom-sheet/_index.scss +9 -0
- package/src/styles/components/bottom-sheet/_styles.scss +77 -0
- package/src/styles/components/bottom-sheet/_tokens.scss +33 -0
- package/src/styles/components/button/_index.scss +12 -0
- package/src/styles/components/button/_styles.scss +106 -0
- package/src/styles/components/button/_tokens.scss +36 -0
- package/src/styles/components/button-toggle/_index.scss +12 -0
- package/src/styles/components/button-toggle/_styles.scss +57 -0
- package/src/styles/components/button-toggle/_tokens.scss +25 -0
- package/src/styles/components/card/_index.scss +15 -0
- package/src/styles/components/card/_styles.scss +68 -0
- package/src/styles/components/card/_tokens.scss +26 -0
- package/src/styles/components/checkbox/_index.scss +13 -0
- package/src/styles/components/checkbox/_styles.scss +108 -0
- package/src/styles/components/checkbox/_tokens.scss +25 -0
- package/src/styles/components/chips/_index.scss +12 -0
- package/src/styles/components/chips/_styles.scss +83 -0
- package/src/styles/components/chips/_tokens.scss +28 -0
- package/src/styles/components/datepicker/_index.scss +10 -0
- package/src/styles/components/datepicker/_styles.scss +203 -0
- package/src/styles/components/datepicker/_tokens.scss +50 -0
- package/src/styles/components/dialog/_index.scss +9 -0
- package/src/styles/components/dialog/_styles.scss +54 -0
- package/src/styles/components/dialog/_tokens.scss +29 -0
- package/src/styles/components/divider/_index.scss +8 -0
- package/src/styles/components/divider/_styles.scss +18 -0
- package/src/styles/components/divider/_tokens.scss +12 -0
- package/src/styles/components/expansion/_index.scss +14 -0
- package/src/styles/components/expansion/_styles.scss +128 -0
- package/src/styles/components/expansion/_tokens.scss +32 -0
- package/src/styles/components/form-field/_index.scss +13 -0
- package/src/styles/components/form-field/_styles.scss +39 -0
- package/src/styles/components/form-field/_tokens.scss +19 -0
- package/src/styles/components/grid-list/_index.scss +12 -0
- package/src/styles/components/grid-list/_styles.scss +31 -0
- package/src/styles/components/grid-list/_tokens.scss +18 -0
- package/src/styles/components/icon/_index.scss +8 -0
- package/src/styles/components/icon/_styles.scss +18 -0
- package/src/styles/components/icon/_tokens.scss +8 -0
- package/src/styles/components/input/_index.scss +13 -0
- package/src/styles/components/input/_styles.scss +111 -0
- package/src/styles/components/input/_tokens.scss +21 -0
- package/src/styles/components/list/_index.scss +12 -0
- package/src/styles/components/list/_styles.scss +87 -0
- package/src/styles/components/list/_tokens.scss +31 -0
- package/src/styles/components/menu/_index.scss +9 -0
- package/src/styles/components/menu/_styles.scss +60 -0
- package/src/styles/components/menu/_tokens.scss +33 -0
- package/src/styles/components/menubar/_index.scss +9 -0
- package/src/styles/components/menubar/_styles.scss +41 -0
- package/src/styles/components/menubar/_tokens.scss +25 -0
- package/src/styles/components/overlay/_index.scss +8 -0
- package/src/styles/components/overlay/_styles.scss +25 -0
- package/src/styles/components/overlay/_tokens.scss +21 -0
- package/src/styles/components/paginator/_index.scss +14 -0
- package/src/styles/components/paginator/_styles.scss +77 -0
- package/src/styles/components/paginator/_tokens.scss +28 -0
- package/src/styles/components/popover-edit/_index.scss +9 -0
- package/src/styles/components/popover-edit/_styles.scss +31 -0
- package/src/styles/components/popover-edit/_tokens.scss +21 -0
- package/src/styles/components/progress-bar/_index.scss +11 -0
- package/src/styles/components/progress-bar/_styles.scss +39 -0
- package/src/styles/components/progress-bar/_tokens.scss +17 -0
- package/src/styles/components/progress-spinner/_index.scss +11 -0
- package/src/styles/components/progress-spinner/_styles.scss +26 -0
- package/src/styles/components/progress-spinner/_tokens.scss +15 -0
- package/src/styles/components/radio/_index.scss +14 -0
- package/src/styles/components/radio/_styles.scss +92 -0
- package/src/styles/components/radio/_tokens.scss +24 -0
- package/src/styles/components/ripple/_index.scss +8 -0
- package/src/styles/components/ripple/_styles.scss +20 -0
- package/src/styles/components/ripple/_tokens.scss +12 -0
- package/src/styles/components/select/_index.scss +9 -0
- package/src/styles/components/select/_styles.scss +120 -0
- package/src/styles/components/select/_tokens.scss +35 -0
- package/src/styles/components/sidenav/_index.scss +14 -0
- package/src/styles/components/sidenav/_styles.scss +105 -0
- package/src/styles/components/sidenav/_tokens.scss +24 -0
- package/src/styles/components/slide-toggle/_index.scss +13 -0
- package/src/styles/components/slide-toggle/_styles.scss +86 -0
- package/src/styles/components/slide-toggle/_tokens.scss +24 -0
- package/src/styles/components/slider/_index.scss +13 -0
- package/src/styles/components/slider/_styles.scss +77 -0
- package/src/styles/components/slider/_tokens.scss +21 -0
- package/src/styles/components/snackbar/_index.scss +8 -0
- package/src/styles/components/snackbar/_styles.scss +59 -0
- package/src/styles/components/snackbar/_tokens.scss +28 -0
- package/src/styles/components/stepper/_index.scss +14 -0
- package/src/styles/components/stepper/_styles.scss +129 -0
- package/src/styles/components/stepper/_tokens.scss +44 -0
- package/src/styles/components/table/_index.scss +14 -0
- package/src/styles/components/table/_styles.scss +202 -0
- package/src/styles/components/table/_tokens.scss +47 -0
- package/src/styles/components/tabs/_index.scss +13 -0
- package/src/styles/components/tabs/_styles.scss +76 -0
- package/src/styles/components/tabs/_tokens.scss +28 -0
- package/src/styles/components/timepicker/_index.scss +9 -0
- package/src/styles/components/timepicker/_styles.scss +136 -0
- package/src/styles/components/timepicker/_tokens.scss +46 -0
- package/src/styles/components/toolbar/_index.scss +12 -0
- package/src/styles/components/toolbar/_styles.scss +41 -0
- package/src/styles/components/toolbar/_tokens.scss +17 -0
- package/src/styles/components/tooltip/_index.scss +8 -0
- package/src/styles/components/tooltip/_styles.scss +29 -0
- package/src/styles/components/tooltip/_tokens.scss +22 -0
- package/src/styles/components/tree/_index.scss +13 -0
- package/src/styles/components/tree/_styles.scss +99 -0
- package/src/styles/components/tree/_tokens.scss +38 -0
- package/src/styles/theme/_defaults.scss +50 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<Icon>` — renders an inline SVG from the active icon registry (or a directly
|
|
3
|
+
* supplied `svg` / `src`). Weave: 18px, 1.4 hairline stroke, `currentColor` (so an
|
|
4
|
+
* icon takes its parent's text color). Lean DOM — a single host `<span>` whose
|
|
5
|
+
* innerHTML is the SVG (Weave has no `{@html}`, so we set it via a ref + effect).
|
|
6
|
+
*
|
|
7
|
+
* Accessibility: pass `label` for a meaningful icon (`role="img"` + `aria-label`);
|
|
8
|
+
* with no label the icon is decorative (`aria-hidden`), the WAI-ARIA default.
|
|
9
|
+
*
|
|
10
|
+
* Reactive: changing `name` (or the registry's async cache) re-renders in place.
|
|
11
|
+
*
|
|
12
|
+
* import Icon, { configureIcons } from '@weave-framework/ui/icon';
|
|
13
|
+
* <Icon name={{ 'search' }} />
|
|
14
|
+
* <Icon name={{ 'trash-2' }} label={{ 'Delete' }} />
|
|
15
|
+
*/
|
|
16
|
+
import { signal, effect } from '@weave-framework/runtime';
|
|
17
|
+
import { activeIcons } from './icons.js';
|
|
18
|
+
// Re-export the registry surface so `@weave-framework/ui/icon` is the one import.
|
|
19
|
+
export { configureIcons, createIconRegistry, activeIcons, inlineIcons, spriteIcons, IconContext, } from './icons.js';
|
|
20
|
+
const FORBIDDEN_SVG_TAGS = new Set(['script', 'foreignobject']);
|
|
21
|
+
/** Recursively strip active content: `on*` handlers, `javascript:` URLs, forbidden elements. */
|
|
22
|
+
function scrubSvg(el) {
|
|
23
|
+
for (const attr of [...el.attributes]) {
|
|
24
|
+
const name = attr.name.toLowerCase();
|
|
25
|
+
if (name.startsWith('on')) {
|
|
26
|
+
el.removeAttribute(attr.name);
|
|
27
|
+
}
|
|
28
|
+
else if ((name === 'href' || name === 'xlink:href' || name === 'src') && /^\s*javascript:/i.test(attr.value)) {
|
|
29
|
+
el.removeAttribute(attr.name);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
for (const child of [...el.children]) {
|
|
33
|
+
if (FORBIDDEN_SVG_TAGS.has(child.tagName.toLowerCase()))
|
|
34
|
+
child.remove();
|
|
35
|
+
else
|
|
36
|
+
scrubSvg(child);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Sanitize an SVG string before it goes into `innerHTML` (zero-dep, native `DOMParser`). Parsed as
|
|
41
|
+
* `image/svg+xml`, so nothing executes during parsing; `<script>`/`<foreignObject>`, every `on*`
|
|
42
|
+
* event-handler attribute, and `javascript:` URLs are removed. Returns '' for non-SVG / malformed
|
|
43
|
+
* input. Guards the `svg`/`src` inputs (a `<svg onload=…>` would otherwise run on insertion).
|
|
44
|
+
*/
|
|
45
|
+
export function sanitizeSvg(markup) {
|
|
46
|
+
if (!markup)
|
|
47
|
+
return '';
|
|
48
|
+
const doc = new DOMParser().parseFromString(markup, 'image/svg+xml');
|
|
49
|
+
const root = doc.documentElement;
|
|
50
|
+
if (!root || root.nodeName.toLowerCase() === 'parsererror' || doc.querySelector('parsererror'))
|
|
51
|
+
return '';
|
|
52
|
+
scrubSvg(root);
|
|
53
|
+
return root.outerHTML;
|
|
54
|
+
}
|
|
55
|
+
export const template = `<span class="weave-icon" ref={{ host }}></span>`;
|
|
56
|
+
export function setup(props) {
|
|
57
|
+
const host = signal(null);
|
|
58
|
+
const registry = activeIcons();
|
|
59
|
+
// Render the SVG + apply a11y. Re-runs when `host`, `name`, `svg`, or the
|
|
60
|
+
// registry's async cache changes.
|
|
61
|
+
effect(() => {
|
|
62
|
+
const el = host();
|
|
63
|
+
if (!el)
|
|
64
|
+
return;
|
|
65
|
+
if (!props.src) {
|
|
66
|
+
const markup = props.svg ?? (props.name ? registry.resolve(props.name) : undefined);
|
|
67
|
+
el.innerHTML = sanitizeSvg(markup ?? '');
|
|
68
|
+
}
|
|
69
|
+
if (props.label) {
|
|
70
|
+
el.setAttribute('role', 'img');
|
|
71
|
+
el.setAttribute('aria-label', props.label);
|
|
72
|
+
el.removeAttribute('aria-hidden');
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
el.setAttribute('aria-hidden', 'true');
|
|
76
|
+
el.removeAttribute('role');
|
|
77
|
+
el.removeAttribute('aria-label');
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
// `src`: fetch a standalone SVG file, reactively (a new src cancels the last).
|
|
81
|
+
effect(() => {
|
|
82
|
+
const url = props.src;
|
|
83
|
+
const el = host();
|
|
84
|
+
if (!url || !el)
|
|
85
|
+
return;
|
|
86
|
+
let alive = true;
|
|
87
|
+
void fetch(url)
|
|
88
|
+
.then((r) => r.text())
|
|
89
|
+
.then((txt) => {
|
|
90
|
+
if (alive)
|
|
91
|
+
el.innerHTML = sanitizeSvg(txt); // remote SVG is untrusted — sanitize
|
|
92
|
+
});
|
|
93
|
+
return () => {
|
|
94
|
+
alive = false;
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
return { host };
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.js","sourceRoot":"","sources":["../../src/icon/icon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAe,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAqB,MAAM,YAAY,CAAC;AAE5D,kFAAkF;AAClF,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,GACZ,M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AAC,CAAC,CAAC;IAEH,+EAA+E;IAC/E,MAAM,CAAC,GAAG,EAAE;QACV,MAAM,GAAG,GAAuB,KAAK,CAAC,GAAG,CAAC;QAC1C,MAAM,EAAE,GAAuB,IAAI,EAAwB,CAAC;QAC5D,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE;YAAE,OAAO;QACxB,IAAI,KAAK,GAAY,IAAI,CAAC;QAC1B,KAAK,KAAK,CAAC,GAAG,CAAC;aACZ,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aACrB,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YACZ,IAAI,KAAK;gBAAE,EAAE,CAAC,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,qCAAqC;QACnF,CAAC,CAAC,CAAC;QACL,OAAO,GAAG,EAAE;YACV,KAAK,GAAG,KAAK,CAAC;QAChB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon registry — the signal-native, global+context source of SVG markup that the
|
|
3
|
+
* `<Icon>` component renders. Mirrors `@weave-framework/i18n`'s shape: one global
|
|
4
|
+
* instance backs the bare `<Icon>`, and `provide(IconContext, registry)` overrides
|
|
5
|
+
* it within a subtree.
|
|
6
|
+
*
|
|
7
|
+
* Sources are consulted in order; the first that yields an icon wins. Sync sources
|
|
8
|
+
* (the built-in set, an inline map) resolve instantly; async sources (an SVG sprite
|
|
9
|
+
* fetched over the network) fill a reactive cache, so a binding re-renders itself
|
|
10
|
+
* the moment the fetch lands — no reload, no streams. The built-in Lucide set is a
|
|
11
|
+
* batteries-included fallback, so `<Icon name="search" />` works with zero config.
|
|
12
|
+
*
|
|
13
|
+
* Zero third-party deps: `fetch` + `DOMParser` are native.
|
|
14
|
+
*/
|
|
15
|
+
import { type Context } from '@weave-framework/runtime';
|
|
16
|
+
/**
|
|
17
|
+
* Resolves an icon name to SVG markup — either a complete `<svg>…</svg>` or just the
|
|
18
|
+
* inner geometry (paths/circles), which the registry wraps in the standard Weave
|
|
19
|
+
* `<svg>`. Returns `undefined` if this source doesn't know the name; may be async.
|
|
20
|
+
*/
|
|
21
|
+
export type IconSource = (name: string) => string | undefined | Promise<string | undefined>;
|
|
22
|
+
export interface IconConfig {
|
|
23
|
+
/** Extra sources, consulted before the built-in set (first hit wins). */
|
|
24
|
+
sources?: IconSource[];
|
|
25
|
+
/** Append the built-in Lucide set as the last source. Default `true`. */
|
|
26
|
+
builtin?: boolean;
|
|
27
|
+
/** Register this instance as the global one backing the bare `<Icon>`. Default `true`. */
|
|
28
|
+
global?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface IconRegistry {
|
|
31
|
+
/** Resolve `name` to a full `<svg>` string, or `undefined` while pending / unknown. Reactive. */
|
|
32
|
+
resolve(name: string): string | undefined;
|
|
33
|
+
/** Imperatively register (or override) an icon by name — inner geometry or full `<svg>`. */
|
|
34
|
+
register(name: string, svg: string): void;
|
|
35
|
+
/** Whether `name` currently resolves. Reactive. */
|
|
36
|
+
has(name: string): boolean;
|
|
37
|
+
}
|
|
38
|
+
/** Context token: `provide(IconContext, registry)` to override the global within a subtree. */
|
|
39
|
+
export declare const IconContext: Context<IconRegistry | undefined>;
|
|
40
|
+
/** A source backed by an in-memory map of `name → svg` (full or inner markup). */
|
|
41
|
+
export declare function inlineIcons(map: Record<string, string>): IconSource;
|
|
42
|
+
/**
|
|
43
|
+
* A source backed by an SVG sprite fetched from `url` once and indexed by element
|
|
44
|
+
* `id` (`<symbol id>` / `<g id>` / `<svg id>`), using the native `DOMParser`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function spriteIcons(url: string): IconSource;
|
|
47
|
+
/** Create an icon registry. Prefer {@link configureIcons} unless you want a standalone one. */
|
|
48
|
+
export declare function createIconRegistry(config?: IconConfig): IconRegistry;
|
|
49
|
+
/**
|
|
50
|
+
* Configure icons for the app. Returns the registry; by default it becomes the
|
|
51
|
+
* global one backing every bare `<Icon>`. Pass `global: false` for a standalone
|
|
52
|
+
* registry you wire up via {@link IconContext}.
|
|
53
|
+
*/
|
|
54
|
+
export declare function configureIcons(config?: IconConfig): IconRegistry;
|
|
55
|
+
/**
|
|
56
|
+
* The active registry: a context-provided one wins, else the global, else a lazily
|
|
57
|
+
* created built-in-only default (so `<Icon>` works with zero configuration).
|
|
58
|
+
*/
|
|
59
|
+
export declare function activeIcons(): IconRegistry;
|
|
60
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/icon/icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAA8C,KAAK,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGpG;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAE5F,MAAM,WAAW,UAAU;IACzB,yEAAyE;IACzE,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,yEAAyE;IACzE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0FAA0F;IAC1F,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,iGAAiG;IACjG,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC1C,4FAA4F;IAC5F,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,mDAAmD;IACnD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,+FAA+F;AAC/F,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,YAAY,GAAG,SAAS,CAAsD,CAAC;AAmBjH,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,UAAU,CAEnE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAOnD;AAWD,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,MAAM,GAAE,UAAe,GAAG,YAAY,CAiDxE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,GAAE,UAAe,GAAG,YAAY,CAIpE;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,YAAY,CAG1C"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon registry — the signal-native, global+context source of SVG markup that the
|
|
3
|
+
* `<Icon>` component renders. Mirrors `@weave-framework/i18n`'s shape: one global
|
|
4
|
+
* instance backs the bare `<Icon>`, and `provide(IconContext, registry)` overrides
|
|
5
|
+
* it within a subtree.
|
|
6
|
+
*
|
|
7
|
+
* Sources are consulted in order; the first that yields an icon wins. Sync sources
|
|
8
|
+
* (the built-in set, an inline map) resolve instantly; async sources (an SVG sprite
|
|
9
|
+
* fetched over the network) fill a reactive cache, so a binding re-renders itself
|
|
10
|
+
* the moment the fetch lands — no reload, no streams. The built-in Lucide set is a
|
|
11
|
+
* batteries-included fallback, so `<Icon name="search" />` works with zero config.
|
|
12
|
+
*
|
|
13
|
+
* Zero third-party deps: `fetch` + `DOMParser` are native.
|
|
14
|
+
*/
|
|
15
|
+
import { signal, createContext, inject } from '@weave-framework/runtime';
|
|
16
|
+
import { lucideIcons } from './lucide-icons.js';
|
|
17
|
+
/** Context token: `provide(IconContext, registry)` to override the global within a subtree. */
|
|
18
|
+
export const IconContext = createContext(undefined);
|
|
19
|
+
let globalIcons;
|
|
20
|
+
/** Normalize a source's output to a full `<svg>` string (wrapping bare inner geometry). */
|
|
21
|
+
function normalize(markup) {
|
|
22
|
+
const svg = markup.trim();
|
|
23
|
+
if (svg.slice(0, 4).toLowerCase() === '<svg')
|
|
24
|
+
return svg;
|
|
25
|
+
return ('<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" ' +
|
|
26
|
+
'stroke-linecap="round" stroke-linejoin="round">' +
|
|
27
|
+
svg +
|
|
28
|
+
'</svg>');
|
|
29
|
+
}
|
|
30
|
+
/** The built-in Lucide set, as a source (inner geometry → wrapped by `normalize`). */
|
|
31
|
+
const builtinSource = (name) => lucideIcons[name];
|
|
32
|
+
/** A source backed by an in-memory map of `name → svg` (full or inner markup). */
|
|
33
|
+
export function inlineIcons(map) {
|
|
34
|
+
return (name) => map[name];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A source backed by an SVG sprite fetched from `url` once and indexed by element
|
|
38
|
+
* `id` (`<symbol id>` / `<g id>` / `<svg id>`), using the native `DOMParser`.
|
|
39
|
+
*/
|
|
40
|
+
export function spriteIcons(url) {
|
|
41
|
+
let index;
|
|
42
|
+
const load = () => (index ??= fetch(url)
|
|
43
|
+
.then((r) => r.text())
|
|
44
|
+
.then(parseSprite));
|
|
45
|
+
return async (name) => (await load())[name];
|
|
46
|
+
}
|
|
47
|
+
function parseSprite(text) {
|
|
48
|
+
const doc = new DOMParser().parseFromString(text, 'image/svg+xml');
|
|
49
|
+
const out = {};
|
|
50
|
+
doc.querySelectorAll('[id]').forEach((el) => {
|
|
51
|
+
out[el.id] = el.innerHTML;
|
|
52
|
+
});
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
/** Create an icon registry. Prefer {@link configureIcons} unless you want a standalone one. */
|
|
56
|
+
export function createIconRegistry(config = {}) {
|
|
57
|
+
const sources = [...(config.sources ?? [])];
|
|
58
|
+
if (config.builtin !== false)
|
|
59
|
+
sources.push(builtinSource);
|
|
60
|
+
// Async-loaded results (name → svg, or '' for a cached miss). Reactive: a fill re-renders bindings.
|
|
61
|
+
const cache = signal({});
|
|
62
|
+
// Imperative registrations win over every source.
|
|
63
|
+
const registered = {};
|
|
64
|
+
const loading = new Set();
|
|
65
|
+
function fill(name, svg) {
|
|
66
|
+
cache.set({ ...cache(), [name]: svg });
|
|
67
|
+
}
|
|
68
|
+
function ensureAsync(name) {
|
|
69
|
+
if (loading.has(name))
|
|
70
|
+
return;
|
|
71
|
+
loading.add(name);
|
|
72
|
+
void (async () => {
|
|
73
|
+
for (const src of sources) {
|
|
74
|
+
const r = await src(name);
|
|
75
|
+
if (r != null)
|
|
76
|
+
return fill(name, normalize(r));
|
|
77
|
+
}
|
|
78
|
+
fill(name, ''); // negative cache — don't retry a known miss
|
|
79
|
+
})();
|
|
80
|
+
}
|
|
81
|
+
function resolve(name) {
|
|
82
|
+
if (registered[name] !== undefined)
|
|
83
|
+
return registered[name];
|
|
84
|
+
const cached = cache()[name]; // tracked — async fills re-render
|
|
85
|
+
if (cached !== undefined)
|
|
86
|
+
return cached || undefined;
|
|
87
|
+
// Fast path: return the first sync source hit without touching the signal.
|
|
88
|
+
for (const src of sources) {
|
|
89
|
+
const r = src(name);
|
|
90
|
+
if (typeof r === 'string')
|
|
91
|
+
return normalize(r);
|
|
92
|
+
if (r != null && typeof r.then === 'function') {
|
|
93
|
+
ensureAsync(name); // an async source owns this name — load it, then re-render
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return undefined; // unknown across all sync sources
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
resolve,
|
|
101
|
+
register: (name, svg) => {
|
|
102
|
+
registered[name] = normalize(svg);
|
|
103
|
+
},
|
|
104
|
+
has: (name) => resolve(name) !== undefined,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Configure icons for the app. Returns the registry; by default it becomes the
|
|
109
|
+
* global one backing every bare `<Icon>`. Pass `global: false` for a standalone
|
|
110
|
+
* registry you wire up via {@link IconContext}.
|
|
111
|
+
*/
|
|
112
|
+
export function configureIcons(config = {}) {
|
|
113
|
+
const registry = createIconRegistry(config);
|
|
114
|
+
if (config.global !== false)
|
|
115
|
+
globalIcons = registry;
|
|
116
|
+
return registry;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The active registry: a context-provided one wins, else the global, else a lazily
|
|
120
|
+
* created built-in-only default (so `<Icon>` works with zero configuration).
|
|
121
|
+
*/
|
|
122
|
+
export function activeIcons() {
|
|
123
|
+
const ctx = inject(IconContext);
|
|
124
|
+
return ctx ?? globalIcons ?? (globalIcons = createIconRegistry());
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/icon/icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAA6B,MAAM,0BAA0B,CAAC;AACpG,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA2BhD,+FAA+F;AAC/F,MAAM,CAAC,MAAM,WAAW,GAAsC,aAAa,CAA2B,SAAS,CAAC,CAAC;AAEjH,IAAI,WAAqC,CAAC;AAE1C,2FAA2F;AAC3F,SAAS,SAAS,CAAC,MAAc;IAC/B,MAAM,GAAG,GAAW,MAAM,CAAC,IAAI,EAAE,CAAC;IAClC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM;QAAE,OAAO,GAAG,CAAC;IACzD,OAAO,CACL,6DAA6D;QAC7D,iDAAiD;QACjD,GAAG;QACH,QAAQ,CACT,CAAC;AACJ,CAAC;AAED,sFAAsF;AACtF,MAAM,aAAa,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAE9D,kFAAkF;AAClF,MAAM,UAAU,WAAW,CAAC,GAA2B;IACrD,OAAO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KAAK,UAAU,EAAE,CAAC;gBACxE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,2DAA2D;gBAC9E,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC,CAAC,kCAAkC;IACtD,CAAC;IAED,OAAO;QACL,OAAO;QACP,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACtB,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QACpC,CAAC;QACD,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,SAAS;KAC3C,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,SAAqB,EAAE;IACpD,MAAM,QAAQ,GAAiB,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1D,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK;QAAE,WAAW,GAAG,QAAQ,CAAC;IACpD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW;IACzB,MAAM,GAAG,GAA6B,MAAM,CAAC,WAAW,CAAC,CAAC;IAC1D,OAAO,GAAG,IAAI,WAAW,IAAI,CAAC,WAAW,GAAG,kBAAkB,EAAE,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in icon set for @weave-framework/ui — a curated subset of Lucide
|
|
3
|
+
* (https://lucide.dev), ISC-licensed. Copyright (c) Lucide Contributors.
|
|
4
|
+
*
|
|
5
|
+
* Inner SVG markup only; the Icon component wraps it in an <svg viewBox="0 0 24 24"
|
|
6
|
+
* fill="none" stroke="currentColor" stroke-width="var(--weave-icon-stroke)" …>. This
|
|
7
|
+
* is the default "weave" set our components rely on; apps replace/extend it via
|
|
8
|
+
* configureIcons(). Regenerate with: node tools/gen-lucide-icons.mjs
|
|
9
|
+
*/
|
|
10
|
+
export declare const lucideIcons: Record<string, string>;
|
|
11
|
+
//# sourceMappingURL=lucide-icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lucide-icons.d.ts","sourceRoot":"","sources":["../../src/icon/lucide-icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAsD9C,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in icon set for @weave-framework/ui — a curated subset of Lucide
|
|
3
|
+
* (https://lucide.dev), ISC-licensed. Copyright (c) Lucide Contributors.
|
|
4
|
+
*
|
|
5
|
+
* Inner SVG markup only; the Icon component wraps it in an <svg viewBox="0 0 24 24"
|
|
6
|
+
* fill="none" stroke="currentColor" stroke-width="var(--weave-icon-stroke)" …>. This
|
|
7
|
+
* is the default "weave" set our components rely on; apps replace/extend it via
|
|
8
|
+
* configureIcons(). Regenerate with: node tools/gen-lucide-icons.mjs
|
|
9
|
+
*/
|
|
10
|
+
export const lucideIcons = {
|
|
11
|
+
'arrow-up': "<path d=\"m5 12 7-7 7 7\" /><path d=\"M12 19V5\" />",
|
|
12
|
+
'arrow-down': "<path d=\"M12 5v14\" /><path d=\"m19 12-7 7-7-7\" />",
|
|
13
|
+
'arrow-left': "<path d=\"m12 19-7-7 7-7\" /><path d=\"M19 12H5\" />",
|
|
14
|
+
'arrow-right': "<path d=\"M5 12h14\" /><path d=\"m12 5 7 7-7 7\" />",
|
|
15
|
+
'chevron-up': "<path d=\"m18 15-6-6-6 6\" />",
|
|
16
|
+
'chevron-down': "<path d=\"m6 9 6 6 6-6\" />",
|
|
17
|
+
'chevron-left': "<path d=\"m15 18-6-6 6-6\" />",
|
|
18
|
+
'chevron-right': "<path d=\"m9 18 6-6-6-6\" />",
|
|
19
|
+
'chevrons-left': "<path d=\"m11 17-5-5 5-5\" /><path d=\"m18 17-5-5 5-5\" />",
|
|
20
|
+
'chevrons-right': "<path d=\"m6 17 5-5-5-5\" /><path d=\"m13 17 5-5-5-5\" />",
|
|
21
|
+
'chevrons-up-down': "<path d=\"m7 15 5 5 5-5\" /><path d=\"m7 9 5-5 5 5\" />",
|
|
22
|
+
'house': "<path d=\"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8\" /><path d=\"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\" />",
|
|
23
|
+
'menu': "<path d=\"M4 5h16\" /><path d=\"M4 12h16\" /><path d=\"M4 19h16\" />",
|
|
24
|
+
'search': "<path d=\"m21 21-4.34-4.34\" /><circle cx=\"11\" cy=\"11\" r=\"8\" />",
|
|
25
|
+
'settings': "<path d=\"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915\" /><circle cx=\"12\" cy=\"12\" r=\"3\" />",
|
|
26
|
+
'ellipsis': "<circle cx=\"12\" cy=\"12\" r=\"1\" /><circle cx=\"19\" cy=\"12\" r=\"1\" /><circle cx=\"5\" cy=\"12\" r=\"1\" />",
|
|
27
|
+
'ellipsis-vertical': "<circle cx=\"12\" cy=\"12\" r=\"1\" /><circle cx=\"12\" cy=\"5\" r=\"1\" /><circle cx=\"12\" cy=\"19\" r=\"1\" />",
|
|
28
|
+
'x': "<path d=\"M18 6 6 18\" /><path d=\"m6 6 12 12\" />",
|
|
29
|
+
'check': "<path d=\"M20 6 9 17l-5-5\" />",
|
|
30
|
+
'plus': "<path d=\"M5 12h14\" /><path d=\"M12 5v14\" />",
|
|
31
|
+
'minus': "<path d=\"M5 12h14\" />",
|
|
32
|
+
'user': "<path d=\"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\" /><circle cx=\"12\" cy=\"7\" r=\"4\" />",
|
|
33
|
+
'mail': "<path d=\"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7\" /><rect x=\"2\" y=\"4\" width=\"20\" height=\"16\" rx=\"2\" />",
|
|
34
|
+
'bell': "<path d=\"M10.268 21a2 2 0 0 0 3.464 0\" /><path d=\"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326\" />",
|
|
35
|
+
'message-circle': "<path d=\"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719\" />",
|
|
36
|
+
'share-2': "<circle cx=\"18\" cy=\"5\" r=\"3\" /><circle cx=\"6\" cy=\"12\" r=\"3\" /><circle cx=\"18\" cy=\"19\" r=\"3\" /><line x1=\"8.59\" x2=\"15.42\" y1=\"13.51\" y2=\"17.49\" /><line x1=\"15.41\" x2=\"8.59\" y1=\"6.51\" y2=\"10.49\" />",
|
|
37
|
+
'shopping-cart': "<circle cx=\"8\" cy=\"21\" r=\"1\" /><circle cx=\"19\" cy=\"21\" r=\"1\" /><path d=\"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12\" />",
|
|
38
|
+
'heart': "<path d=\"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5\" />",
|
|
39
|
+
'star': "<path d=\"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z\" />",
|
|
40
|
+
'trash-2': "<path d=\"M10 11v6\" /><path d=\"M14 11v6\" /><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\" /><path d=\"M3 6h18\" /><path d=\"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\" />",
|
|
41
|
+
'pencil': "<path d=\"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\" /><path d=\"m15 5 4 4\" />",
|
|
42
|
+
'paperclip': "<path d=\"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551\" />",
|
|
43
|
+
'cloud-upload': "<path d=\"M12 13v8\" /><path d=\"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242\" /><path d=\"m8 17 4-4 4 4\" />",
|
|
44
|
+
'cloud-download': "<path d=\"M12 13v8l-4-4\" /><path d=\"m12 21 4-4\" /><path d=\"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284\" />",
|
|
45
|
+
'eye': "<path d=\"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\" /><circle cx=\"12\" cy=\"12\" r=\"3\" />",
|
|
46
|
+
'eye-off': "<path d=\"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49\" /><path d=\"M14.084 14.158a3 3 0 0 1-4.242-4.242\" /><path d=\"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143\" /><path d=\"m2 2 20 20\" />",
|
|
47
|
+
'lock': "<rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\" /><path d=\"M7 11V7a5 5 0 0 1 10 0v4\" />",
|
|
48
|
+
'lock-open': "<rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\" /><path d=\"M7 11V7a5 5 0 0 1 9.9-1\" />",
|
|
49
|
+
'info': "<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"M12 16v-4\" /><path d=\"M12 8h.01\" />",
|
|
50
|
+
'circle-check': "<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"m9 12 2 2 4-4\" />",
|
|
51
|
+
'circle-alert': "<circle cx=\"12\" cy=\"12\" r=\"10\" /><line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" /><line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" />",
|
|
52
|
+
'circle-x': "<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"m15 9-6 6\" /><path d=\"m9 9 6 6\" />",
|
|
53
|
+
'triangle-alert': "<path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" /><path d=\"M12 9v4\" /><path d=\"M12 17h.01\" />",
|
|
54
|
+
'truck': "<path d=\"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2\" /><path d=\"M15 18H9\" /><path d=\"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14\" /><circle cx=\"17\" cy=\"18\" r=\"2\" /><circle cx=\"7\" cy=\"18\" r=\"2\" />",
|
|
55
|
+
'calendar': "<path d=\"M8 2v4\" /><path d=\"M16 2v4\" /><rect width=\"18\" height=\"18\" x=\"3\" y=\"4\" rx=\"2\" /><path d=\"M3 10h18\" />",
|
|
56
|
+
'clock': "<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"M12 6v6l4 2\" />",
|
|
57
|
+
'sun': "<circle cx=\"12\" cy=\"12\" r=\"4\" /><path d=\"M12 2v2\" /><path d=\"M12 20v2\" /><path d=\"m4.93 4.93 1.41 1.41\" /><path d=\"m17.66 17.66 1.41 1.41\" /><path d=\"M2 12h2\" /><path d=\"M20 12h2\" /><path d=\"m6.34 17.66-1.41 1.41\" /><path d=\"m19.07 4.93-1.41 1.41\" />",
|
|
58
|
+
'moon': "<path d=\"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401\" />",
|
|
59
|
+
'git-branch': "<path d=\"M15 6a9 9 0 0 0-9 9V3\" /><circle cx=\"18\" cy=\"6\" r=\"3\" /><circle cx=\"6\" cy=\"18\" r=\"3\" />",
|
|
60
|
+
'copy': "<rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" /><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />",
|
|
61
|
+
'graduation-cap': "<path d=\"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z\" /><path d=\"M22 10v6\" /><path d=\"M6 12.5V16a6 3 0 0 0 12 0v-3.5\" />",
|
|
62
|
+
'book-open': "<path d=\"M12 7v14\" /><path d=\"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z\" />",
|
|
63
|
+
'package': "<path d=\"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z\" /><path d=\"M12 22V12\" /><polyline points=\"3.29 7 12 12 20.71 7\" /><path d=\"m7.5 4.27 9 5.15\" />",
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=lucide-icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lucide-icons.js","sourceRoot":"","sources":["../../src/icon/lucide-icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,WAAW,GAA2B;IACjD,UAAU,EAAE,qDAAqD;IACjE,YAAY,EAAE,sDAAsD;IACpE,YAAY,EAAE,sDAAsD;IACpE,aAAa,EAAE,qDAAqD;IACpE,YAAY,EAAE,+BAA+B;IAC7C,cAAc,EAAE,6BAA6B;IAC7C,cAAc,EAAE,+BAA+B;IAC/C,eAAe,EAAE,8BAA8B;IAC/C,eAAe,EAAE,4DAA4D;IAC7E,gBAAgB,EAAE,2DAA2D;IAC7E,kBAAkB,EAAE,yDAAyD;IAC7E,OAAO,EAAE,+KAA+K;IACxL,MAAM,EAAE,sEAAsE;IAC9E,QAAQ,EAAE,uEAAuE;IACjF,UAAU,EAAE,8XAA8X;IAC1Y,UAAU,EAAE,mHAAmH;IAC/H,mBAAmB,EAAE,mHAAmH;IACxI,GAAG,EAAE,oDAAoD;IACzD,OAAO,EAAE,gCAAgC;IACzC,MAAM,EAAE,gDAAgD;IACxD,OAAO,EAAE,yBAAyB;IAClC,MAAM,EAAE,+FAA+F;IACvG,MAAM,EAAE,oHAAoH;IAC5H,MAAM,EAAE,yLAAyL;IACjM,gBAAgB,EAAE,4IAA4I;IAC9J,SAAS,EAAE,uOAAuO;IAClP,eAAe,EAAE,4KAA4K;IAC7L,OAAO,EAAE,sKAAsK;IAC/K,MAAM,EAAE,6XAA6X;IACrY,SAAS,EAAE,kLAAkL;IAC7L,QAAQ,EAAE,yKAAyK;IACnL,WAAW,EAAE,yIAAyI;IACtJ,cAAc,EAAE,4HAA4H;IAC5I,gBAAgB,EAAE,oIAAoI;IACtJ,KAAK,EAAE,4JAA4J;IACnK,SAAS,EAAE,sSAAsS;IACjT,MAAM,EAAE,+GAA+G;IACvH,WAAW,EAAE,8GAA8G;IAC3H,MAAM,EAAE,yFAAyF;IACjG,cAAc,EAAE,qEAAqE;IACrF,cAAc,EAAE,2IAA2I;IAC3J,UAAU,EAAE,wFAAwF;IACpG,gBAAgB,EAAE,wIAAwI;IAC1J,OAAO,EAAE,0QAA0Q;IACnR,UAAU,EAAE,gIAAgI;IAC5I,OAAO,EAAE,mEAAmE;IAC5E,KAAK,EAAE,kRAAkR;IACzR,MAAM,EAAE,+HAA+H;IACvI,YAAY,EAAE,gHAAgH;IAC9H,MAAM,EAAE,6IAA6I;IACrJ,gBAAgB,EAAE,2MAA2M;IAC7N,WAAW,EAAE,0KAA0K;IACvL,SAAS,EAAE,4OAA4O;CACxP,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @weave-framework/ui — Weave UI component library (Weave design system).
|
|
3
|
+
*
|
|
4
|
+
* The SCSS token engine + styles live under `src/styles` and per-component `.scss`
|
|
5
|
+
* (consumed via `@use '@weave-framework/ui'`). JS component behaviors are exported
|
|
6
|
+
* from their subpaths (e.g. `@weave-framework/ui/ripple`) as they land.
|
|
7
|
+
*
|
|
8
|
+
* U0 (foundations) ships the token engine + Divider/Icon/Ripple. This barrel will
|
|
9
|
+
* re-export the JS component behaviors as U2+ adds them.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<Input>` — a native `<input>` (or `<textarea>`) as a Weave **underline field**
|
|
3
|
+
* (`border-bottom: 1.5px line`, transparent, focus → accent). Batteries-included:
|
|
4
|
+
*
|
|
5
|
+
* - **Prefix / suffix** — named slots (`slot="prefix"` / `slot="suffix"`) that hold text
|
|
6
|
+
* or an icon, flanking the input *inside the underline* (they share the border). Empty
|
|
7
|
+
* slots collapse (hidden), so the field has no dead gaps.
|
|
8
|
+
* - **Clearable** — `clearable` shows a `×` button (when non-empty, editable) that empties
|
|
9
|
+
* the value and refocuses.
|
|
10
|
+
* - **Multiline** — `multiline` renders a `<textarea>` (with `rows`) instead of `<input>`.
|
|
11
|
+
* - **Binding** — the Weave form-control convention (string value): `value` (a getter) +
|
|
12
|
+
* `onInput`, OR `control` (a structural `Field<string>`). `control` wins; it drives the
|
|
13
|
+
* value two-way, marks `touched` on blur, and drives the error underline (`--invalid`)
|
|
14
|
+
* off `touched() && error()`.
|
|
15
|
+
* - Forwards `type` / `placeholder` / `disabled` / `readonly` / `required` / `name`.
|
|
16
|
+
*
|
|
17
|
+
* Compose with `<FormField>` for a label + hint/error line (which also wires `for`/`id`).
|
|
18
|
+
*
|
|
19
|
+
* import Input from '@weave-framework/ui/input';
|
|
20
|
+
* <Input control={{ form.controls.email }} type={{ 'email' }} placeholder={{ 'you@…' }} />
|
|
21
|
+
* <Input value={{ q() }} onInput={{ setQ }} clearable>
|
|
22
|
+
* <Icon slot="prefix" name={{ 'search' }} />
|
|
23
|
+
* </Input>
|
|
24
|
+
*/
|
|
25
|
+
import { type Signal } from '@weave-framework/runtime';
|
|
26
|
+
/** The subset of a `@weave-framework/forms` `Field<string>` an input binds to. */
|
|
27
|
+
export interface InputControl {
|
|
28
|
+
value: Signal<string>;
|
|
29
|
+
touched?: Signal<boolean>;
|
|
30
|
+
error?: () => string | null;
|
|
31
|
+
}
|
|
32
|
+
export interface InputProps {
|
|
33
|
+
/** Controlled value (a getter). Ignored when `control` is set. */
|
|
34
|
+
value?: string;
|
|
35
|
+
/** Called with the next value on every input. Ignored when `control` is set. */
|
|
36
|
+
onInput?: (value: string) => void;
|
|
37
|
+
/** A forms `Field<string>` — two-way value + touched-on-blur + error underline. */
|
|
38
|
+
control?: InputControl;
|
|
39
|
+
/** Native input type (text/email/password/number/search/…). Default 'text'. Ignored when `multiline`. */
|
|
40
|
+
type?: string;
|
|
41
|
+
/** Render a `<textarea>` instead of an `<input>`. */
|
|
42
|
+
multiline?: boolean;
|
|
43
|
+
/** Rows for the textarea. Default 3. */
|
|
44
|
+
rows?: number;
|
|
45
|
+
/** Placeholder text. */
|
|
46
|
+
placeholder?: string;
|
|
47
|
+
/** Disable the field. */
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
/** Make the field read-only. */
|
|
50
|
+
readonly?: boolean;
|
|
51
|
+
/** Mark the native input required. */
|
|
52
|
+
required?: boolean;
|
|
53
|
+
/** Native `name` (form submission). */
|
|
54
|
+
name?: string;
|
|
55
|
+
/** Accessible name (when not wrapped by a FormField label). */
|
|
56
|
+
label?: string;
|
|
57
|
+
/** Show a clear (`×`) button when the field is non-empty and editable. */
|
|
58
|
+
clearable?: boolean;
|
|
59
|
+
/** Accessible name for the clear button. Default 'Clear'. */
|
|
60
|
+
clearLabel?: string;
|
|
61
|
+
/** Called on mount with the native field — lets a composer (e.g. Autocomplete) add
|
|
62
|
+
* combobox ARIA / manage `aria-activedescendant` without re-creating the field. */
|
|
63
|
+
onInputRef?: (el: HTMLInputElement | HTMLTextAreaElement) => void;
|
|
64
|
+
/** Extra classes, forwarded onto the field wrapper. */
|
|
65
|
+
class?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare const template: string;
|
|
68
|
+
export interface InputContext {
|
|
69
|
+
root: Signal<HTMLElement | null>;
|
|
70
|
+
input: Signal<HTMLInputElement | HTMLTextAreaElement | null>;
|
|
71
|
+
rootClass: () => string;
|
|
72
|
+
multiline: () => boolean;
|
|
73
|
+
singleline: () => boolean;
|
|
74
|
+
type: () => string;
|
|
75
|
+
rows: () => number;
|
|
76
|
+
placeholder: () => string | undefined;
|
|
77
|
+
currentValue: () => string;
|
|
78
|
+
isDisabled: () => boolean;
|
|
79
|
+
isReadonly: () => boolean;
|
|
80
|
+
isRequired: () => boolean;
|
|
81
|
+
name: () => string | undefined;
|
|
82
|
+
label: () => string | undefined;
|
|
83
|
+
showClear: () => boolean;
|
|
84
|
+
clearLabel: () => string;
|
|
85
|
+
onNativeInput: (event: Event) => void;
|
|
86
|
+
onBlur: () => void;
|
|
87
|
+
clear: () => void;
|
|
88
|
+
}
|
|
89
|
+
export declare function setup(props: InputProps): InputContext;
|
|
90
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/input/input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAA2B,KAAK,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEhF,kFAAkF;AAClF,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1B,KAAK,CAAC,EAAE,MA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