u2ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.htaccess +7 -0
- package/LICENSE +21 -0
- package/README.md +36 -0
- package/attr/behavior/README.md +25 -0
- package/attr/behavior/behavior.js +261 -0
- package/attr/behavior/manifest.json +43 -0
- package/attr/behavior/tests/minimal.html +19 -0
- package/attr/behavior/tests/test.html +98 -0
- package/attr/confirm/README.md +36 -0
- package/attr/confirm/confirm.js +90 -0
- package/attr/confirm/manifest.json +43 -0
- package/attr/confirm/tests/minimal.html +23 -0
- package/attr/confirm/tests/test.html +79 -0
- package/attr/draghandle/README.md +41 -0
- package/attr/draghandle/draghandle.js +42 -0
- package/attr/draghandle/tests/minimal.html +44 -0
- package/attr/focusgroup/README.md +49 -0
- package/attr/focusgroup/focusgroup.js +100 -0
- package/attr/focusgroup/manifest.json +38 -0
- package/attr/focusgroup/tests/minimal.html +27 -0
- package/attr/focusgroup/tests/test.html +154 -0
- package/attr/href/README.md +38 -0
- package/attr/href/href.js +42 -0
- package/attr/href/manifest.json +43 -0
- package/attr/href/tests/minimal.html +17 -0
- package/attr/href/tests/test.html +70 -0
- package/attr/intersect/README.md +42 -0
- package/attr/intersect/intersect.js +99 -0
- package/attr/intersect/manifest.json +57 -0
- package/attr/intersect/tests/minimal.html +30 -0
- package/attr/intersect/tests/test.html +64 -0
- package/attr/navigable/README.md +31 -0
- package/attr/navigable/TargetObserver.js +91 -0
- package/attr/navigable/U2TargetObserver.js +75 -0
- package/attr/navigable/manifest.json +42 -0
- package/attr/navigable/navigable.js +87 -0
- package/attr/navigable/tests/U1TargetObserver.html +56 -0
- package/attr/navigable/tests/minimal.html +17 -0
- package/attr/navigable/tests/targetObserver.html +106 -0
- package/attr/navigable/tests/test.html +84 -0
- package/attr/parallax/README.md +48 -0
- package/attr/parallax/parallax.js +119 -0
- package/attr/parallax/tests/minimal.html +25 -0
- package/attr/parallax/tests/performance.html +102 -0
- package/attr/parallax/tests/test.html +108 -0
- package/attr/skin/README.md +59 -0
- package/attr/skin/skin.css +51 -0
- package/attr/skin/tests/minimal.html +34 -0
- package/attr/skin/tests/test.html +96 -0
- package/class/badge/README.md +25 -0
- package/class/badge/badge.css +35 -0
- package/class/badge/tests/minimal.html +17 -0
- package/class/badge/tests/test.html +112 -0
- package/class/card1/README.md +45 -0
- package/class/card1/card1.css +30 -0
- package/class/card1/tests/minimal.html +33 -0
- package/class/card1/tests/test.html +78 -0
- package/class/flex/README.md +62 -0
- package/class/flex/flex.css +25 -0
- package/class/flex/tests/minimal.html +31 -0
- package/class/flex/tests/test.html +58 -0
- package/class/grid/README.md +52 -0
- package/class/grid/grid.css +40 -0
- package/class/grid/tests/minimal.html +34 -0
- package/class/grid/tests/test.html +78 -0
- package/class/input/README.md +49 -0
- package/class/input/input.css +33 -0
- package/class/input/tests/minimal.html +39 -0
- package/class/input/tests/test.html +29 -0
- package/class/reset/README.md +47 -0
- package/class/reset/reset.css +8 -0
- package/class/reset/tests/minimal.html +23 -0
- package/class/table/README.md +57 -0
- package/class/table/table.css +126 -0
- package/class/table/tests/minimal.html +40 -0
- package/class/table/tests/test.html +226 -0
- package/class/unstyle/README.md +32 -0
- package/class/unstyle/tests/minimal.html +22 -0
- package/class/unstyle/tests/test.html +32 -0
- package/class/unstyle/unstyle.css +12 -0
- package/class/width/README.md +48 -0
- package/class/width/tests/minimal.html +27 -0
- package/class/width/tests/test.html +101 -0
- package/class/width/width.css +22 -0
- package/css/base/README.md +25 -0
- package/css/base/base.css +127 -0
- package/css/base/beta.css +50 -0
- package/css/base/full.css +5 -0
- package/css/base/nomotion.css +9 -0
- package/css/base/print.css +36 -0
- package/css/base/tests/nomotion.html +89 -0
- package/css/base/tests/test.html +539 -0
- package/css/classes/README.md +17 -0
- package/css/classes/classes.css +78 -0
- package/css/classes/tests/test.html +63 -0
- package/css/classless/README.md +26 -0
- package/css/classless/aria.css +64 -0
- package/css/classless/classless.css +124 -0
- package/css/classless/full.css +11 -0
- package/css/classless/more.css +340 -0
- package/css/classless/simple.css +103 -0
- package/css/classless/snippeds/a/icons.css +12 -0
- package/css/classless/snippeds/experiments/conventions.css +41 -0
- package/css/classless/snippeds/hr/gradient.css +3 -0
- package/css/classless/snippeds/hr/section_sign.css +16 -0
- package/css/classless/snippeds/hr/tests.html +50 -0
- package/css/classless/tests/aria.html +101 -0
- package/css/classless/tests/foreign/classless-almond.css.html +445 -0
- package/css/classless/tests/foreign/classless-classless.css.html +831 -0
- package/css/classless/tests/foreign/classless-mvp.html +415 -0
- package/css/classless/tests/foreign/classless.sakura.html +224 -0
- package/css/classless/tests/foreign/stylestage.dev.html +304 -0
- package/css/classless/tests/foreign/test-homogenizer.html +433 -0
- package/css/classless/tests/foreign/test-html5-elements-tester.html +956 -0
- package/css/classless/tests/foreign/test-opinionated_css.html +148 -0
- package/css/classless/tests/list-bullet.html +110 -0
- package/css/classless/tests/more.html +246 -0
- package/css/classless/tests/oklch.experiments.html +280 -0
- package/css/classless/tests/test.html +106 -0
- package/css/classless/tests/variables.html +109 -0
- package/css/classless/variables.css +99 -0
- package/css/norm/README.md +37 -0
- package/css/norm/beta.css +40 -0
- package/css/norm/norm.css +98 -0
- package/css/norm/oldies.css +60 -0
- package/css/norm/tests/test.html +434 -0
- package/css/norm/tests/test.js +103 -0
- package/el/accordion/README.md +59 -0
- package/el/accordion/accordion.css +7 -0
- package/el/accordion/accordion.js +258 -0
- package/el/accordion/manifest.json +57 -0
- package/el/accordion/tests/minimal.html +44 -0
- package/el/accordion/tests/test.html +168 -0
- package/el/alert/README.md +67 -0
- package/el/alert/alert copy.js +224 -0
- package/el/alert/alert.css +73 -0
- package/el/alert/alert.js +187 -0
- package/el/alert/manifest.json +77 -0
- package/el/alert/tests/minimal.html +36 -0
- package/el/alert/tests/test.html +105 -0
- package/el/buttongroup/README.md +36 -0
- package/el/buttongroup/buttongroup.css +30 -0
- package/el/buttongroup/buttongroup.js +56 -0
- package/el/buttongroup/tests/minimal.html +31 -0
- package/el/buttongroup/tests/test.html +83 -0
- package/el/bytes/README.md +41 -0
- package/el/bytes/bytes.css +6 -0
- package/el/bytes/bytes.js +97 -0
- package/el/bytes/manifest.json +95 -0
- package/el/bytes/tests/minimal.html +19 -0
- package/el/bytes/tests/test.html +117 -0
- package/el/carousel/README.md +52 -0
- package/el/carousel/carousel.css +46 -0
- package/el/carousel/carousel.js +371 -0
- package/el/carousel/manifest.json +58 -0
- package/el/carousel/tests/experiments.html +77 -0
- package/el/carousel/tests/minimal.html +31 -0
- package/el/carousel/tests/nested.html +54 -0
- package/el/carousel/tests/test.html +136 -0
- package/el/carousel-nav/README.md +40 -0
- package/el/carousel-nav/carousel-nav.js +74 -0
- package/el/carousel-nav/tests/minimal.html +32 -0
- package/el/carousel-nav/tests/test.html +59 -0
- package/el/code/README.md +68 -0
- package/el/code/code.css +46 -0
- package/el/code/code.js +289 -0
- package/el/code/manifest.json +66 -0
- package/el/code/tests/minimal.html +35 -0
- package/el/code/tests/test.html +162 -0
- package/el/copy/README.md +35 -0
- package/el/copy/copy.css +3 -0
- package/el/copy/copy.js +118 -0
- package/el/copy/manifest.json +49 -0
- package/el/copy/tests/minimal.html +21 -0
- package/el/copy/tests/test.html +75 -0
- package/el/counter/README.md +47 -0
- package/el/counter/counter.css +8 -0
- package/el/counter/counter.js +95 -0
- package/el/counter/manifest.json +59 -0
- package/el/counter/tests/minimal.html +27 -0
- package/el/counter/tests/test.html +106 -0
- package/el/ico/README.md +162 -0
- package/el/ico/font/Font Awesome.css +22 -0
- package/el/ico/font/LigatureSymbols.css +7 -0
- package/el/ico/font/Material Icons.css +6 -0
- package/el/ico/font/RemixFilled.css +8 -0
- package/el/ico/font/RemixOutlined.css +8 -0
- package/el/ico/font/old/anicons.css +31 -0
- package/el/ico/font/old/devicons.css +210 -0
- package/el/ico/font/old/material.all.css +36 -0
- package/el/ico/font/old/remix.css +15 -0
- package/el/ico/font/old/utf8.css +54 -0
- package/el/ico/ico.css +111 -0
- package/el/ico/ico.js +189 -0
- package/el/ico/manifest.json +86 -0
- package/el/ico/tests/combinations.html +86 -0
- package/el/ico/tests/emojis.html +213 -0
- package/el/ico/tests/fonts.html +110 -0
- package/el/ico/tests/ico-directory.html +254 -0
- package/el/ico/tests/minimal.html +46 -0
- package/el/ico/tests/test.html +210 -0
- package/el/ico/tests/util-multi.svg +6 -0
- package/el/ico/tests/util.css +2 -0
- package/el/ico/tests/util.js +110 -0
- package/el/input/README.md +39 -0
- package/el/input/input.css +35 -0
- package/el/input/input.js +331 -0
- package/el/input/tests/formParticipation.html +113 -0
- package/el/input/tests/minimal.html +33 -0
- package/el/input/tests/test.html +258 -0
- package/el/masonry/README.md +51 -0
- package/el/masonry/manifest.json +60 -0
- package/el/masonry/masonry.css +27 -0
- package/el/masonry/masonry.js +92 -0
- package/el/masonry/tests/minimal.html +39 -0
- package/el/masonry/tests/test.html +42 -0
- package/el/number/README.md +47 -0
- package/el/number/manifest.json +121 -0
- package/el/number/number.css +6 -0
- package/el/number/number.js +67 -0
- package/el/number/tests/minimal.html +25 -0
- package/el/number/tests/test.html +138 -0
- package/el/out/README.md +32 -0
- package/el/out/manifest.json +38 -0
- package/el/out/out.css +2 -0
- package/el/out/out.js +59 -0
- package/el/out/tests/minimal.html +25 -0
- package/el/out/tests/test.html +37 -0
- package/el/parallax-bg/README.md +36 -0
- package/el/parallax-bg/parallax-bg.css +13 -0
- package/el/parallax-bg/parallax-bg.js +186 -0
- package/el/parallax-bg/tests/bg.jpg +0 -0
- package/el/parallax-bg/tests/bg1.jpg +0 -0
- package/el/parallax-bg/tests/bg2.jpg +0 -0
- package/el/parallax-bg/tests/demo.html +88 -0
- package/el/parallax-bg/tests/minimal.html +30 -0
- package/el/parallax-bg/tests/test.html +64 -0
- package/el/parallax-bg/tests/visible.html +90 -0
- package/el/qrcode/README.md +38 -0
- package/el/qrcode/manifest.json +43 -0
- package/el/qrcode/package.json +22 -0
- package/el/qrcode/qrcode.css +13 -0
- package/el/qrcode/qrcode.js +46 -0
- package/el/qrcode/tests/minimal.html +26 -0
- package/el/qrcode/tests/test.html +31 -0
- package/el/rating/README.md +45 -0
- package/el/rating/manifest.json +65 -0
- package/el/rating/rating.css +11 -0
- package/el/rating/rating.js +139 -0
- package/el/rating/tests/minimal.html +26 -0
- package/el/rating/tests/tests.html +77 -0
- package/el/rte/README.md +37 -0
- package/el/rte/rte.css +9 -0
- package/el/rte/rte.js +56 -0
- package/el/rte/tests/minimal.html +25 -0
- package/el/rte/tests/test.html +37 -0
- package/el/skeleton/README.md +30 -0
- package/el/skeleton/manifest.json +51 -0
- package/el/skeleton/skeleton.css +61 -0
- package/el/skeleton/skeleton.js +72 -0
- package/el/skeleton/tests/minimal.html +22 -0
- package/el/skeleton/tests/test.html +22 -0
- package/el/splitbutton/README.md +39 -0
- package/el/splitbutton/splitbutton.css +48 -0
- package/el/splitbutton/splitbutton.js +26 -0
- package/el/splitbutton/tests/minimal.html +30 -0
- package/el/splitbutton/tests/test.html +68 -0
- package/el/splitpanel/README.md +39 -0
- package/el/splitpanel/manifest.json +49 -0
- package/el/splitpanel/splitpanel.css +17 -0
- package/el/splitpanel/splitpanel.js +116 -0
- package/el/splitpanel/tests/minimal.html +31 -0
- package/el/splitpanel/tests/tests.html +121 -0
- package/el/table/README.md +68 -0
- package/el/table/manifest.json +43 -0
- package/el/table/table.css +59 -0
- package/el/table/table.js +194 -0
- package/el/table/tests/minimal.html +38 -0
- package/el/table/tests/test.html +108 -0
- package/el/tabs/README.md +50 -0
- package/el/tabs/manifest.json +59 -0
- package/el/tabs/tabs.css +23 -0
- package/el/tabs/tabs.js +210 -0
- package/el/tabs/tests/minimal.html +35 -0
- package/el/tabs/tests/test.html +180 -0
- package/el/textfit/README.md +34 -0
- package/el/textfit/manifest.json +45 -0
- package/el/textfit/tests/minimal.html +25 -0
- package/el/textfit/tests/test.html +26 -0
- package/el/textfit/textfit.css +6 -0
- package/el/textfit/textfit.js +80 -0
- package/el/time/README.md +72 -0
- package/el/time/manifest.json +118 -0
- package/el/time/tests/minimal.html +19 -0
- package/el/time/tests/test.html +160 -0
- package/el/time/time copy.js +141 -0
- package/el/time/time.js +168 -0
- package/el/time/time.old.uhtml.js +129 -0
- package/el/tooltip/README.md +48 -0
- package/el/tooltip/manifest.json +69 -0
- package/el/tooltip/tests/minimal.html +25 -0
- package/el/tooltip/tests/test.html +178 -0
- package/el/tooltip/tooltip.css +97 -0
- package/el/tooltip/tooltip.js +82 -0
- package/el/tree1/README.md +111 -0
- package/el/tree1/manifest.json +78 -0
- package/el/tree1/tests/animated.html +134 -0
- package/el/tree1/tests/custom.html +51 -0
- package/el/tree1/tests/minimal.html +44 -0
- package/el/tree1/tests/test.html +260 -0
- package/el/tree1/tree1.css +26 -0
- package/el/tree1/tree1.js +265 -0
- package/el/typewriter/README.md +62 -0
- package/el/typewriter/manifest.json +66 -0
- package/el/typewriter/tests/minimal.html +25 -0
- package/el/typewriter/tests/test.html +78 -0
- package/el/typewriter/typewriter.css +6 -0
- package/el/typewriter/typewriter.js +166 -0
- package/el/typewriter/typewriter.mp3 +0 -0
- package/js/Placer/Placer.js +156 -0
- package/js/Placer/README.md +62 -0
- package/js/Placer/tests/minimal.html +34 -0
- package/js/Placer/tests/test.html +49 -0
- package/js/PointerObserver/PointerObserver.js +130 -0
- package/js/PointerObserver/README.md +34 -0
- package/js/PointerObserver/tests/minimal.html +29 -0
- package/js/PointerObserver/tests/test.html +35 -0
- package/js/SelectorObserver/README.md +47 -0
- package/js/SelectorObserver/SelectorObserver.js +201 -0
- package/js/SelectorObserver/tests/minimal.html +21 -0
- package/js/SelectorObserver/tests/test.html +57 -0
- package/js/SelectorObserver/tests/tests.html +161 -0
- package/js/contextmenu/README.md +93 -0
- package/js/contextmenu/contextmenu.js +336 -0
- package/js/contextmenu/tests/minimal.html +44 -0
- package/js/contextmenu/tests/test.html +131 -0
- package/js/dialog/README.md +49 -0
- package/js/dialog/dialog.js +261 -0
- package/js/dialog/notification.mp3 +0 -0
- package/js/dialog/tests/minimal.html +29 -0
- package/js/dialog/tests/notification.mp3 +0 -0
- package/js/dialog/tests/test.html +135 -0
- package/js/rte/README.md +44 -0
- package/js/rte/old/NodeCleaner.js +315 -0
- package/js/rte/old/Rte/Rte.mjs +316 -0
- package/js/rte/old/Rte/Rte.ui.items.mjs +543 -0
- package/js/rte/old/Rte/Rte.ui.mjs +154 -0
- package/js/rte/old/Rte/crossbrowser.mjs +323 -0
- package/js/rte/old/Rte/font/tinymce.svg +98 -0
- package/js/rte/old/Rte/font/tinymce.woff +0 -0
- package/js/rte/old/Rte/helpers.mjs +159 -0
- package/js/rte/old/Rte/htmlparser.mjs +178 -0
- package/js/rte/old/Rte/index.mjs +5 -0
- package/js/rte/old/Rte/main.css +189 -0
- package/js/rte/old/old.rte.js +132 -0
- package/js/rte/old/range-selection.old.js +394 -0
- package/js/rte/rte.js +7 -0
- package/js/rte/src/behavior.js +228 -0
- package/js/rte/src/events.js +73 -0
- package/js/rte/src/fixes.js +251 -0
- package/js/rte/src/range.js +472 -0
- package/js/rte/src/rte.js +72 -0
- package/js/rte/src/ui/items/ai.js +167 -0
- package/js/rte/src/ui/items/code.js +93 -0
- package/js/rte/src/ui/items/undo.js +183 -0
- package/js/rte/src/ui.items.js +571 -0
- package/js/rte/src/ui.js +269 -0
- package/js/rte/src/util/htmlparser.js +178 -0
- package/js/rte/src/util/indentHtml.js +48 -0
- package/js/rte/tests/ai.html +81 -0
- package/js/rte/tests/behavior.html +88 -0
- package/js/rte/tests/events.html +69 -0
- package/js/rte/tests/fixes.html +95 -0
- package/js/rte/tests/minimal.html +34 -0
- package/js/rte/tests/notes.md +6 -0
- package/js/rte/tests/range.html +167 -0
- package/js/rte/tests/selection-explorer.html +222 -0
- package/js/rte/tests/test.html +92 -0
- package/js/shortcut/README.md +33 -0
- package/js/shortcut/shortcut.js +89 -0
- package/js/shortcut/tests/minimal.html +23 -0
- package/js/shortcut/tests/test.html +68 -0
- package/package.json +12 -0
- package/u2/README.md +4 -0
- package/u2/auto.js +161 -0
- package/u2/auto.ui.js +85 -0
- package/u2/experiments/Waiter/test.html +132 -0
- package/u2/experiments/getElementByIdPromise/test.html +76 -0
- package/u2/experiments/patchInputValue.html +124 -0
- package/u2/experiments/radiobutton/test.html +75 -0
- package/u2/experiments/tests/test.html +223 -0
- package/u2/experiments/u1-responsive/responsive.js +62 -0
- package/u2/experiments/u1-responsive/test.html +65 -0
- package/u2/experiments/u2Element.js +139 -0
- package/u2/experiments/u2Element.test.html +47 -0
- package/u2/old-stuff/IterableWeakMap/mod.js +70 -0
- package/u2/old-stuff/css/onStyleSheet/mod.js +114 -0
- package/u2/old-stuff/css/onStyleSheet/monkeypatches.js +28 -0
- package/u2/old-stuff/css/onStyleSheet/test/include.css +19 -0
- package/u2/old-stuff/css/onStyleSheet/test/style-has-include.css +6 -0
- package/u2/old-stuff/css/onStyleSheet/test/style-no-include.css +3 -0
- package/u2/old-stuff/css/onStyleSheet/test/test.html +48 -0
- package/u2/old-stuff/css/parser/mod.js +182 -0
- package/u2/old-stuff/css/parser/parser_old/mod.js +128 -0
- package/u2/old-stuff/css/parser/parser_old/test.html +43 -0
- package/u2/old-stuff/css/parser/parser_old/util.js +22 -0
- package/u2/old-stuff/css/parser/style.html +52 -0
- package/u2/old-stuff/css/parser/test.html +38 -0
- package/u2/old-stuff/el/ai-texter/README.md +23 -0
- package/u2/old-stuff/el/ai-texter/ai-texter.css +12 -0
- package/u2/old-stuff/el/ai-texter/ai-texter.js +153 -0
- package/u2/old-stuff/el/ai-texter/tests/minimal.html +47 -0
- package/u2/old-stuff/el/ai-texter/tests/test.html +71 -0
- package/u2/old-stuff/init.js +38 -0
- package/u2/old-stuff/markHashLinks.js +51 -0
- package/u2/old-stuff/onElement/mod.js +73 -0
- package/u2/old-stuff/test-helpers/mod.js +36 -0
- package/u2/old-stuff/test-helpers/test.html +4 -0
- package/u2/old-stuff/tests/init.js.html +51 -0
- package/u2/old-stuff/viewport.js +64 -0
- package/u2/projects.json +468 -0
- package/u2/tests/boilerplate.html +46 -0
- package/u2/tests/kacheln.html +245 -0
- package/u2/tests/showcase.html +270 -0
- package/u2/tests/showcase2.html +157 -0
- package/u2/tests/test-init.js +35 -0
- package/u2/tests/test.html +355 -0
- package/u2/tools/baseElement.js +95 -0
- package/u2/tools/baseElement.test.html +119 -0
- package/u2/tools/ce-inspector.js +308 -0
- package/u2/tools/ce-inspector.test.html +66 -0
- package/u2/tools/ce-manfest-from-element.js +207 -0
- package/u2/tools/dev-iframe.js +213 -0
- package/u2/tools/dev-iframe.test.html +75 -0
- package/u2/tools/eventsExplorer.js +101 -0
- package/u2/tools/logo/u1.svg +9 -0
- package/u2/tools/logo/u1ui.svg +6 -0
- package/u2/tools/update.repos.json.js +234 -0
- package/u2/u2.js +14 -0
- package/u2/utils.js +59 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
:is(u2-skeleton, #strong) {
|
|
2
|
+
display:block;
|
|
3
|
+
opacity:1 !important;
|
|
4
|
+
--u2-skeleton-color: #f0f0f0;
|
|
5
|
+
color: var(--u2-skeleton-color);
|
|
6
|
+
|
|
7
|
+
--darker: color-mix(in srgb, var(--u2-skeleton-color), black 5%);
|
|
8
|
+
--lighter: color-mix(in srgb, var(--u2-skeleton-color), white 20%);
|
|
9
|
+
--bg: repeating-linear-gradient(45deg, var(--darker), var(--lighter), var(--darker) 50%) 0% 0% / 100px 100px repeat fixed;
|
|
10
|
+
--animation: skeleton-bg 17s linear infinite;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
& span, :is(p,td,th,button,h1,h2,h3,h4,h5,h6):empty::before {
|
|
14
|
+
content: "text text";
|
|
15
|
+
display:inline;
|
|
16
|
+
-webkit-box-decoration-break: clone;
|
|
17
|
+
box-decoration-break: clone;
|
|
18
|
+
|
|
19
|
+
background: var(--bg);
|
|
20
|
+
animation: var(--animation);
|
|
21
|
+
|
|
22
|
+
color: transparent;
|
|
23
|
+
}
|
|
24
|
+
& :is(h1,h2,h3,h4,h5,h6):empty::before {
|
|
25
|
+
content: "Lorem ipsum dolor sit amet";
|
|
26
|
+
}
|
|
27
|
+
& p:empty::before {
|
|
28
|
+
content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in turpis auctor, lacinia nunc nec, ultricies nunc.";
|
|
29
|
+
}
|
|
30
|
+
& :is(th, td):empty::before {
|
|
31
|
+
content: "Some text";
|
|
32
|
+
}
|
|
33
|
+
& button:empty::before {
|
|
34
|
+
content: "Button";
|
|
35
|
+
background: var(--bg);
|
|
36
|
+
animation: var(--animation);
|
|
37
|
+
}
|
|
38
|
+
& img {
|
|
39
|
+
border:0;
|
|
40
|
+
width: 20em;
|
|
41
|
+
aspect-ratio: 3/2;
|
|
42
|
+
background: var(--bg);
|
|
43
|
+
animation: var(--animation);
|
|
44
|
+
}
|
|
45
|
+
& button {
|
|
46
|
+
background: var(--bg);
|
|
47
|
+
animation: var(--animation);
|
|
48
|
+
border: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@keyframes skeleton-bg {
|
|
55
|
+
0% {
|
|
56
|
+
background-position: 0% 0%;
|
|
57
|
+
}
|
|
58
|
+
100% {
|
|
59
|
+
background-position: 100% 0%;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
|
|
2
|
+
class skeleton extends HTMLElement {
|
|
3
|
+
constructor() {
|
|
4
|
+
super();
|
|
5
|
+
}
|
|
6
|
+
connectedCallback() {
|
|
7
|
+
this.render();
|
|
8
|
+
this.inert = true;
|
|
9
|
+
}
|
|
10
|
+
render() {
|
|
11
|
+
const template = this.getAttribute('template');
|
|
12
|
+
requestAnimationFrame(() => {
|
|
13
|
+
this.innerHTML = templateToHtml(template)
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
static get observedAttributes() {
|
|
17
|
+
return ['template'];
|
|
18
|
+
}
|
|
19
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
20
|
+
if (oldValue === newValue) return;
|
|
21
|
+
this.render();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
customElements.define('u2-skeleton', skeleton);
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
function templateToHtml(template) {
|
|
32
|
+
let placeholderHTML = '';
|
|
33
|
+
const elements = template.split(' ');
|
|
34
|
+
elements.forEach(element => {
|
|
35
|
+
let [tagName, options] = element.split('(');
|
|
36
|
+
options = options ? options.slice(0, -1) : '';
|
|
37
|
+
|
|
38
|
+
if (tagName === '-') {
|
|
39
|
+
placeholderHTML += '<span style="flex-grow:1;"><s hidden></s></span>';
|
|
40
|
+
} else if (tagName === 'table') {
|
|
41
|
+
const [rows, cols] = options.split('x');
|
|
42
|
+
placeholderHTML += '<table>';
|
|
43
|
+
for (let i = 0; i < parseInt(rows); i++) {
|
|
44
|
+
placeholderHTML += '<tr>';
|
|
45
|
+
for (let j = 0; j < parseInt(cols); j++) {
|
|
46
|
+
placeholderHTML += '<td></td>';
|
|
47
|
+
}
|
|
48
|
+
placeholderHTML += '</tr>';
|
|
49
|
+
}
|
|
50
|
+
placeholderHTML += '</table>';
|
|
51
|
+
} else {
|
|
52
|
+
placeholderHTML += `<${tagName}></${tagName}>`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
placeholderHTML += '';
|
|
58
|
+
return placeholderHTML;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
// usage:
|
|
65
|
+
// <u2-skeleton>
|
|
66
|
+
// h2
|
|
67
|
+
// img p
|
|
68
|
+
// p
|
|
69
|
+
// p
|
|
70
|
+
// table(4,6)
|
|
71
|
+
// - button button
|
|
72
|
+
// </u2-skeleton>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang=en>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset=utf-8>
|
|
5
|
+
<meta name=viewport content="width=device-width">
|
|
6
|
+
<!-- <script src="../../../u2/tests/test-init.js" type=module async></script> -->
|
|
7
|
+
|
|
8
|
+
<link rel=stylesheet href="../../../css/classless/full.css">
|
|
9
|
+
<link rel=stylesheet href="../../../css/classless/aria.css">
|
|
10
|
+
<link rel=stylesheet href="../../../css/classless/simple.css">
|
|
11
|
+
|
|
12
|
+
<script src="../skeleton.js" type=module async></script>
|
|
13
|
+
<link href="../skeleton.css" rel=stylesheet>
|
|
14
|
+
|
|
15
|
+
<body>
|
|
16
|
+
|
|
17
|
+
<section class="main">
|
|
18
|
+
<u2-skeleton template="p table(2x3)"></u2-skeleton>
|
|
19
|
+
</section>
|
|
20
|
+
|
|
21
|
+
<style class="main">
|
|
22
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang=en>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset=utf-8>
|
|
5
|
+
<meta name=viewport content="width=device-width">
|
|
6
|
+
<!-- <script src="../../../u2/tests/test-init.js" type=module async></script> -->
|
|
7
|
+
|
|
8
|
+
<link rel=stylesheet href="../../../css/classless/full.css">
|
|
9
|
+
<link rel=stylesheet href="../../../css/classless/aria.css">
|
|
10
|
+
<link rel=stylesheet href="../../../css/classless/simple.css">
|
|
11
|
+
|
|
12
|
+
<script src="../skeleton.js" type=module async></script>
|
|
13
|
+
<link href="../skeleton.css" rel=stylesheet>
|
|
14
|
+
|
|
15
|
+
<body>
|
|
16
|
+
|
|
17
|
+
<section class="main">
|
|
18
|
+
<u2-skeleton template="h1 p h2 img p p table(4x7) button button"></u2-skeleton>
|
|
19
|
+
</section>
|
|
20
|
+
|
|
21
|
+
<style class="main">
|
|
22
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# <u2-splitbutton> - element
|
|
2
|
+
Buttons with options
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
|
|
6
|
+
```html
|
|
7
|
+
<u2-splitbutton>
|
|
8
|
+
<button>Add Item</button>
|
|
9
|
+
<menu>
|
|
10
|
+
<li><button>Special Item</button>
|
|
11
|
+
<li><button>Super Item</button>
|
|
12
|
+
</menu>
|
|
13
|
+
</u2-splitbutton>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```css
|
|
17
|
+
u2-splitbutton menu {
|
|
18
|
+
box-shadow:var(--shadow);
|
|
19
|
+
border:none;
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<link href="https://cdn.jsdelivr.net/gh/u2ui/u2@x.x.x/el/splitbutton/splitbutton.min.css" rel=stylesheet>
|
|
27
|
+
<script src="https://cdn.jsdelivr.net/gh/u2ui/u2@x.x.x/el/splitbutton/splitbutton.min.js" type=module async></script>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Demos
|
|
31
|
+
|
|
32
|
+
[minimal.html](http://gcdn.li/u2ui/u2@main/el/splitbutton/tests/minimal.html)
|
|
33
|
+
[test.html](http://gcdn.li/u2ui/u2@main/el/splitbutton/tests/test.html)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## About
|
|
37
|
+
|
|
38
|
+
- MIT License, Copyright (c) 2022 <u2> (like all repositories in this organization) <br>
|
|
39
|
+
- Suggestions, ideas, finding bugs and making pull requests make us very happy. ♥
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* functional styles */
|
|
2
|
+
u2-splitbutton {
|
|
3
|
+
position:relative;
|
|
4
|
+
display:inline-block;
|
|
5
|
+
}
|
|
6
|
+
u2-splitbutton menu {
|
|
7
|
+
position:absolute;
|
|
8
|
+
z-index:1;
|
|
9
|
+
isolation: isolate;
|
|
10
|
+
top:calc(100% + .4rem);
|
|
11
|
+
right:0;
|
|
12
|
+
width:max-content;
|
|
13
|
+
margin:0;
|
|
14
|
+
padding:.4em;
|
|
15
|
+
opacity:0;
|
|
16
|
+
visibility: hidden;
|
|
17
|
+
transition: all .2s .1s;
|
|
18
|
+
}
|
|
19
|
+
u2-splitbutton menu > li {
|
|
20
|
+
list-style:none;
|
|
21
|
+
margin:0;
|
|
22
|
+
padding:.05em;
|
|
23
|
+
}
|
|
24
|
+
u2-splitbutton menu > li > button {
|
|
25
|
+
width:100%;
|
|
26
|
+
margin:0;
|
|
27
|
+
text-align:left;
|
|
28
|
+
}
|
|
29
|
+
u2-splitbutton :is(:hover, :focus) + menu,
|
|
30
|
+
u2-splitbutton menu:is(:hover, :focus-within) {
|
|
31
|
+
opacity:1;
|
|
32
|
+
visibility: visible;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* minimal styled */
|
|
36
|
+
u2-splitbutton menu {
|
|
37
|
+
background:var(--color-bg, Canvas);
|
|
38
|
+
border: 1px solid var(--color-text, CanvasText);
|
|
39
|
+
border-radius: calc(var(--radius) + 2px);
|
|
40
|
+
}
|
|
41
|
+
u2-splitbutton menu hr {
|
|
42
|
+
margin:.2em 0;
|
|
43
|
+
}
|
|
44
|
+
u2-splitbutton menu button:not(:focus, :hover) {
|
|
45
|
+
background-color:transparent;
|
|
46
|
+
color: var(--color-text, CanvasText);
|
|
47
|
+
}
|
|
48
|
+
/* */
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class splitbutton extends HTMLElement {
|
|
2
|
+
constructor() {
|
|
3
|
+
super();
|
|
4
|
+
}
|
|
5
|
+
connectedCallback() {
|
|
6
|
+
setTimeout(async () => {
|
|
7
|
+
import('../../attr/focusgroup/focusgroup.js');
|
|
8
|
+
|
|
9
|
+
const menu = this.querySelector('menu');
|
|
10
|
+
//menu.slot = 'menu';
|
|
11
|
+
menu.role = 'menu';
|
|
12
|
+
menu.setAttribute('u2-focusgroup', 'remember');
|
|
13
|
+
//menu.setAttribute('popover', 'manual');
|
|
14
|
+
// set id if hat not
|
|
15
|
+
if (!menu.id) {
|
|
16
|
+
menu.id = 'menu' + Math.random().toString().slice(2);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const button = this.querySelector('button');
|
|
20
|
+
button.setAttribute('popovertarget', menu.id);
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
}, 0);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
customElements.define('u2-splitbutton', splitbutton);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang=en>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset=utf-8>
|
|
5
|
+
<meta name=viewport content="width=device-width">
|
|
6
|
+
|
|
7
|
+
<link rel=stylesheet href="../../../css/classless/full.css">
|
|
8
|
+
<link rel=stylesheet href="../../../css/classless/simple.css">
|
|
9
|
+
|
|
10
|
+
<link rel=stylesheet href="../splitbutton.css">
|
|
11
|
+
<script src="../splitbutton.js" type=module async></script>
|
|
12
|
+
|
|
13
|
+
<body>
|
|
14
|
+
|
|
15
|
+
<section class="main">
|
|
16
|
+
<u2-splitbutton>
|
|
17
|
+
<button>Add Item</button>
|
|
18
|
+
<menu>
|
|
19
|
+
<li><button>Special Item</button>
|
|
20
|
+
<li><button>Super Item</button>
|
|
21
|
+
</menu>
|
|
22
|
+
</u2-splitbutton>
|
|
23
|
+
</section>
|
|
24
|
+
|
|
25
|
+
<style class="main">
|
|
26
|
+
u2-splitbutton menu {
|
|
27
|
+
box-shadow:var(--shadow);
|
|
28
|
+
border:none;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang=en>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name=viewport content="width=device-width">
|
|
6
|
+
<title>Test</title>
|
|
7
|
+
|
|
8
|
+
<link rel=stylesheet href="../../../css/classless/full.css">
|
|
9
|
+
<link rel=stylesheet href="../../../css/classless/simple.css">
|
|
10
|
+
|
|
11
|
+
<script src="../../../u2/auto.js" type=module async></script>
|
|
12
|
+
|
|
13
|
+
<link rel=stylesheet href="../splitbutton.css">
|
|
14
|
+
<script src="../splitbutton.js" type=module async></script>
|
|
15
|
+
|
|
16
|
+
<style>
|
|
17
|
+
body {
|
|
18
|
+
--u2-ico-dir:'https://cdn.jsdelivr.net/npm/@material-icons/svg@1.0.11/svg/{icon}/baseline.svg';
|
|
19
|
+
}
|
|
20
|
+
</style>
|
|
21
|
+
|
|
22
|
+
</head>
|
|
23
|
+
|
|
24
|
+
<body>
|
|
25
|
+
|
|
26
|
+
<header>
|
|
27
|
+
<h1>u2-splitbutton test</h1>
|
|
28
|
+
</header>
|
|
29
|
+
|
|
30
|
+
<section>
|
|
31
|
+
<u2-splitbutton>
|
|
32
|
+
<button>Add Item ▾</button>
|
|
33
|
+
<menu>
|
|
34
|
+
<li><button>Special Item</button>
|
|
35
|
+
<li><button>Super Item</button>
|
|
36
|
+
</menu>
|
|
37
|
+
</u2-splitbutton>
|
|
38
|
+
<button>
|
|
39
|
+
normal button for reference
|
|
40
|
+
</button>
|
|
41
|
+
</section>
|
|
42
|
+
|
|
43
|
+
<article>
|
|
44
|
+
<u2-splitbutton>
|
|
45
|
+
<button>
|
|
46
|
+
<u2-ico inline>home</u2-ico>
|
|
47
|
+
Add
|
|
48
|
+
</button>
|
|
49
|
+
<menu>
|
|
50
|
+
<li> <button>Domain</button>
|
|
51
|
+
<li> <button>Subdomain</button>
|
|
52
|
+
<li> <button>Alias Domain</button>
|
|
53
|
+
<li> <hr>
|
|
54
|
+
<li> <button>Remove</button>
|
|
55
|
+
<li> <button>Remove All</button>
|
|
56
|
+
</menu>
|
|
57
|
+
</u2-splitbutton>
|
|
58
|
+
</article>
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
<style style="display: block" contenteditable>u2-splitbutton menu {
|
|
62
|
+
box-shadow: 0 0 1rem #0008;
|
|
63
|
+
border:none;
|
|
64
|
+
}
|
|
65
|
+
u2-splitbutton menu button {
|
|
66
|
+
text-align:left;
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# <u2-splitpanel> - element
|
|
2
|
+
A splitpanel is a container that can be split horizontally or vertically. It is a simple container that can be used to split the screen into two or more parts.
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
|
|
6
|
+
```html
|
|
7
|
+
<u2-splitpanel style="height:100%">
|
|
8
|
+
<div>splitpanel</div>
|
|
9
|
+
<u2-splitpanel vertical>
|
|
10
|
+
<div>splitpanel</div>
|
|
11
|
+
<div>splitpanel</div>
|
|
12
|
+
</u2-splitpanel>
|
|
13
|
+
</u2-splitpanel>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```css
|
|
17
|
+
u2-splitpanel > :not(u2-splitpanel) {
|
|
18
|
+
padding:1rem;
|
|
19
|
+
background: #f8f8f8;
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<link href="https://cdn.jsdelivr.net/gh/u2ui/u2@x.x.x/el/splitpanel/splitpanel.min.css" rel=stylesheet>
|
|
27
|
+
<script src="https://cdn.jsdelivr.net/gh/u2ui/u2@x.x.x/el/splitpanel/splitpanel.min.js" type=module async></script>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Demos
|
|
31
|
+
|
|
32
|
+
[minimal.html](http://gcdn.li/u2ui/u2@main/el/splitpanel/tests/minimal.html)
|
|
33
|
+
[tests.html](http://gcdn.li/u2ui/u2@main/el/splitpanel/tests/tests.html)
|
|
34
|
+
|
|
35
|
+
## About
|
|
36
|
+
|
|
37
|
+
- MIT License, Copyright (c) 2022 <u2> (like all repositories in this organization) <br>
|
|
38
|
+
- Suggestions, ideas, finding bugs and making pull requests make us very happy. ♥
|
|
39
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "README.md",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "splitpanel.js",
|
|
8
|
+
"declarations": [
|
|
9
|
+
{
|
|
10
|
+
"kind": "class",
|
|
11
|
+
"description": "A container that splits its children horizontally or vertically and makes them resizable.",
|
|
12
|
+
"name": "u2splitpanel",
|
|
13
|
+
"members": [],
|
|
14
|
+
"events": [],
|
|
15
|
+
"attributes": [
|
|
16
|
+
{
|
|
17
|
+
"name": "vertical",
|
|
18
|
+
"u2-type": "boolean",
|
|
19
|
+
"description": "If true, the children are split vertically."
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"cssProperties": [],
|
|
23
|
+
"cssParts": [
|
|
24
|
+
{
|
|
25
|
+
"name": "divider",
|
|
26
|
+
"description": "The divider between the children. The width (horizontal) or height (vertical) can be set using `--size`."
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"superclass": {
|
|
30
|
+
"name": "HTMLElement"
|
|
31
|
+
},
|
|
32
|
+
"tagName": "u2-splitpanel",
|
|
33
|
+
"customElement": true
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"exports": [
|
|
37
|
+
{
|
|
38
|
+
"kind": "custom-element-definition",
|
|
39
|
+
"name": "u2-splitpanel",
|
|
40
|
+
"declaration": {
|
|
41
|
+
"name": "u2splitpanel",
|
|
42
|
+
"module": "splitpanel.js"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
u2-splitpanel {
|
|
2
|
+
display:flex;
|
|
3
|
+
contain: strict; /* performance? */
|
|
4
|
+
}
|
|
5
|
+
u2-splitpanel > * {
|
|
6
|
+
overflow: auto;
|
|
7
|
+
flex:1 1 auto;
|
|
8
|
+
resize: horizontal;
|
|
9
|
+
position:relative;
|
|
10
|
+
}
|
|
11
|
+
u2-splitpanel[vertical] {
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
& > * { resize: vertical; }
|
|
14
|
+
}
|
|
15
|
+
u2-splitpanel:defined > * {
|
|
16
|
+
resize: none !important;
|
|
17
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
|
|
2
|
+
class splitpanel extends HTMLElement {
|
|
3
|
+
constructor() {
|
|
4
|
+
super();
|
|
5
|
+
|
|
6
|
+
this.attachShadow({mode: 'open'});
|
|
7
|
+
this.shadowRoot.innerHTML = `
|
|
8
|
+
<style>
|
|
9
|
+
#slots {
|
|
10
|
+
display: contents;
|
|
11
|
+
}
|
|
12
|
+
#slots > :is(:first-child, :last-child) {
|
|
13
|
+
display: none;
|
|
14
|
+
}
|
|
15
|
+
[role=separator] {
|
|
16
|
+
display:flex;
|
|
17
|
+
align-items:center;
|
|
18
|
+
justify-content:center;
|
|
19
|
+
position:relative;
|
|
20
|
+
--size: .3em;
|
|
21
|
+
min-height: var(--size);
|
|
22
|
+
min-width: var(--size);
|
|
23
|
+
flex: 0 0 auto;
|
|
24
|
+
background: #ccc;
|
|
25
|
+
cursor: col-resize;
|
|
26
|
+
z-index:1;
|
|
27
|
+
touch-action: none;
|
|
28
|
+
}
|
|
29
|
+
[role=separator]:hover {
|
|
30
|
+
z-index:2;
|
|
31
|
+
}
|
|
32
|
+
:host([vertical]) [role=separator] {
|
|
33
|
+
cursor: row-resize;
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
36
|
+
<div id=slots></div>
|
|
37
|
+
`;
|
|
38
|
+
this.slotsEl = this.shadowRoot.getElementById('slots');
|
|
39
|
+
|
|
40
|
+
this.shadowRoot.addEventListener('pointerdown', (event) => {
|
|
41
|
+
if (!event.target.part.contains('divider')) return;
|
|
42
|
+
this.isDragging = true;
|
|
43
|
+
this.draggingDivider = event.target;
|
|
44
|
+
this.draggingDivider.setPointerCapture(event.pointerId);
|
|
45
|
+
this.previousPanel = this.draggingDivider.previousElementSibling.assignedNodes()[0];
|
|
46
|
+
this.nextPanel = this.draggingDivider.nextElementSibling.assignedNodes()[0];
|
|
47
|
+
|
|
48
|
+
// set flex-basis for all children
|
|
49
|
+
const children = [...this.children];
|
|
50
|
+
let total = 0;
|
|
51
|
+
children.forEach((child) => {
|
|
52
|
+
const size = this.hasAttribute('vertical') ? child.clientHeight : child.clientWidth;
|
|
53
|
+
total += size;
|
|
54
|
+
requestAnimationFrame(() => {
|
|
55
|
+
child.style.flexBasis = `${size / total * 100}%`;
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
this.shadowRoot.addEventListener('pointermove', (event) => {
|
|
62
|
+
if (!this.isDragging) return;
|
|
63
|
+
const rect = this.getBoundingClientRect();
|
|
64
|
+
const position = this.hasAttribute('vertical') ? event.clientY - rect.top : event.clientX - rect.left;
|
|
65
|
+
const previousSize = this.hasAttribute('vertical') ? this.previousPanel.clientHeight : this.previousPanel.clientWidth;
|
|
66
|
+
const nextSize = this.hasAttribute('vertical') ? this.nextPanel.clientHeight : this.nextPanel.clientWidth;
|
|
67
|
+
const totalSize = previousSize + nextSize;
|
|
68
|
+
const totalPercentage = parseFloat(this.previousPanel.style.flexBasis) + parseFloat(this.nextPanel.style.flexBasis);
|
|
69
|
+
|
|
70
|
+
const newPreviousSize = position - (this.previousPanel.getBoundingClientRect()[this.hasAttribute('vertical') ? 'top' : 'left'] - rect[this.hasAttribute('vertical') ? 'top' : 'left']);
|
|
71
|
+
const newNextSize = totalSize - newPreviousSize;
|
|
72
|
+
|
|
73
|
+
const prevPercent = newPreviousSize / totalSize * totalPercentage;
|
|
74
|
+
const nextPercent = newNextSize / totalSize * totalPercentage;
|
|
75
|
+
|
|
76
|
+
this.previousPanel.style.flexBasis = `${prevPercent.toFixed(2)}%`;
|
|
77
|
+
this.nextPanel.style.flexBasis = `${nextPercent.toFixed(2)}%`;
|
|
78
|
+
|
|
79
|
+
});
|
|
80
|
+
this.shadowRoot.addEventListener('pointerup', () => {
|
|
81
|
+
this.isDragging = false;
|
|
82
|
+
});
|
|
83
|
+
this.shadowRoot.addEventListener('lostpointercapture', () => {
|
|
84
|
+
this.isDragging = false;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
this.observer = new MutationObserver(mutations => {
|
|
89
|
+
mutations.forEach(mutation => {
|
|
90
|
+
if (mutation.type === 'childList') {
|
|
91
|
+
this.assignChildren();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
connectedCallback() {
|
|
98
|
+
// create a slot for each child and direct that child to the slot
|
|
99
|
+
this.assignChildren();
|
|
100
|
+
this.observer.observe(this, {childList: true});
|
|
101
|
+
}
|
|
102
|
+
disconnectedCallback() {
|
|
103
|
+
this.observer.disconnect();
|
|
104
|
+
}
|
|
105
|
+
assignChildren() {
|
|
106
|
+
let html = '<div role="separator" part="divider" class="divider-0"></div>';
|
|
107
|
+
[...this.children].forEach((child, index) => {
|
|
108
|
+
const nr = index + 1;
|
|
109
|
+
child.slot = nr;
|
|
110
|
+
html += `<slot name="${nr}"></slot><div role="separator" part="divider" class="divider-${nr}"></div>`;
|
|
111
|
+
});
|
|
112
|
+
this.slotsEl.innerHTML = html;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
customElements.define('u2-splitpanel', splitpanel);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang=en>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset=utf-8>
|
|
5
|
+
<meta name=viewport content="width=device-width">
|
|
6
|
+
<title>test</title>
|
|
7
|
+
|
|
8
|
+
<link rel=stylesheet href="../../../css/classless/full.css">
|
|
9
|
+
<link rel=stylesheet href="../../../css/classless/simple.css">
|
|
10
|
+
|
|
11
|
+
<link href="../splitpanel.css" rel=stylesheet>
|
|
12
|
+
<script src="../splitpanel.js" type=module async></script>
|
|
13
|
+
|
|
14
|
+
<body>
|
|
15
|
+
|
|
16
|
+
<section class="main" style="min-height:70vh">
|
|
17
|
+
<u2-splitpanel style="height:100%">
|
|
18
|
+
<div>splitpanel</div>
|
|
19
|
+
<u2-splitpanel vertical>
|
|
20
|
+
<div>splitpanel</div>
|
|
21
|
+
<div>splitpanel</div>
|
|
22
|
+
</u2-splitpanel>
|
|
23
|
+
</u2-splitpanel>
|
|
24
|
+
</section>
|
|
25
|
+
|
|
26
|
+
<style class="main">
|
|
27
|
+
u2-splitpanel > :not(u2-splitpanel) {
|
|
28
|
+
padding:1rem;
|
|
29
|
+
background: #f8f8f8;
|
|
30
|
+
}
|
|
31
|
+
</style>
|