@threadlabs/looma 0.1.22 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-HNFCGIBP.js +8 -0
- package/dist/{chunk-NIPNHZ5W.js → chunk-IMHSPETJ.js} +65 -31
- package/dist/chunk-NB6DBRXQ.js +323 -0
- package/dist/{chunk-SZJQ3NPX.js → chunk-TL4FIE7X.js} +4 -8
- package/dist/cjs/controlled-state-BFya8rAX.js +9 -0
- package/dist/cjs/icons-BAdjrnhS.js +680 -0
- package/dist/cjs/{index-D07f6BOw.js → index-BHG9Rpil.js} +33 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/looma.cjs.js +2 -2
- package/dist/cjs/{manager-C9j3HZay.js → manager-Ce25WRtl.js} +6 -7
- package/dist/cjs/ui-affordance-scope.cjs.entry.js +2 -2
- package/dist/cjs/ui-avatar-group.cjs.entry.js +10 -18
- package/dist/cjs/ui-avatar.cjs.entry.js +3 -3
- package/dist/cjs/ui-badge.cjs.entry.js +3 -3
- package/dist/cjs/ui-button.cjs.entry.js +16 -5
- package/dist/cjs/ui-callout.cjs.entry.js +27 -0
- package/dist/cjs/ui-checkbox.cjs.entry.js +14 -8
- package/dist/cjs/ui-chip.cjs.entry.js +19 -0
- package/dist/cjs/ui-combobox.cjs.entry.js +541 -0
- package/dist/cjs/ui-context-menu.cjs.entry.js +3 -3
- package/dist/cjs/ui-dialog.cjs.entry.js +46 -10
- package/dist/cjs/ui-disclosure.cjs.entry.js +10 -7
- package/dist/cjs/ui-floating-action-button.cjs.entry.js +2 -2
- package/dist/cjs/ui-form-field.cjs.entry.js +61 -6
- package/dist/cjs/ui-icon-button.cjs.entry.js +2 -2
- package/dist/cjs/ui-input.cjs.entry.js +11 -6
- package/dist/cjs/ui-menu-item.cjs.entry.js +3 -3
- package/dist/cjs/ui-menu.cjs.entry.js +16 -11
- package/dist/cjs/ui-popover.cjs.entry.js +12 -9
- package/dist/cjs/ui-radio-group.cjs.entry.js +2 -2
- package/dist/cjs/ui-radio.cjs.entry.js +18 -9
- package/dist/cjs/ui-search-result-row.cjs.entry.js +2 -2
- package/dist/cjs/ui-search-shell.cjs.entry.js +2 -2
- package/dist/cjs/ui-select.cjs.entry.js +15 -7
- package/dist/cjs/ui-switch.cjs.entry.js +20 -11
- package/dist/cjs/ui-tabs.cjs.entry.js +11 -10
- package/dist/cjs/ui-textarea.cjs.entry.js +10 -6
- package/dist/cjs/ui-toast-region.cjs.entry.js +31 -20
- package/dist/cjs/ui-tooltip.cjs.entry.js +63 -23
- package/dist/cjs/ui-top-bar.cjs.entry.js +2 -2
- package/dist/cjs/ui-tree-item.cjs.entry.js +57 -616
- package/dist/cjs/ui-tree.cjs.entry.js +198 -14
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/ui-affordance-scope/ui-affordance-scope.js +1 -1
- package/dist/collection/components/ui-avatar/ui-avatar.css +4 -4
- package/dist/collection/components/ui-avatar/ui-avatar.js +1 -1
- package/dist/collection/components/ui-avatar-group/ui-avatar-group.css +2 -2
- package/dist/collection/components/ui-avatar-group/ui-avatar-group.js +8 -16
- package/dist/collection/components/ui-badge/ui-badge.css +64 -48
- package/dist/collection/components/ui-badge/ui-badge.js +1 -1
- package/dist/collection/components/ui-button/ui-button.css +36 -26
- package/dist/collection/components/ui-button/ui-button.js +14 -3
- package/dist/collection/components/ui-callout/ui-callout.css +74 -0
- package/dist/collection/components/ui-callout/ui-callout.js +59 -0
- package/dist/collection/components/ui-checkbox/ui-checkbox.js +16 -11
- package/dist/collection/components/ui-chip/ui-chip.css +43 -0
- package/dist/collection/components/ui-chip/ui-chip.js +45 -0
- package/dist/collection/components/ui-combobox/ui-combobox.css +24 -0
- package/dist/collection/components/ui-combobox/ui-combobox.js +973 -0
- package/dist/collection/components/ui-context-menu/ui-context-menu.js +1 -1
- package/dist/collection/components/ui-dialog/ui-dialog.js +49 -13
- package/dist/collection/components/ui-disclosure/ui-disclosure.js +12 -10
- package/dist/collection/components/ui-floating-action-button/ui-floating-action-button.js +1 -1
- package/dist/collection/components/ui-form-field/ui-form-field.css +4 -0
- package/dist/collection/components/ui-form-field/ui-form-field.js +59 -4
- package/dist/collection/components/ui-icon-button/ui-icon-button.js +1 -1
- package/dist/collection/components/ui-input/ui-input.css +8 -6
- package/dist/collection/components/ui-input/ui-input.js +11 -7
- package/dist/collection/components/ui-menu/ui-menu.css +12 -23
- package/dist/collection/components/ui-menu/ui-menu.js +16 -12
- package/dist/collection/components/ui-menu-item/ui-menu-item.css +9 -3
- package/dist/collection/components/ui-menu-item/ui-menu-item.js +1 -1
- package/dist/collection/components/ui-popover/ui-popover.css +14 -5
- package/dist/collection/components/ui-popover/ui-popover.js +12 -10
- package/dist/collection/components/ui-radio/ui-radio.js +25 -12
- package/dist/collection/components/ui-radio-group/ui-radio-group.js +1 -1
- package/dist/collection/components/ui-search-result-row/ui-search-result-row.js +1 -1
- package/dist/collection/components/ui-search-shell/ui-search-shell.js +1 -1
- package/dist/collection/components/ui-select/ui-select.css +8 -6
- package/dist/collection/components/ui-select/ui-select.js +17 -11
- package/dist/collection/components/ui-switch/ui-switch.js +22 -14
- package/dist/collection/components/ui-tabs/ui-tabs.js +13 -13
- package/dist/collection/components/ui-textarea/ui-textarea.css +7 -6
- package/dist/collection/components/ui-textarea/ui-textarea.js +10 -7
- package/dist/collection/components/ui-toast-region/ui-toast-region.js +30 -19
- package/dist/collection/components/ui-tooltip/ui-tooltip.css +16 -7
- package/dist/collection/components/ui-tooltip/ui-tooltip.js +115 -25
- package/dist/collection/components/ui-top-bar/ui-top-bar.js +1 -1
- package/dist/collection/components/ui-tree/ui-tree.css +2 -1
- package/dist/collection/components/ui-tree/ui-tree.js +216 -12
- package/dist/collection/components/ui-tree-item/ui-tree-item.js +84 -25
- package/dist/collection/field/combobox.js +4 -0
- package/dist/collection/field/valibot.js +5 -0
- package/dist/collection/field/validation.js +62 -0
- package/dist/collection/icons.js +6 -1
- package/dist/collection/overlay/manager.js +6 -7
- package/dist/collection/utils/controlled-state.js +4 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-Bh_1GxOD.js +1 -0
- package/dist/components/p-Bk55QiUK.js +1 -0
- package/dist/components/p-BnGhGgTH.js +1 -0
- package/dist/components/p-C-0syqXZ.js +1 -0
- package/dist/components/p-CoFximGM.js +13 -0
- package/dist/components/p-DIGcRYAW.js +1 -0
- package/dist/components/ui-affordance-scope.js +1 -1
- package/dist/components/ui-avatar-group.js +1 -1
- package/dist/components/ui-avatar.js +1 -1
- package/dist/components/ui-badge.js +1 -1
- package/dist/components/ui-button.js +1 -1
- package/dist/components/ui-callout.d.ts +11 -0
- package/dist/components/ui-callout.js +1 -0
- package/dist/components/ui-checkbox.js +1 -1
- package/dist/components/ui-chip.d.ts +11 -0
- package/dist/components/ui-chip.js +1 -0
- package/dist/components/ui-combobox.d.ts +11 -0
- package/dist/components/ui-combobox.js +1 -0
- package/dist/components/ui-context-menu.js +1 -1
- package/dist/components/ui-dialog.js +1 -1
- package/dist/components/ui-disclosure.js +1 -1
- package/dist/components/ui-floating-action-button.js +1 -1
- package/dist/components/ui-form-field.js +1 -1
- package/dist/components/ui-icon-button.js +1 -1
- package/dist/components/ui-input.js +1 -1
- package/dist/components/ui-menu-item.js +1 -1
- package/dist/components/ui-menu.js +1 -1
- package/dist/components/ui-popover.js +1 -1
- package/dist/components/ui-radio-group.js +1 -1
- package/dist/components/ui-radio.js +1 -1
- package/dist/components/ui-search-result-row.js +1 -1
- package/dist/components/ui-search-shell.js +1 -1
- package/dist/components/ui-select.js +1 -1
- package/dist/components/ui-switch.js +1 -1
- package/dist/components/ui-tabs.js +1 -1
- package/dist/components/ui-textarea.js +1 -1
- package/dist/components/ui-toast-region.js +1 -1
- package/dist/components/ui-tooltip.js +1 -1
- package/dist/components/ui-top-bar.js +1 -1
- package/dist/components/ui-tree-item.js +1 -13
- package/dist/components/ui-tree.js +1 -1
- package/dist/esm/controlled-state-BnGhGgTH.js +6 -0
- package/dist/esm/icons-CoFximGM.js +678 -0
- package/dist/esm/{index-CEeiinfk.js → index-8BGiMGQ0.js} +33 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/looma.js +3 -3
- package/dist/esm/{manager-PM9a74r7.js → manager-C-0syqXZ.js} +6 -7
- package/dist/esm/ui-affordance-scope.entry.js +2 -2
- package/dist/esm/ui-avatar-group.entry.js +10 -18
- package/dist/esm/ui-avatar.entry.js +3 -3
- package/dist/esm/ui-badge.entry.js +3 -3
- package/dist/esm/ui-button.entry.js +16 -5
- package/dist/esm/ui-callout.entry.js +25 -0
- package/dist/esm/ui-checkbox.entry.js +14 -8
- package/dist/esm/ui-chip.entry.js +17 -0
- package/dist/esm/ui-combobox.entry.js +539 -0
- package/dist/esm/ui-context-menu.entry.js +3 -3
- package/dist/esm/ui-dialog.entry.js +46 -10
- package/dist/esm/ui-disclosure.entry.js +10 -7
- package/dist/esm/ui-floating-action-button.entry.js +2 -2
- package/dist/esm/ui-form-field.entry.js +61 -6
- package/dist/esm/ui-icon-button.entry.js +2 -2
- package/dist/esm/ui-input.entry.js +11 -6
- package/dist/esm/ui-menu-item.entry.js +3 -3
- package/dist/esm/ui-menu.entry.js +16 -11
- package/dist/esm/ui-popover.entry.js +12 -9
- package/dist/esm/ui-radio-group.entry.js +2 -2
- package/dist/esm/ui-radio.entry.js +18 -9
- package/dist/esm/ui-search-result-row.entry.js +2 -2
- package/dist/esm/ui-search-shell.entry.js +2 -2
- package/dist/esm/ui-select.entry.js +15 -7
- package/dist/esm/ui-switch.entry.js +20 -11
- package/dist/esm/ui-tabs.entry.js +11 -10
- package/dist/esm/ui-textarea.entry.js +10 -6
- package/dist/esm/ui-toast-region.entry.js +31 -20
- package/dist/esm/ui-tooltip.entry.js +63 -23
- package/dist/esm/ui-top-bar.entry.js +2 -2
- package/dist/esm/ui-tree-item.entry.js +57 -616
- package/dist/esm/ui-tree.entry.js +198 -14
- package/dist/index.cjs +2012 -870
- package/dist/index.d.cts +109 -1
- package/dist/index.d.ts +109 -1
- package/dist/index.js +72 -8
- package/dist/looma/looma.esm.js +1 -1
- package/dist/looma/p-03f44c45.entry.js +1 -0
- package/dist/looma/p-08f80207.entry.js +1 -0
- package/dist/looma/p-13f8195a.entry.js +1 -0
- package/dist/looma/{p-d273b857.entry.js → p-25e18ad6.entry.js} +1 -1
- package/dist/looma/p-2c03fa73.entry.js +1 -0
- package/dist/looma/p-314d5c7c.entry.js +1 -0
- package/dist/looma/{p-2ed7e241.entry.js → p-3ef2a21b.entry.js} +1 -1
- package/dist/looma/{p-063f5a89.entry.js → p-5a900d89.entry.js} +1 -1
- package/dist/looma/p-5fdcee1d.entry.js +1 -0
- package/dist/looma/{p-0198bb21.entry.js → p-672e3d16.entry.js} +1 -1
- package/dist/looma/p-68430534.entry.js +1 -0
- package/dist/looma/{p-2e6f791e.entry.js → p-72338f53.entry.js} +1 -1
- package/dist/looma/p-7ab661ec.entry.js +1 -0
- package/dist/looma/p-7c4a225f.entry.js +1 -0
- package/dist/looma/p-82f2fa3d.entry.js +1 -0
- package/dist/looma/p-839faf55.entry.js +1 -0
- package/dist/looma/p-8BGiMGQ0.js +2 -0
- package/dist/looma/p-8e254bc4.entry.js +1 -0
- package/dist/looma/p-8e6b1001.entry.js +1 -0
- package/dist/looma/p-920656cf.entry.js +1 -0
- package/dist/looma/p-97e8cb0e.entry.js +1 -0
- package/dist/looma/p-9d2662ca.entry.js +1 -0
- package/dist/looma/p-9e1c4020.entry.js +1 -0
- package/dist/looma/p-BnGhGgTH.js +1 -0
- package/dist/looma/p-C-0syqXZ.js +1 -0
- package/dist/looma/p-CoFximGM.js +13 -0
- package/dist/looma/{p-051f578c.entry.js → p-a63e2561.entry.js} +1 -1
- package/dist/looma/p-add67e4c.entry.js +1 -0
- package/dist/looma/p-b63f6d4f.entry.js +1 -0
- package/dist/looma/p-bd00d4e8.entry.js +1 -0
- package/dist/looma/p-cc915913.entry.js +1 -0
- package/dist/looma/p-cfba8f7c.entry.js +1 -0
- package/dist/looma/p-d56571a2.entry.js +1 -0
- package/dist/looma/{p-7e94d90d.entry.js → p-e0f241ab.entry.js} +1 -1
- package/dist/looma/p-f1750fd7.entry.js +1 -0
- package/dist/looma/p-fd1e4d22.entry.js +1 -0
- package/dist/types/components/ui-avatar-group/ui-avatar-group.d.ts +1 -2
- package/dist/types/components/ui-callout/ui-callout.d.ts +6 -0
- package/dist/types/components/ui-checkbox/ui-checkbox.d.ts +2 -1
- package/dist/types/components/ui-chip/ui-chip.d.ts +6 -0
- package/dist/types/components/ui-combobox/ui-combobox.d.ts +93 -0
- package/dist/types/components/ui-dialog/ui-dialog.d.ts +7 -1
- package/dist/types/components/ui-disclosure/ui-disclosure.d.ts +2 -1
- package/dist/types/components/ui-form-field/ui-form-field.d.ts +8 -0
- package/dist/types/components/ui-input/ui-input.d.ts +1 -1
- package/dist/types/components/ui-menu/ui-menu.d.ts +2 -1
- package/dist/types/components/ui-popover/ui-popover.d.ts +2 -1
- package/dist/types/components/ui-radio/ui-radio.d.ts +4 -1
- package/dist/types/components/ui-select/ui-select.d.ts +3 -2
- package/dist/types/components/ui-switch/ui-switch.d.ts +2 -1
- package/dist/types/components/ui-tabs/ui-tabs.d.ts +2 -1
- package/dist/types/components/ui-textarea/ui-textarea.d.ts +1 -1
- package/dist/types/components/ui-toast-region/ui-toast-region.d.ts +3 -1
- package/dist/types/components/ui-tooltip/ui-tooltip.d.ts +20 -2
- package/dist/types/components/ui-tree/ui-tree.d.ts +21 -1
- package/dist/types/components/ui-tree-item/ui-tree-item.d.ts +13 -5
- package/dist/types/components.d.ts +366 -71
- package/dist/types/field/combobox.d.ts +46 -0
- package/dist/types/field/valibot.d.ts +7 -0
- package/dist/types/field/validation.d.ts +56 -0
- package/dist/types/icons.d.ts +5 -0
- package/dist/types/utils/controlled-state.d.ts +4 -0
- package/dist/{ui-affordance-scope.entry-L533MECG.js → ui-affordance-scope.entry-3TUZ6GLW.js} +2 -2
- package/dist/ui-avatar-group.entry-XGJKN25W.js +51 -0
- package/dist/{ui-avatar.entry-3INAY3XP.js → ui-avatar.entry-SN3G44HW.js} +3 -3
- package/dist/ui-badge.entry-B6WDCWJX.js +22 -0
- package/dist/ui-button.entry-AZYUELLV.js +80 -0
- package/dist/ui-callout.entry-QRPWRMPC.js +32 -0
- package/dist/{ui-checkbox.entry-2PTBHSCQ.js → ui-checkbox.entry-OB6GFC4M.js} +17 -8
- package/dist/ui-chip.entry-XSNPJXX3.js +22 -0
- package/dist/ui-combobox.entry-IIMMUJF7.js +553 -0
- package/dist/{ui-context-menu.entry-AYDDCIZS.js → ui-context-menu.entry-AIULIE5Y.js} +3 -3
- package/dist/{ui-dialog.entry-I2XI3ZTZ.js → ui-dialog.entry-QSYWYHLY.js} +48 -10
- package/dist/{ui-disclosure.entry-5LY2BT7B.js → ui-disclosure.entry-3BJEYU3U.js} +13 -7
- package/dist/{ui-floating-action-button.entry-EJAMR5AM.js → ui-floating-action-button.entry-JEVNV6FI.js} +2 -2
- package/dist/ui-form-field.entry-PKSY7UU4.js +120 -0
- package/dist/{ui-icon-button.entry-7SD2LVXE.js → ui-icon-button.entry-TPX7BE7R.js} +2 -2
- package/dist/{ui-input.entry-7MM7GEQW.js → ui-input.entry-6NCLNW4E.js} +8 -6
- package/dist/ui-menu-item.entry-KA2K3PKV.js +22 -0
- package/dist/{ui-menu.entry-R4WK5QSX.js → ui-menu.entry-7GDO5L2T.js} +19 -11
- package/dist/{ui-popover.entry-ZRJRTXA7.js → ui-popover.entry-FR6YRNK6.js} +15 -9
- package/dist/{ui-radio-group.entry-S6RXHFSN.js → ui-radio-group.entry-7QHXQSNO.js} +2 -2
- package/dist/{ui-radio.entry-B73QZK2M.js → ui-radio.entry-YNMXKLDW.js} +21 -9
- package/dist/{ui-search-result-row.entry-DR2Y5S7P.js → ui-search-result-row.entry-AHVVAAIO.js} +2 -2
- package/dist/{ui-search-shell.entry-ST5IKJBC.js → ui-search-shell.entry-CNBEAMEZ.js} +2 -2
- package/dist/{ui-select.entry-7GPRFV67.js → ui-select.entry-TUY6TCTC.js} +13 -7
- package/dist/{ui-switch.entry-XQ5IRJRH.js → ui-switch.entry-26LFI7B5.js} +23 -11
- package/dist/{ui-tabs.entry-HPW5L5CY.js → ui-tabs.entry-LXB62RJJ.js} +14 -10
- package/dist/{ui-textarea.entry-W2PSRYVS.js → ui-textarea.entry-JYGMGPX2.js} +8 -6
- package/dist/{ui-toast-region.entry-FJUHFXKZ.js → ui-toast-region.entry-TOW4KZLZ.js} +29 -20
- package/dist/{ui-tooltip.entry-G5WHQW7K.js → ui-tooltip.entry-SKFNYXPH.js} +68 -25
- package/dist/{ui-top-bar.entry-3NCHFC4Y.js → ui-top-bar.entry-S3YP52EA.js} +2 -2
- package/dist/ui-tree-item.entry-LWYIPYLC.js +145 -0
- package/dist/{ui-tree.entry-SZW4Q5PY.js → ui-tree.entry-LXKUQFRU.js} +184 -13
- package/dist/valibot.d.ts +52 -0
- package/dist/valibot.js +7 -0
- package/editor/{chunk-QCOYOVQL.js → chunk-B5WVJOPV.js} +113 -97
- package/editor/extensions/index.d.ts +14 -6
- package/editor/extensions/index.js +1 -1
- package/editor/index.js +1 -1
- package/editor.css +37 -20
- package/package.json +11 -3
- package/styles.css +46 -20
- package/theme-high-contrast.css +12 -0
- package/tokens.css +26 -0
- package/vue/{chunk-5KWCMTXB.js → chunk-D4AJULDE.js} +116 -17
- package/vue/editor/index.d.ts +5 -15
- package/vue/editor/index.js +1 -1
- package/vue/index.d.ts +447 -115
- package/vue/index.js +7 -1
- package/dist/components/p-CEYIKqYc.js +0 -1
- package/dist/components/p-CIA4RyEp.js +0 -1
- package/dist/components/p-PM9a74r7.js +0 -1
- package/dist/looma/p-0584a051.entry.js +0 -1
- package/dist/looma/p-078f9fb8.entry.js +0 -1
- package/dist/looma/p-0f45c5f0.entry.js +0 -1
- package/dist/looma/p-11083743.entry.js +0 -1
- package/dist/looma/p-1674cda4.entry.js +0 -1
- package/dist/looma/p-1681b218.entry.js +0 -1
- package/dist/looma/p-34417499.entry.js +0 -1
- package/dist/looma/p-4b422d40.entry.js +0 -1
- package/dist/looma/p-54722713.entry.js +0 -13
- package/dist/looma/p-54c41576.entry.js +0 -1
- package/dist/looma/p-5ba9d496.entry.js +0 -1
- package/dist/looma/p-5d4713a6.entry.js +0 -1
- package/dist/looma/p-624ba086.entry.js +0 -1
- package/dist/looma/p-8d5adb17.entry.js +0 -1
- package/dist/looma/p-9194a99d.entry.js +0 -1
- package/dist/looma/p-CEeiinfk.js +0 -2
- package/dist/looma/p-PM9a74r7.js +0 -1
- package/dist/looma/p-a33522a2.entry.js +0 -1
- package/dist/looma/p-a5127c7d.entry.js +0 -1
- package/dist/looma/p-a9f46811.entry.js +0 -1
- package/dist/looma/p-b7aa4488.entry.js +0 -1
- package/dist/looma/p-caa8fc7b.entry.js +0 -1
- package/dist/looma/p-e3f99a24.entry.js +0 -1
- package/dist/looma/p-ed5abf6d.entry.js +0 -1
- package/dist/ui-avatar-group.entry-BWS7E2CM.js +0 -59
- package/dist/ui-badge.entry-2WOBVOYP.js +0 -22
- package/dist/ui-button.entry-VCGSEONK.js +0 -71
- package/dist/ui-form-field.entry-SJ6NNFXB.js +0 -67
- package/dist/ui-menu-item.entry-V3HIMR75.js +0 -22
- package/dist/ui-tree-item.entry-45RR3CMP.js +0 -385
|
@@ -5,10 +5,17 @@ export class UITree {
|
|
|
5
5
|
host;
|
|
6
6
|
label = 'Tree';
|
|
7
7
|
hoverExpandDelay = 700;
|
|
8
|
+
/** Maximum resulting item depth accepted by pointer reordering. Zero is unlimited. */
|
|
9
|
+
maxDepth = 0;
|
|
8
10
|
source = null;
|
|
9
11
|
target = null;
|
|
10
12
|
position = null;
|
|
13
|
+
rejectedTarget = null;
|
|
14
|
+
rejectedPosition = null;
|
|
15
|
+
rejection = null;
|
|
11
16
|
hoverIntent = null;
|
|
17
|
+
structureObserver = null;
|
|
18
|
+
tabStop = null;
|
|
12
19
|
componentDidLoad() {
|
|
13
20
|
this.hoverIntent = createHoverIntent(this.hoverExpandDelay, this.expandTarget);
|
|
14
21
|
this.host.addEventListener('dragstart', this.onDragStart);
|
|
@@ -19,6 +26,11 @@ export class UITree {
|
|
|
19
26
|
this.host.addEventListener('drop', this.onDrop);
|
|
20
27
|
this.host.addEventListener('dragend', this.onDragEnd);
|
|
21
28
|
this.host.addEventListener('keydown', this.onKeyDown);
|
|
29
|
+
this.host.addEventListener('focusin', this.onFocusIn);
|
|
30
|
+
this.host.addEventListener('ui-tree-expansion-change', this.onExpansionChange);
|
|
31
|
+
this.syncStructuralLevels();
|
|
32
|
+
this.structureObserver = new MutationObserver(this.syncStructuralLevels);
|
|
33
|
+
this.structureObserver.observe(this.host, { childList: true, subtree: true });
|
|
22
34
|
}
|
|
23
35
|
disconnectedCallback() {
|
|
24
36
|
this.hoverIntent?.destroy();
|
|
@@ -30,10 +42,44 @@ export class UITree {
|
|
|
30
42
|
this.host.removeEventListener('drop', this.onDrop);
|
|
31
43
|
this.host.removeEventListener('dragend', this.onDragEnd);
|
|
32
44
|
this.host.removeEventListener('keydown', this.onKeyDown);
|
|
45
|
+
this.host.removeEventListener('focusin', this.onFocusIn);
|
|
46
|
+
this.host.removeEventListener('ui-tree-expansion-change', this.onExpansionChange);
|
|
47
|
+
this.structureObserver?.disconnect();
|
|
48
|
+
this.structureObserver = null;
|
|
49
|
+
}
|
|
50
|
+
syncStructuralLevels = () => {
|
|
51
|
+
for (const item of Array.from(this.host.querySelectorAll('ui-tree-item'))) {
|
|
52
|
+
item.dispatchEvent(new CustomEvent('ui-tree-structure-sync'));
|
|
53
|
+
}
|
|
54
|
+
this.syncTabStop();
|
|
55
|
+
};
|
|
56
|
+
syncTabStop(preferred) {
|
|
57
|
+
const items = this.visibleItems();
|
|
58
|
+
const next = preferred && items.includes(preferred)
|
|
59
|
+
? preferred
|
|
60
|
+
: this.tabStop && items.includes(this.tabStop)
|
|
61
|
+
? this.tabStop
|
|
62
|
+
: items[0] ?? null;
|
|
63
|
+
this.tabStop = next;
|
|
64
|
+
for (const item of items) {
|
|
65
|
+
item.dispatchEvent(new CustomEvent('ui-tree-roving-tab-stop', {
|
|
66
|
+
detail: { active: item === next },
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
33
69
|
}
|
|
34
70
|
itemFromEvent(event) {
|
|
35
71
|
return event.composedPath().find(node => (node instanceof HTMLElement && node.localName === 'ui-tree-item')) ?? null;
|
|
36
72
|
}
|
|
73
|
+
eventTargetsInteractiveContent(event) {
|
|
74
|
+
for (const node of event.composedPath()) {
|
|
75
|
+
if (node instanceof HTMLElement && node.localName === 'ui-tree-item')
|
|
76
|
+
break;
|
|
77
|
+
if (node instanceof HTMLElement && node.matches('a, button, input, select, textarea, [role="button"], [role="link"]')) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
37
83
|
itemId(item) {
|
|
38
84
|
return item.itemId || item.getAttribute('item-id') || '';
|
|
39
85
|
}
|
|
@@ -75,19 +121,56 @@ export class UITree {
|
|
|
75
121
|
.filter(Boolean),
|
|
76
122
|
};
|
|
77
123
|
}
|
|
78
|
-
|
|
124
|
+
constraintDepth(item) {
|
|
125
|
+
if (item.dropDepth !== undefined)
|
|
126
|
+
return item.dropDepth;
|
|
127
|
+
const dropDepth = item.getAttribute('drop-depth');
|
|
128
|
+
if (dropDepth !== null)
|
|
129
|
+
return Number(dropDepth);
|
|
130
|
+
return Number(item.getAttribute('aria-level')) || 1;
|
|
131
|
+
}
|
|
132
|
+
subtreeDepth(item) {
|
|
133
|
+
if (item.subtreeDepth !== undefined)
|
|
134
|
+
return Math.max(0, Math.floor(item.subtreeDepth));
|
|
135
|
+
const override = item.getAttribute('subtree-depth');
|
|
136
|
+
if (override !== null)
|
|
137
|
+
return Math.max(0, Math.floor(Number(override)));
|
|
138
|
+
return Array.from(item.querySelectorAll('ui-tree-item')).reduce((deepest, descendant) => {
|
|
139
|
+
let nesting = 0;
|
|
140
|
+
let ancestor = descendant.parentElement?.closest('ui-tree-item') ?? null;
|
|
141
|
+
while (ancestor && ancestor !== item) {
|
|
142
|
+
nesting += 1;
|
|
143
|
+
ancestor = ancestor.parentElement?.closest('ui-tree-item') ?? null;
|
|
144
|
+
}
|
|
145
|
+
return ancestor === item ? Math.max(deepest, nesting + 1) : deepest;
|
|
146
|
+
}, 0);
|
|
147
|
+
}
|
|
148
|
+
dropRejection(source, target, position) {
|
|
79
149
|
// A tree item can never move into (or beside) one of its own descendants.
|
|
80
150
|
// Reject the target before showing any insertion affordance so the preview
|
|
81
151
|
// stays truthful instead of promising a move the consumer must undo.
|
|
82
152
|
if (source.contains(target))
|
|
83
|
-
return
|
|
153
|
+
return { reason: 'descendant' };
|
|
84
154
|
const sourceMeta = this.itemMetadata(source);
|
|
85
155
|
const targetMeta = this.itemMetadata(target);
|
|
86
156
|
if (position === 'inside') {
|
|
87
|
-
|
|
88
|
-
|
|
157
|
+
if (!this.acceptsChildren(target)
|
|
158
|
+
|| (targetMeta.accepts.length > 0 && !targetMeta.accepts.includes(sourceMeta.type))) {
|
|
159
|
+
return { reason: 'incompatible' };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
else if (sourceMeta.type !== targetMeta.type) {
|
|
163
|
+
return { reason: 'incompatible' };
|
|
89
164
|
}
|
|
90
|
-
|
|
165
|
+
const maxDepth = Math.max(0, Math.floor(this.maxDepth));
|
|
166
|
+
if (maxDepth > 0) {
|
|
167
|
+
const targetDepth = Math.max(0, Math.floor(this.constraintDepth(target)));
|
|
168
|
+
const subtreeDepth = this.subtreeDepth(source);
|
|
169
|
+
const resultingDepth = targetDepth + (position === 'inside' ? 1 : 0) + subtreeDepth;
|
|
170
|
+
if (resultingDepth > maxDepth)
|
|
171
|
+
return { reason: 'max-depth', maxDepth, resultingDepth };
|
|
172
|
+
}
|
|
173
|
+
return null;
|
|
91
174
|
}
|
|
92
175
|
clearTarget() {
|
|
93
176
|
this.target?.removeAttribute('data-drop-position');
|
|
@@ -95,10 +178,16 @@ export class UITree {
|
|
|
95
178
|
this.position = null;
|
|
96
179
|
this.hoverIntent?.cancel();
|
|
97
180
|
}
|
|
181
|
+
clearRejection() {
|
|
182
|
+
this.rejectedTarget = null;
|
|
183
|
+
this.rejectedPosition = null;
|
|
184
|
+
this.rejection = null;
|
|
185
|
+
}
|
|
98
186
|
finishDrag() {
|
|
99
187
|
this.source?.removeAttribute('data-dragging');
|
|
100
188
|
this.source = null;
|
|
101
189
|
this.clearTarget();
|
|
190
|
+
this.clearRejection();
|
|
102
191
|
}
|
|
103
192
|
expandTarget = (itemId) => {
|
|
104
193
|
const item = Array.from(this.host.querySelectorAll('ui-tree-item'))
|
|
@@ -136,18 +225,29 @@ export class UITree {
|
|
|
136
225
|
return false;
|
|
137
226
|
if (!target || target === this.source) {
|
|
138
227
|
this.clearTarget();
|
|
228
|
+
this.clearRejection();
|
|
139
229
|
return false;
|
|
140
230
|
}
|
|
141
231
|
const row = this.rowFor(target);
|
|
142
232
|
if (!row)
|
|
143
233
|
return false;
|
|
144
234
|
const position = classifyDropPosition(row.getBoundingClientRect(), clientY, this.acceptsChildren(target));
|
|
145
|
-
|
|
235
|
+
const rejection = this.dropRejection(this.source, target, position);
|
|
236
|
+
if (rejection) {
|
|
146
237
|
if (dataTransfer)
|
|
147
238
|
dataTransfer.dropEffect = 'none';
|
|
148
239
|
this.clearTarget();
|
|
240
|
+
if (rejection.reason === 'max-depth') {
|
|
241
|
+
this.rejectedTarget = target;
|
|
242
|
+
this.rejectedPosition = position;
|
|
243
|
+
this.rejection = rejection;
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
this.clearRejection();
|
|
247
|
+
}
|
|
149
248
|
return false;
|
|
150
249
|
}
|
|
250
|
+
this.clearRejection();
|
|
151
251
|
if (dataTransfer)
|
|
152
252
|
dataTransfer.dropEffect = 'move';
|
|
153
253
|
if (this.target !== target || this.position !== position) {
|
|
@@ -189,12 +289,15 @@ export class UITree {
|
|
|
189
289
|
if (this.itemAtPoint(event.clientX, event.clientY))
|
|
190
290
|
return;
|
|
191
291
|
this.clearTarget();
|
|
292
|
+
this.clearRejection();
|
|
192
293
|
};
|
|
193
294
|
dispatchReorder(source, target, position) {
|
|
194
295
|
const sourceId = this.itemId(source);
|
|
195
296
|
const targetId = this.itemId(target);
|
|
196
297
|
if (!sourceId || !targetId)
|
|
197
298
|
return;
|
|
299
|
+
if (position === 'inside')
|
|
300
|
+
this.expandTarget(targetId);
|
|
198
301
|
const sourceMeta = this.itemMetadata(source);
|
|
199
302
|
const targetMeta = this.itemMetadata(target);
|
|
200
303
|
dispatchDetail(this.host, 'reorder', {
|
|
@@ -208,6 +311,21 @@ export class UITree {
|
|
|
208
311
|
trigger: 'pointer',
|
|
209
312
|
});
|
|
210
313
|
}
|
|
314
|
+
dispatchReorderRejected(source, target, position, rejection) {
|
|
315
|
+
const sourceId = this.itemId(source);
|
|
316
|
+
const targetId = this.itemId(target);
|
|
317
|
+
if (!sourceId || !targetId)
|
|
318
|
+
return;
|
|
319
|
+
dispatchDetail(this.host, 'reorder-rejected', {
|
|
320
|
+
sourceId,
|
|
321
|
+
targetId,
|
|
322
|
+
position,
|
|
323
|
+
reason: 'max-depth',
|
|
324
|
+
maxDepth: rejection.maxDepth,
|
|
325
|
+
resultingDepth: rejection.resultingDepth,
|
|
326
|
+
trigger: 'pointer',
|
|
327
|
+
});
|
|
328
|
+
}
|
|
211
329
|
onDrop = (event) => {
|
|
212
330
|
if (!this.source || !this.target || !this.position)
|
|
213
331
|
return;
|
|
@@ -217,14 +335,23 @@ export class UITree {
|
|
|
217
335
|
};
|
|
218
336
|
onDragEnd = (event) => {
|
|
219
337
|
if (this.source) {
|
|
338
|
+
if (this.rejectedTarget && this.rejectedPosition && this.rejection) {
|
|
339
|
+
this.dispatchReorderRejected(this.source, this.rejectedTarget, this.rejectedPosition, this.rejection);
|
|
340
|
+
this.finishDrag();
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
220
343
|
const target = this.itemAtPoint(event.clientX, event.clientY);
|
|
221
344
|
if (target && target !== this.source) {
|
|
222
345
|
const row = this.rowFor(target);
|
|
223
346
|
if (row) {
|
|
224
347
|
const position = classifyDropPosition(row.getBoundingClientRect(), event.clientY, this.acceptsChildren(target));
|
|
225
|
-
|
|
348
|
+
const rejection = this.dropRejection(this.source, target, position);
|
|
349
|
+
if (!rejection) {
|
|
226
350
|
this.dispatchReorder(this.source, target, position);
|
|
227
351
|
}
|
|
352
|
+
else if (rejection.reason === 'max-depth') {
|
|
353
|
+
this.dispatchReorderRejected(this.source, target, position, rejection);
|
|
354
|
+
}
|
|
228
355
|
}
|
|
229
356
|
}
|
|
230
357
|
}
|
|
@@ -234,7 +361,35 @@ export class UITree {
|
|
|
234
361
|
return Array.from(this.host.querySelectorAll('ui-tree-item'))
|
|
235
362
|
.filter(item => item.getClientRects().length > 0 && !item.hasAttribute('disabled'));
|
|
236
363
|
}
|
|
364
|
+
parentItem(item) {
|
|
365
|
+
const parent = item.parentElement?.closest('ui-tree-item') ?? null;
|
|
366
|
+
return parent && this.host.contains(parent) ? parent : null;
|
|
367
|
+
}
|
|
368
|
+
firstVisibleChild(item, items) {
|
|
369
|
+
return items.find(candidate => this.parentItem(candidate) === item) ?? null;
|
|
370
|
+
}
|
|
371
|
+
focusItem(item) {
|
|
372
|
+
this.syncTabStop(item);
|
|
373
|
+
item.focus();
|
|
374
|
+
}
|
|
375
|
+
requestExpansion(item, expanded) {
|
|
376
|
+
item.dispatchEvent(new CustomEvent('ui-tree-request-expanded', {
|
|
377
|
+
detail: { expanded, trigger: 'keyboard' },
|
|
378
|
+
}));
|
|
379
|
+
}
|
|
380
|
+
onFocusIn = (event) => {
|
|
381
|
+
if (this.eventTargetsInteractiveContent(event))
|
|
382
|
+
return;
|
|
383
|
+
const item = this.itemFromEvent(event);
|
|
384
|
+
if (item)
|
|
385
|
+
this.syncTabStop(item);
|
|
386
|
+
};
|
|
387
|
+
onExpansionChange = () => {
|
|
388
|
+
requestAnimationFrame(() => this.syncTabStop());
|
|
389
|
+
};
|
|
237
390
|
onKeyDown = (event) => {
|
|
391
|
+
if (this.eventTargetsInteractiveContent(event))
|
|
392
|
+
return;
|
|
238
393
|
const current = this.itemFromEvent(event);
|
|
239
394
|
if (!current)
|
|
240
395
|
return;
|
|
@@ -242,14 +397,43 @@ export class UITree {
|
|
|
242
397
|
const index = items.indexOf(current);
|
|
243
398
|
if (index < 0)
|
|
244
399
|
return;
|
|
245
|
-
const next = event.key === 'ArrowDown' ? items[index + 1]
|
|
246
|
-
|
|
400
|
+
const next = event.key === 'ArrowDown' ? items[index + 1]
|
|
401
|
+
: event.key === 'ArrowUp' ? items[index - 1]
|
|
402
|
+
: event.key === 'Home' ? items[0]
|
|
403
|
+
: event.key === 'End' ? items.at(-1)
|
|
404
|
+
: null;
|
|
405
|
+
if (next) {
|
|
406
|
+
event.preventDefault();
|
|
407
|
+
this.focusItem(next);
|
|
247
408
|
return;
|
|
248
|
-
|
|
249
|
-
|
|
409
|
+
}
|
|
410
|
+
if (event.key === 'ArrowLeft') {
|
|
411
|
+
if (current.getAttribute('aria-expanded') === 'true') {
|
|
412
|
+
event.preventDefault();
|
|
413
|
+
this.requestExpansion(current, false);
|
|
414
|
+
}
|
|
415
|
+
else if (this.parentItem(current)) {
|
|
416
|
+
event.preventDefault();
|
|
417
|
+
this.focusItem(this.parentItem(current));
|
|
418
|
+
}
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
if (event.key === 'ArrowRight') {
|
|
422
|
+
if (current.getAttribute('aria-expanded') === 'false') {
|
|
423
|
+
event.preventDefault();
|
|
424
|
+
this.requestExpansion(current, true);
|
|
425
|
+
}
|
|
426
|
+
else if (current.getAttribute('aria-expanded') === 'true') {
|
|
427
|
+
const child = this.firstVisibleChild(current, items);
|
|
428
|
+
if (child) {
|
|
429
|
+
event.preventDefault();
|
|
430
|
+
this.focusItem(child);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
250
434
|
};
|
|
251
435
|
render() {
|
|
252
|
-
return (h(Host, { key: '
|
|
436
|
+
return (h(Host, { key: '549c09abc67dc60b16bf2d6b7d6346f214e9d6ae', role: "tree", "aria-label": this.label || 'Tree' }, h("slot", { key: 'fea59bde97611bf384e32ce4fb2b3eec9aca784f' })));
|
|
253
437
|
}
|
|
254
438
|
static get is() { return "ui-tree"; }
|
|
255
439
|
static get encapsulation() { return "shadow"; }
|
|
@@ -304,6 +488,26 @@ export class UITree {
|
|
|
304
488
|
"reflect": false,
|
|
305
489
|
"attribute": "hover-expand-delay",
|
|
306
490
|
"defaultValue": "700"
|
|
491
|
+
},
|
|
492
|
+
"maxDepth": {
|
|
493
|
+
"type": "number",
|
|
494
|
+
"mutable": false,
|
|
495
|
+
"complexType": {
|
|
496
|
+
"original": "number",
|
|
497
|
+
"resolved": "number",
|
|
498
|
+
"references": {}
|
|
499
|
+
},
|
|
500
|
+
"required": false,
|
|
501
|
+
"optional": false,
|
|
502
|
+
"docs": {
|
|
503
|
+
"tags": [],
|
|
504
|
+
"text": "Maximum resulting item depth accepted by pointer reordering. Zero is unlimited."
|
|
505
|
+
},
|
|
506
|
+
"getter": false,
|
|
507
|
+
"setter": false,
|
|
508
|
+
"reflect": false,
|
|
509
|
+
"attribute": "max-depth",
|
|
510
|
+
"defaultValue": "0"
|
|
307
511
|
}
|
|
308
512
|
};
|
|
309
513
|
}
|
|
@@ -7,8 +7,10 @@ export class UITreeItem {
|
|
|
7
7
|
itemId = '';
|
|
8
8
|
/** Accessible name used by the disclosure and drag handle. */
|
|
9
9
|
label = '';
|
|
10
|
-
/**
|
|
11
|
-
|
|
10
|
+
/** Application hierarchy depth override used for drop constraints. Defaults to structural nesting. */
|
|
11
|
+
dropDepth;
|
|
12
|
+
/** Virtualized-tree descendant-depth override for the tree's max-depth drop constraint. */
|
|
13
|
+
subtreeDepth;
|
|
12
14
|
/** Whether this item accepts children and exposes disclosure behavior. */
|
|
13
15
|
container = false;
|
|
14
16
|
/** Whether this item participates in pointer drag and drop. */
|
|
@@ -19,37 +21,74 @@ export class UITreeItem {
|
|
|
19
21
|
dropScope = '';
|
|
20
22
|
/** Comma-separated drag kinds accepted as children. Empty accepts every kind. */
|
|
21
23
|
accepts = '';
|
|
22
|
-
/**
|
|
23
|
-
expanded
|
|
24
|
+
/** Controlled expansion value. When omitted, `default-expanded` initializes uncontrolled state. */
|
|
25
|
+
expanded;
|
|
24
26
|
/** Initial uncontrolled expansion value. */
|
|
25
27
|
defaultExpanded = false;
|
|
26
28
|
selected = false;
|
|
27
29
|
disabled = false;
|
|
28
30
|
internalExpanded = false;
|
|
31
|
+
structuralLevel = 1;
|
|
32
|
+
tabStop = false;
|
|
29
33
|
syncExpandedFromProp() {
|
|
30
|
-
|
|
34
|
+
// A defined prop owns the rendered state; clearing it resumes the current
|
|
35
|
+
// uncontrolled state instead of replaying the initial default.
|
|
36
|
+
if (this.expanded !== undefined)
|
|
37
|
+
this.internalExpanded = this.expanded;
|
|
31
38
|
}
|
|
32
39
|
componentWillLoad() {
|
|
33
|
-
this.internalExpanded = this.expanded
|
|
40
|
+
this.internalExpanded = this.expanded ?? this.defaultExpanded;
|
|
41
|
+
this.updateStructuralLevel();
|
|
34
42
|
}
|
|
35
|
-
|
|
43
|
+
connectedCallback() {
|
|
36
44
|
this.host.addEventListener('ui-tree-auto-expand', this.onAutoExpand);
|
|
45
|
+
this.host.addEventListener('ui-tree-structure-sync', this.updateStructuralLevel);
|
|
46
|
+
this.host.addEventListener('ui-tree-roving-tab-stop', this.onRovingTabStop);
|
|
47
|
+
this.host.addEventListener('ui-tree-request-expanded', this.onExpansionRequest);
|
|
37
48
|
}
|
|
38
49
|
disconnectedCallback() {
|
|
39
50
|
this.host.removeEventListener('ui-tree-auto-expand', this.onAutoExpand);
|
|
51
|
+
this.host.removeEventListener('ui-tree-structure-sync', this.updateStructuralLevel);
|
|
52
|
+
this.host.removeEventListener('ui-tree-roving-tab-stop', this.onRovingTabStop);
|
|
53
|
+
this.host.removeEventListener('ui-tree-request-expanded', this.onExpansionRequest);
|
|
40
54
|
}
|
|
55
|
+
updateStructuralLevel = () => {
|
|
56
|
+
const tree = this.host.closest('ui-tree');
|
|
57
|
+
let ancestor = this.host.parentElement?.closest('ui-tree-item') ?? null;
|
|
58
|
+
let level = 1;
|
|
59
|
+
while (ancestor && tree?.contains(ancestor)) {
|
|
60
|
+
level += 1;
|
|
61
|
+
ancestor = ancestor.parentElement?.closest('ui-tree-item') ?? null;
|
|
62
|
+
}
|
|
63
|
+
if (this.structuralLevel !== level)
|
|
64
|
+
this.structuralLevel = level;
|
|
65
|
+
};
|
|
41
66
|
setExpanded(expanded, trigger) {
|
|
42
|
-
|
|
67
|
+
const current = this.isExpanded();
|
|
68
|
+
if (!this.container || this.disabled || current === expanded)
|
|
43
69
|
return;
|
|
44
|
-
this.
|
|
70
|
+
if (this.expanded === undefined)
|
|
71
|
+
this.internalExpanded = expanded;
|
|
45
72
|
dispatchDetail(this.host, 'expand', { id: this.itemId, expanded, trigger });
|
|
73
|
+
this.host.dispatchEvent(new CustomEvent('ui-tree-expansion-change'));
|
|
74
|
+
}
|
|
75
|
+
isExpanded() {
|
|
76
|
+
return this.expanded ?? this.internalExpanded;
|
|
46
77
|
}
|
|
47
78
|
onAutoExpand = () => {
|
|
48
79
|
this.setExpanded(true, 'pointer');
|
|
49
80
|
};
|
|
81
|
+
onRovingTabStop = (event) => {
|
|
82
|
+
this.tabStop = Boolean(event.detail?.active) && !this.disabled;
|
|
83
|
+
};
|
|
84
|
+
onExpansionRequest = (event) => {
|
|
85
|
+
const detail = event.detail;
|
|
86
|
+
if (typeof detail?.expanded === 'boolean')
|
|
87
|
+
this.setExpanded(detail.expanded, detail.trigger ?? 'keyboard');
|
|
88
|
+
};
|
|
50
89
|
onDisclosureClick = (event) => {
|
|
51
90
|
event.stopPropagation();
|
|
52
|
-
this.setExpanded(!this.
|
|
91
|
+
this.setExpanded(!this.isExpanded(), eventToTrigger(event));
|
|
53
92
|
};
|
|
54
93
|
onDisclosureKeydown = (event) => {
|
|
55
94
|
if (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft')
|
|
@@ -65,16 +104,17 @@ export class UITreeItem {
|
|
|
65
104
|
const interactive = path.some((node) => node instanceof HTMLElement && (node.matches('a, button, input, select, textarea, [role="button"], [role="link"]')
|
|
66
105
|
|| node.getAttribute('slot') === 'actions'));
|
|
67
106
|
if (!interactive)
|
|
68
|
-
this.setExpanded(!this.
|
|
107
|
+
this.setExpanded(!this.isExpanded(), eventToTrigger(event));
|
|
69
108
|
};
|
|
70
109
|
render() {
|
|
71
|
-
const level =
|
|
72
|
-
const
|
|
110
|
+
const level = this.structuralLevel;
|
|
111
|
+
const expanded = this.isExpanded();
|
|
112
|
+
const disclosureLabel = `${expanded ? 'Collapse' : 'Expand'} ${this.label || 'item'}`;
|
|
73
113
|
const dragLabel = `Drag ${this.label || 'item'} to reorder`;
|
|
74
|
-
return (h(Host, { key: '
|
|
114
|
+
return (h(Host, { key: '36ad9eac3e0fe2a606e63294891b1c0697034b46', role: "treeitem", "aria-label": this.label || undefined, "aria-level": String(level), "aria-expanded": this.container ? String(expanded) : undefined, "aria-selected": String(this.selected), "aria-disabled": this.disabled ? 'true' : undefined, "data-container": this.container ? '' : undefined, "data-selected": this.selected ? '' : undefined, "data-disabled": this.disabled ? '' : undefined, "data-drag-type": this.dragType || 'item', "data-drop-scope": this.dropScope || undefined, "data-accepts": this.accepts || undefined, tabIndex: this.disabled || !this.tabStop ? -1 : 0, style: {
|
|
75
115
|
'--ui-tree-item-depth': String(level - 1),
|
|
76
116
|
'margin-inline-start': level > 1 ? 'var(--ui-tree-indent, 16px)' : '0px',
|
|
77
|
-
} }, h("div", { key: '
|
|
117
|
+
} }, h("div", { key: 'e92f5bc73accef3b348559ea144e0b769c98c721', class: "row", part: "row", onClick: this.onRowClick }, this.sortable && !this.disabled ? (h("button", { class: "drag-handle", part: "drag-handle", type: "button", draggable: true, "aria-label": dragLabel, title: dragLabel }, h("span", { innerHTML: loomaIconMarkup('grip-vertical') }))) : null, this.container ? (h("button", { class: "disclosure", part: "disclosure", type: "button", "aria-label": disclosureLabel, "aria-expanded": String(expanded), disabled: this.disabled, onClick: this.onDisclosureClick, onKeyDown: this.onDisclosureKeydown }, h("span", { class: { 'disclosure-icon': true, 'disclosure-icon--expanded': expanded }, innerHTML: loomaIconMarkup('chevron-down') }))) : h("span", { class: "disclosure-spacer", "aria-hidden": "true" }), h("span", { key: 'dd2d0550d6846d0a4f80a4108968bfc32c18658f', class: "leading", part: "leading" }, h("slot", { key: '622d449a338dce57bc2e64aaf776471e8d3ce1b4', name: "leading" })), h("span", { key: '29c3e6ace4838ab941ada2547356288358faaeb2', class: "label", part: "label" }, h("slot", { key: 'f1594c11fa0b9fbe8a3c20df6edce19421cab148' })), h("span", { key: 'e4a6408f86b58a325145e713d116fc09322bb0d3', class: "actions", part: "actions" }, h("slot", { key: 'ff3afaf1089426e19ee1fc39c6567c3d40ca4272', name: "actions" })), h("span", { key: 'efcf23f7aad6c4353fa24bfe2a81001122335f72', class: "drop-indicator row-drop-indicator", part: "drop-indicator", "aria-hidden": "true" })), this.container ? (h("div", { class: "children", part: "children", role: "group", hidden: !expanded }, h("slot", { name: "children" }))) : null, h("span", { key: '21bfc8a6ad6e487cd044b5a3cbd7e8f900f2d1e1', class: "drop-indicator subtree-drop-indicator", part: "drop-indicator", "aria-hidden": "true" })));
|
|
78
118
|
}
|
|
79
119
|
static get is() { return "ui-tree-item"; }
|
|
80
120
|
static get encapsulation() { return "shadow"; }
|
|
@@ -130,7 +170,7 @@ export class UITreeItem {
|
|
|
130
170
|
"attribute": "label",
|
|
131
171
|
"defaultValue": "''"
|
|
132
172
|
},
|
|
133
|
-
"
|
|
173
|
+
"dropDepth": {
|
|
134
174
|
"type": "number",
|
|
135
175
|
"mutable": false,
|
|
136
176
|
"complexType": {
|
|
@@ -139,16 +179,34 @@ export class UITreeItem {
|
|
|
139
179
|
"references": {}
|
|
140
180
|
},
|
|
141
181
|
"required": false,
|
|
142
|
-
"optional":
|
|
182
|
+
"optional": true,
|
|
183
|
+
"docs": {
|
|
184
|
+
"tags": [],
|
|
185
|
+
"text": "Application hierarchy depth override used for drop constraints. Defaults to structural nesting."
|
|
186
|
+
},
|
|
187
|
+
"getter": false,
|
|
188
|
+
"setter": false,
|
|
189
|
+
"reflect": false,
|
|
190
|
+
"attribute": "drop-depth"
|
|
191
|
+
},
|
|
192
|
+
"subtreeDepth": {
|
|
193
|
+
"type": "number",
|
|
194
|
+
"mutable": false,
|
|
195
|
+
"complexType": {
|
|
196
|
+
"original": "number",
|
|
197
|
+
"resolved": "number",
|
|
198
|
+
"references": {}
|
|
199
|
+
},
|
|
200
|
+
"required": false,
|
|
201
|
+
"optional": true,
|
|
143
202
|
"docs": {
|
|
144
203
|
"tags": [],
|
|
145
|
-
"text": "
|
|
204
|
+
"text": "Virtualized-tree descendant-depth override for the tree's max-depth drop constraint."
|
|
146
205
|
},
|
|
147
206
|
"getter": false,
|
|
148
207
|
"setter": false,
|
|
149
208
|
"reflect": false,
|
|
150
|
-
"attribute": "depth"
|
|
151
|
-
"defaultValue": "1"
|
|
209
|
+
"attribute": "subtree-depth"
|
|
152
210
|
},
|
|
153
211
|
"container": {
|
|
154
212
|
"type": "boolean",
|
|
@@ -259,16 +317,15 @@ export class UITreeItem {
|
|
|
259
317
|
"references": {}
|
|
260
318
|
},
|
|
261
319
|
"required": false,
|
|
262
|
-
"optional":
|
|
320
|
+
"optional": true,
|
|
263
321
|
"docs": {
|
|
264
322
|
"tags": [],
|
|
265
|
-
"text": "
|
|
323
|
+
"text": "Controlled expansion value. When omitted, `default-expanded` initializes uncontrolled state."
|
|
266
324
|
},
|
|
267
325
|
"getter": false,
|
|
268
326
|
"setter": false,
|
|
269
327
|
"reflect": false,
|
|
270
|
-
"attribute": "expanded"
|
|
271
|
-
"defaultValue": "false"
|
|
328
|
+
"attribute": "expanded"
|
|
272
329
|
},
|
|
273
330
|
"defaultExpanded": {
|
|
274
331
|
"type": "boolean",
|
|
@@ -334,7 +391,9 @@ export class UITreeItem {
|
|
|
334
391
|
}
|
|
335
392
|
static get states() {
|
|
336
393
|
return {
|
|
337
|
-
"internalExpanded": {}
|
|
394
|
+
"internalExpanded": {},
|
|
395
|
+
"structuralLevel": {},
|
|
396
|
+
"tabStop": {}
|
|
338
397
|
};
|
|
339
398
|
}
|
|
340
399
|
static get elementRef() { return "host"; }
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Formatting is additive: every original character must survive in order.
|
|
2
|
+
* Normalization belongs to submitted output, never the visible editing buffer. */
|
|
3
|
+
export function formatEditingValue(raw, selection, format) {
|
|
4
|
+
const unchanged = { display: raw, selection };
|
|
5
|
+
if (!format)
|
|
6
|
+
return unchanged;
|
|
7
|
+
let result;
|
|
8
|
+
try {
|
|
9
|
+
result = format(raw, selection);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return unchanged;
|
|
13
|
+
}
|
|
14
|
+
if (!result)
|
|
15
|
+
return unchanged;
|
|
16
|
+
const characters = Array.from(raw);
|
|
17
|
+
let cursor = 0;
|
|
18
|
+
for (const character of result.display)
|
|
19
|
+
if (character === characters[cursor])
|
|
20
|
+
cursor += 1;
|
|
21
|
+
if (!Number.isInteger(result.selection.start) || !Number.isInteger(result.selection.end) || cursor !== characters.length || result.selection.start < 0 || result.selection.end < result.selection.start
|
|
22
|
+
|| result.selection.end > result.display.length)
|
|
23
|
+
return unchanged;
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
export async function validateField(request, config) {
|
|
27
|
+
let output = request.raw;
|
|
28
|
+
let issues = [];
|
|
29
|
+
const check = () => request.signal.throwIfAborted();
|
|
30
|
+
try {
|
|
31
|
+
check();
|
|
32
|
+
if (config.parse)
|
|
33
|
+
output = await config.parse(request.raw, request);
|
|
34
|
+
check();
|
|
35
|
+
if (config.schema) {
|
|
36
|
+
const result = await config.schema['~standard'].validate(output);
|
|
37
|
+
check();
|
|
38
|
+
if (result.issues)
|
|
39
|
+
issues = result.issues;
|
|
40
|
+
else if ('value' in result)
|
|
41
|
+
output = result.value;
|
|
42
|
+
}
|
|
43
|
+
if (!issues.some(issue => issue.severity !== 'warning')) {
|
|
44
|
+
if (config.normalize)
|
|
45
|
+
output = await config.normalize(output, request);
|
|
46
|
+
check();
|
|
47
|
+
if (config.validator) {
|
|
48
|
+
const result = await config.validator(output, request);
|
|
49
|
+
check();
|
|
50
|
+
issues = [...issues, ...(result.issues ?? [])];
|
|
51
|
+
if ('output' in result)
|
|
52
|
+
output = result.output;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
check();
|
|
58
|
+
issues = [{ message: error instanceof Error ? error.message : 'Unable to validate this value.' }];
|
|
59
|
+
}
|
|
60
|
+
issues = [...issues, ...(config.issues ?? [])];
|
|
61
|
+
return { output: issues.some(issue => issue.severity !== 'warning') ? undefined : output, issues };
|
|
62
|
+
}
|