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,308 @@
|
|
|
1
|
+
import '../../el/code/code.js';
|
|
2
|
+
import '../../el/tabs/tabs.js';
|
|
3
|
+
import '../../attr/confirm/confirm.js';
|
|
4
|
+
import {EventsExplorer} from './eventsExplorer.js';
|
|
5
|
+
import {dump, domRender} from 'https://cdn.jsdelivr.net/gh/nuxodin/dump.js@main/mod.min.js';
|
|
6
|
+
|
|
7
|
+
const baseCss = import.meta.resolve('../../css/classless/full.css');
|
|
8
|
+
const codeCss = import.meta.resolve('../../el/code/code.css');
|
|
9
|
+
const tabsCss = import.meta.resolve('../../el/tabs/tabs.css');
|
|
10
|
+
const tableCss = import.meta.resolve('../../class/table/table.css');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
import {attributes} from 'https://cdn.jsdelivr.net/gh/nuxodin/item.js@main/drivers/htmlElementAttributes.js';
|
|
14
|
+
import {effect} from 'https://cdn.jsdelivr.net/gh/nuxodin/item.js@main/item.js';
|
|
15
|
+
import {render, html, htmlFor} from 'https://unpkg.com/uhtml@4.4.7/keyed.js';
|
|
16
|
+
|
|
17
|
+
class CeInspector extends HTMLElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
const shadow = this.attachShadow({ mode: 'open' });
|
|
21
|
+
|
|
22
|
+
shadow.innerHTML =
|
|
23
|
+
`<style>
|
|
24
|
+
@import "${baseCss}";
|
|
25
|
+
@import "${tabsCss}";
|
|
26
|
+
@import "${codeCss}";
|
|
27
|
+
@import "${tableCss}";
|
|
28
|
+
u2-code {
|
|
29
|
+
font-size:13px;
|
|
30
|
+
}
|
|
31
|
+
slot {
|
|
32
|
+
padding: 1em;
|
|
33
|
+
box-shadow: 0 0 1em rgba(0,0,0,.1);
|
|
34
|
+
display: grid;
|
|
35
|
+
align-items: center;
|
|
36
|
+
text-align:center;
|
|
37
|
+
min-height: 10rem;
|
|
38
|
+
margin-bottom: 2rem;
|
|
39
|
+
position:relative;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
42
|
+
<slot></slot>
|
|
43
|
+
<u2-tabs>
|
|
44
|
+
<h2>Contents (HTML)</h2>
|
|
45
|
+
<u2-code id=code trim editable></u2-code>
|
|
46
|
+
<h2>Attributes</h2>
|
|
47
|
+
<div>
|
|
48
|
+
<table class="u2-table -Flex -NoSideGaps -Fields">
|
|
49
|
+
<tbody id=attributes>
|
|
50
|
+
</table>
|
|
51
|
+
</div>
|
|
52
|
+
<h2>CSS Variables</h2>
|
|
53
|
+
<form>
|
|
54
|
+
<table class="u2-table -Flex -NoSideGaps -Fields">
|
|
55
|
+
<tbody id=cssProperties>
|
|
56
|
+
</table>
|
|
57
|
+
</form>
|
|
58
|
+
<h2>CSS Parts</h2>
|
|
59
|
+
<form>
|
|
60
|
+
<table class="u2-table -Flex -NoSideGaps -Fields">
|
|
61
|
+
<tbody id=cssParts>
|
|
62
|
+
</table>
|
|
63
|
+
</form>
|
|
64
|
+
</div>
|
|
65
|
+
<h2>Events</h2>
|
|
66
|
+
<div id=events></div>
|
|
67
|
+
</u2-tabs>
|
|
68
|
+
`;
|
|
69
|
+
this.createUi();
|
|
70
|
+
}
|
|
71
|
+
async createUi() {
|
|
72
|
+
const manifest = await this.manifest();
|
|
73
|
+
const shadow = this.shadowRoot;
|
|
74
|
+
|
|
75
|
+
const ce = this._element;
|
|
76
|
+
|
|
77
|
+
/* code */
|
|
78
|
+
const codeEl = shadow.getElementById('code');
|
|
79
|
+
codeEl.value = ce.innerHTML;
|
|
80
|
+
codeEl.setForeignElement(ce);
|
|
81
|
+
|
|
82
|
+
/* events */
|
|
83
|
+
const eventsEl = shadow.getElementById('events');
|
|
84
|
+
const events = manifest.modules[0].declarations[0].events?.map(e => e.name);
|
|
85
|
+
eventsEl.closest('u2-tabs > *').previousElementSibling.hidden = !events?.length;
|
|
86
|
+
if (events?.length) {
|
|
87
|
+
const eExplorer = new EventsExplorer(eventsEl, ce, events);
|
|
88
|
+
eExplorer.start();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* data */
|
|
92
|
+
// const dataEl = shadow.getElementById('data');
|
|
93
|
+
// dataEl.innerHTML = dump(ce, {depth:2, xcustomRender:domRender, inherited:false});
|
|
94
|
+
|
|
95
|
+
/* attributes */
|
|
96
|
+
const attributesEl = shadow.getElementById('attributes');
|
|
97
|
+
const attrSchemes = manifest.modules[0].declarations[0].attributes;
|
|
98
|
+
const root = attributes(ce);
|
|
99
|
+
attrSchemes.push({
|
|
100
|
+
name: 'style',
|
|
101
|
+
description: 'Inline style',
|
|
102
|
+
});
|
|
103
|
+
attrSchemes.forEach(attr => {
|
|
104
|
+
const {input,datalist} = toInput(attr);
|
|
105
|
+
input.oninput = ({target}) => {
|
|
106
|
+
if (target.type === 'checkbox' && !target.checked) {
|
|
107
|
+
root.item(attr.name).remove();
|
|
108
|
+
} else {
|
|
109
|
+
root.item(attr.name).set(target.value);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
attr.input = input;
|
|
113
|
+
attr.datalist = datalist;
|
|
114
|
+
});
|
|
115
|
+
effect(() => {
|
|
116
|
+
render(attributesEl, html`
|
|
117
|
+
${attrSchemes.map(attr => {
|
|
118
|
+
const item = root.item(attr.name);
|
|
119
|
+
console.log(item.value)
|
|
120
|
+
//attr.input.value = item.value ?? null;
|
|
121
|
+
if (attr.input.type==='checkbox') {
|
|
122
|
+
attr.input.checked = item.value !== null;
|
|
123
|
+
} else {
|
|
124
|
+
attr.input.value = item.value ?? '';
|
|
125
|
+
}
|
|
126
|
+
return html`
|
|
127
|
+
<tr>
|
|
128
|
+
<td style="flex-basis:15rem; flex-grow:4">
|
|
129
|
+
${item.key}
|
|
130
|
+
<br><small>${attr?.description ?? ''}</small>
|
|
131
|
+
<td style="flex-basis:9rem">
|
|
132
|
+
${attr.input} ${attr.datalist}
|
|
133
|
+
${/*<td style="flex:0 0 auto"><button style="all:unset" onclick="${()=>{item.remove()}}" u2-confirm><u2-ico>delete</u2-ico></button>*/null}
|
|
134
|
+
`;
|
|
135
|
+
})}
|
|
136
|
+
`);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// const attributesEl = shadow.getElementById('attributes');
|
|
140
|
+
// const attributes = manifest.modules[0].declarations[0].attributes;
|
|
141
|
+
// attributes?.length && attributes.forEach(attr => {
|
|
142
|
+
// const tr = document.createElement('tr');
|
|
143
|
+
// attributesEl.appendChild(tr);
|
|
144
|
+
|
|
145
|
+
// const {input, datalist} = toInput(attr);
|
|
146
|
+
// input.addEventListener('input', () => {
|
|
147
|
+
// if (input.type === 'checkbox') {
|
|
148
|
+
// input.checked ? ce.setAttribute(attr.name, '') : ce.removeAttribute(attr.name);
|
|
149
|
+
// } else {
|
|
150
|
+
// input.value === '' ? ce.removeAttribute(attr.name) : ce.setAttribute(attr.name, input.value);
|
|
151
|
+
// }
|
|
152
|
+
// });
|
|
153
|
+
// if (attr['u2-type'] === 'boolean') {
|
|
154
|
+
// input.checked = ce.hasAttribute(attr.name);
|
|
155
|
+
// } else {
|
|
156
|
+
// input.value = ce.getAttribute(attr.name);
|
|
157
|
+
// }
|
|
158
|
+
// tr.innerHTML =
|
|
159
|
+
// `<td style="flex-basis:15rem; flex-grow:4">
|
|
160
|
+
// ${attr.name}<br><small>${attr.description ?? ''}</small>
|
|
161
|
+
// <td style="flex-basis:9rem">`;
|
|
162
|
+
// tr.lastElementChild.appendChild(input);
|
|
163
|
+
// if (datalist) tr.lastElementChild.appendChild(datalist);
|
|
164
|
+
// });
|
|
165
|
+
|
|
166
|
+
attributesEl.closest('u2-tabs > *').previousElementSibling.hidden = !attributes?.length;
|
|
167
|
+
|
|
168
|
+
/* css */
|
|
169
|
+
const cssPropertiesEl = shadow.getElementById('cssProperties');
|
|
170
|
+
const css = manifest.modules[0].declarations[0].cssProperties;
|
|
171
|
+
css?.length && css.forEach(prop => {
|
|
172
|
+
const tr = document.createElement('tr');
|
|
173
|
+
cssPropertiesEl.appendChild(tr);
|
|
174
|
+
const {input, datalist} = toInput(prop);
|
|
175
|
+
input.addEventListener('input', () => {
|
|
176
|
+
if (input.value === '') {
|
|
177
|
+
ce.style.removeProperty(prop.name);
|
|
178
|
+
} else {
|
|
179
|
+
ce.style.setProperty(prop.name, input.value);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
input.value = ce.style.getPropertyValue(prop.name);
|
|
183
|
+
|
|
184
|
+
tr.innerHTML =
|
|
185
|
+
`<td style="flex-basis:15rem; flex-grow:4">
|
|
186
|
+
${prop.name}<br><small>${prop.description ?? ''}</small>
|
|
187
|
+
<td style="flex-basis:9rem">`;
|
|
188
|
+
tr.lastElementChild.appendChild(input);
|
|
189
|
+
if (datalist) tr.lastElementChild.appendChild(datalist);
|
|
190
|
+
});
|
|
191
|
+
cssPropertiesEl.closest('u2-tabs > *').previousElementSibling.hidden = !css?.length;
|
|
192
|
+
|
|
193
|
+
const cssPartsEl = shadow.getElementById('cssParts');
|
|
194
|
+
const parts = manifest.modules[0].declarations[0].cssParts;
|
|
195
|
+
parts?.length && parts.forEach(part => {
|
|
196
|
+
if (!part.name) return;
|
|
197
|
+
const tr = document.createElement('tr');
|
|
198
|
+
tr.style.setProperty('align-items', 'center');
|
|
199
|
+
cssPartsEl.appendChild(tr);
|
|
200
|
+
tr.innerHTML =
|
|
201
|
+
`<td style="flex-basis:15rem; flex-grow:4">
|
|
202
|
+
${part.name}<br><small>${part.description ?? ''}</small>
|
|
203
|
+
<td style="flex-basis:9rem">
|
|
204
|
+
<u2-code name="${part.name}" editable style="padding:.6em; border:1px solid; min-width:10rem; min-height:3rem"></u2-code>
|
|
205
|
+
`;
|
|
206
|
+
});
|
|
207
|
+
if (!ce.id) ce.id = 'ce-' + Math.random().toString(36).substring(2);
|
|
208
|
+
const style = document.createElement('style');
|
|
209
|
+
ce.after(style);
|
|
210
|
+
cssPartsEl.closest('form').addEventListener('input', function(e) {
|
|
211
|
+
// u2-code can not participate in form submission for now
|
|
212
|
+
// so we need to get its value manually
|
|
213
|
+
let css = `#${ce.id} { \n`;
|
|
214
|
+
this.querySelectorAll('u2-code').forEach(code => {
|
|
215
|
+
if (!code.value.trim()) return;
|
|
216
|
+
css += ` &::part(${code.getAttribute('name')}) {${code.value}}\n`;
|
|
217
|
+
});
|
|
218
|
+
css += '\n}';
|
|
219
|
+
style.textContent = css;
|
|
220
|
+
});
|
|
221
|
+
cssPartsEl.closest('u2-tabs > *').previousElementSibling.hidden = !parts?.length;
|
|
222
|
+
|
|
223
|
+
// /* random settings */
|
|
224
|
+
// shadow.getElementById('random').addEventListener('click', () => {
|
|
225
|
+
// attributes?.length && attributes.forEach(attr => {
|
|
226
|
+
// const value = chooseRandom(attr);
|
|
227
|
+
// if (value === undefined) return;
|
|
228
|
+
// if (value===false) ce.removeAttribute(attr.name);
|
|
229
|
+
// else ce.setAttribute(attr.name, value);
|
|
230
|
+
// });
|
|
231
|
+
// css?.length && css.forEach(prop => {
|
|
232
|
+
// const value = chooseRandom(prop);
|
|
233
|
+
// if (value === undefined) return;
|
|
234
|
+
// ce.style.setProperty(prop.name, value);
|
|
235
|
+
// });
|
|
236
|
+
// parts?.length && parts.forEach(part => {
|
|
237
|
+
// if (!part.name) return;
|
|
238
|
+
// const code = shadow.querySelector(`u2-code[name="${part.name}"]`);
|
|
239
|
+
// if (!code) return;
|
|
240
|
+
// });
|
|
241
|
+
// });
|
|
242
|
+
// function chooseRandom(data) {
|
|
243
|
+
// if (Array.isArray(data.u2Examples)) {
|
|
244
|
+
// return data.u2Examples[Math.floor(Math.random() * data.u2Examples.length)];
|
|
245
|
+
// }
|
|
246
|
+
// if (data['u2-type'] === 'boolean') {
|
|
247
|
+
// return Math.random() > .5;
|
|
248
|
+
// }
|
|
249
|
+
// if (data['u2-type'] === 'number') {
|
|
250
|
+
// return Math.random() * 100;
|
|
251
|
+
// }
|
|
252
|
+
// if (Array.isArray(data['u2-type'])) {
|
|
253
|
+
// return data['u2-type'][Math.floor(Math.random() * data['u2-type'].length)];
|
|
254
|
+
// }
|
|
255
|
+
// }
|
|
256
|
+
|
|
257
|
+
}
|
|
258
|
+
async manifest() {
|
|
259
|
+
let url = this.getAttribute('manifest');
|
|
260
|
+
if (!url.startsWith('http')) {
|
|
261
|
+
url = new URL(url, document.baseURI).href;
|
|
262
|
+
}
|
|
263
|
+
return await fetch(url).then(r => r.json());
|
|
264
|
+
}
|
|
265
|
+
connectedCallback() {
|
|
266
|
+
this._element = this.firstElementChild;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
customElements.define('ce-inspector', CeInspector);
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
function toInput(attr) {
|
|
276
|
+
let input = document.createElement('input');
|
|
277
|
+
if (attr['u2-type'] === 'boolean') input.type = 'checkbox';
|
|
278
|
+
if (Array.isArray(attr['u2-type'])) {
|
|
279
|
+
input = document.createElement('select');
|
|
280
|
+
let option = document.createElement('option');
|
|
281
|
+
option.value = '';
|
|
282
|
+
option.text = '---';
|
|
283
|
+
input.appendChild(option);
|
|
284
|
+
attr['u2-type'].forEach(o => {
|
|
285
|
+
let option = document.createElement('option');
|
|
286
|
+
option.value = o;
|
|
287
|
+
option.text = o;
|
|
288
|
+
input.appendChild(option);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
input.name = attr.name;
|
|
292
|
+
let datalist = null;
|
|
293
|
+
if (attr.u2Examples) {
|
|
294
|
+
datalist = document.createElement('datalist');
|
|
295
|
+
datalist.id = 'dl-' + Math.random().toString(36).substring(2);
|
|
296
|
+
attr.u2Examples.forEach(e => {
|
|
297
|
+
const option = document.createElement('option');
|
|
298
|
+
option.value = e;
|
|
299
|
+
datalist.appendChild(option);
|
|
300
|
+
});
|
|
301
|
+
input.setAttribute('list', datalist.id);
|
|
302
|
+
}
|
|
303
|
+
//input.placeholder = a;
|
|
304
|
+
return {
|
|
305
|
+
input,
|
|
306
|
+
datalist
|
|
307
|
+
}
|
|
308
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
<script src="../../u2/tests/test-init.js" type=module></script>
|
|
8
|
+
|
|
9
|
+
<script src="../../u2/auto.js" type=module></script>
|
|
10
|
+
|
|
11
|
+
<link rel=stylesheet href="../../css/classless/full.css">
|
|
12
|
+
<link rel=stylesheet href="../../css/classless/simple.css">
|
|
13
|
+
|
|
14
|
+
<script src="./ce-inspector.js" type=module async></script>
|
|
15
|
+
|
|
16
|
+
<body>
|
|
17
|
+
|
|
18
|
+
<section>
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
body {
|
|
22
|
+
place-content: start stretch;
|
|
23
|
+
--u2-ico-dir:'https://cdn.jsdelivr.net/npm/@material-icons/svg@1.0.11/svg/{icon}/baseline.svg';
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
<ce-inspector manifest="../../el/ico/manifest.json">
|
|
29
|
+
<u2-ico icon="thumb_up"></u2-ico>
|
|
30
|
+
</ce-inspector>
|
|
31
|
+
|
|
32
|
+
<ce-inspector manifest="../../el/carousel/manifest.json">
|
|
33
|
+
<u2-carousel mode="fade">
|
|
34
|
+
<div>
|
|
35
|
+
Slide 1
|
|
36
|
+
</div>
|
|
37
|
+
<div>
|
|
38
|
+
Slide 2
|
|
39
|
+
</div>
|
|
40
|
+
<div>
|
|
41
|
+
Slide 3
|
|
42
|
+
</div>
|
|
43
|
+
</u2-carousel>
|
|
44
|
+
</ce-inspector>
|
|
45
|
+
|
|
46
|
+
<ce-inspector manifest="../../el/number/manifest.json">
|
|
47
|
+
<u2-number>1234.567</u2-number>
|
|
48
|
+
</ce-inspector>
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
<ce-inspector manifest="../../el/code/manifest.json">
|
|
52
|
+
<u2-code editable trim>
|
|
53
|
+
<style>
|
|
54
|
+
u2-number {
|
|
55
|
+
font-weight:bold;
|
|
56
|
+
}
|
|
57
|
+
</style>
|
|
58
|
+
</u2-code>
|
|
59
|
+
</ce-inspector>
|
|
60
|
+
|
|
61
|
+
<ce-inspector manifest="../../el/tooltip/manifest.json">
|
|
62
|
+
<u2-tooltip tabindex="-1">Tooltip test</u2-tooltip>
|
|
63
|
+
</ce-inspector>
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</section>
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// similiar: https://github.com/Polymer/tools/tree/master/packages/analyzer
|
|
2
|
+
|
|
3
|
+
// hooks
|
|
4
|
+
{
|
|
5
|
+
/*
|
|
6
|
+
const aEL = EventTarget.prototype.addEventListener;
|
|
7
|
+
EventTarget.prototype.addEventListener = function(...args){
|
|
8
|
+
!this.__events && (this.__events = []);
|
|
9
|
+
this.__events.push(args[0]);
|
|
10
|
+
return aEL.apply(this, args);
|
|
11
|
+
}
|
|
12
|
+
*/
|
|
13
|
+
// collect all dispatched events
|
|
14
|
+
window.__dispatchedEvents = new Set();
|
|
15
|
+
const dE = EventTarget.prototype.dispatchEvent;
|
|
16
|
+
EventTarget.prototype.dispatchEvent = function(...args){
|
|
17
|
+
const ev = args[0];
|
|
18
|
+
if (!ev.detail || !ev.detail.__test) {
|
|
19
|
+
//!this.__events && (this.__events = {});
|
|
20
|
+
//this.__events[args[0].type] = 1;
|
|
21
|
+
__dispatchedEvents.add(args[0].type);
|
|
22
|
+
}
|
|
23
|
+
return dE.apply(this, args);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// requested css properties
|
|
27
|
+
const gCS = getComputedStyle;
|
|
28
|
+
window.getComputedStyle = function(...args){
|
|
29
|
+
style = gCS.apply(this, args);
|
|
30
|
+
style._computedFor = args[0];
|
|
31
|
+
return style;
|
|
32
|
+
}
|
|
33
|
+
const gPV = CSS2Properties.prototype.getPropertyValue;
|
|
34
|
+
CSS2Properties.prototype.getPropertyValue = function(...args){
|
|
35
|
+
// collect requested properties args[0]
|
|
36
|
+
const computedFor = this._computedFor;
|
|
37
|
+
if (computedFor) {
|
|
38
|
+
!computedFor.__requestedProperties && (computedFor.__requestedProperties = []);
|
|
39
|
+
computedFor.__requestedProperties.push(args[0]);
|
|
40
|
+
}
|
|
41
|
+
return gPV.apply(this, args);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
function fromElement(el) {
|
|
47
|
+
|
|
48
|
+
// el.outerHTML = el.outerHTML; // trigger changes
|
|
49
|
+
|
|
50
|
+
const tagName = el.tagName.toLowerCase();
|
|
51
|
+
var klass = el.constructor;
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
// better: walk stylsheets and search for `xy-element { --x:y; };`
|
|
55
|
+
var cps = Object.values(getComputedStyle(el)).filter(style=>{
|
|
56
|
+
if (!style.startsWith) return;
|
|
57
|
+
if (style.startsWith('--'+tagName)) return true;
|
|
58
|
+
});
|
|
59
|
+
const cssProperties = cps.map(name=>{
|
|
60
|
+
return {
|
|
61
|
+
name,
|
|
62
|
+
default:'',
|
|
63
|
+
summary:'',
|
|
64
|
+
description:'',
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
var attris = klass.observedAttributes;
|
|
69
|
+
var attributes = (attris??[]).map(attr=>{
|
|
70
|
+
return {
|
|
71
|
+
name:attr,
|
|
72
|
+
summary:'',
|
|
73
|
+
description:'',
|
|
74
|
+
inheritedFrom:null,
|
|
75
|
+
type: null,
|
|
76
|
+
default:'',
|
|
77
|
+
fieldName:null
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
// events
|
|
83
|
+
// trigger different native events
|
|
84
|
+
function triggerNativeEvents(){
|
|
85
|
+
const options = {bubbles:true, detail:{__test:1}};
|
|
86
|
+
const eNames = ['click','mouseover','mouseenter','keydown','drop','input','change','focus','blur'];
|
|
87
|
+
const containEls = el.querySelectorAll('*');
|
|
88
|
+
const shadowEls = el.shadowRoot ? el.shadowRoot.querySelectorAll('*') : [];
|
|
89
|
+
eNames.forEach(eName=>{
|
|
90
|
+
el.dispatchEvent(new CustomEvent(eName, options));
|
|
91
|
+
containEls.forEach(el=>el.dispatchEvent(new CustomEvent(eName, options)))
|
|
92
|
+
shadowEls.forEach(el=>el.dispatchEvent(new CustomEvent(eName, options)))
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
// trigger native events to collect custom events
|
|
96
|
+
triggerNativeEvents();
|
|
97
|
+
// listen for every collected events
|
|
98
|
+
var triggeredEvents = new Set();
|
|
99
|
+
for (let eventName of __dispatchedEvents) {
|
|
100
|
+
el.addEventListener(eventName,()=>triggeredEvents.add(eventName));
|
|
101
|
+
}
|
|
102
|
+
// again trigger native events to collect them on my custom element
|
|
103
|
+
triggerNativeEvents();
|
|
104
|
+
|
|
105
|
+
const events = [...triggeredEvents].map(name=>{
|
|
106
|
+
//const events = Object.keys(el.__events??[]).map(name=>{
|
|
107
|
+
return {
|
|
108
|
+
name,
|
|
109
|
+
summary: '',
|
|
110
|
+
description: '',
|
|
111
|
+
type: null,
|
|
112
|
+
inheritedFrom: null,
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// slots
|
|
117
|
+
var slotEls = el.shadowRoot ? el.shadowRoot.querySelectorAll('slot') : [];
|
|
118
|
+
const slots = Array.from(slotEls).map(el=>{
|
|
119
|
+
return {
|
|
120
|
+
name: el.name,
|
|
121
|
+
summary: '',
|
|
122
|
+
description: '',
|
|
123
|
+
};
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
// CSS Shadow Parts
|
|
128
|
+
var partEls = el.shadowRoot ? el.shadowRoot.querySelectorAll('[part]') : [];
|
|
129
|
+
const cssParts = Array.from(partEls).map(el=>{
|
|
130
|
+
return {
|
|
131
|
+
name: el.getAttribute('part'),
|
|
132
|
+
summary: '',
|
|
133
|
+
description: '',
|
|
134
|
+
};
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
// members
|
|
139
|
+
const membersObj = {}
|
|
140
|
+
let proto = klass.prototype
|
|
141
|
+
while (1) {
|
|
142
|
+
Object.entries(Object.getOwnPropertyDescriptors(proto)).map(([name, desc])=>{
|
|
143
|
+
if (membersObj[name]) return;
|
|
144
|
+
if (name === 'connectedCallback') return;
|
|
145
|
+
if (name === 'disconnectedCallback') return;
|
|
146
|
+
if (name === 'attributeChangedCallback') return;
|
|
147
|
+
|
|
148
|
+
const writeable = !desc.value && desc.set;
|
|
149
|
+
const readable = !desc.value && desc.get;
|
|
150
|
+
const obj = {
|
|
151
|
+
name,
|
|
152
|
+
summary: (readable?'readable':'')+' '+(readable?'writable':''),
|
|
153
|
+
description: '',
|
|
154
|
+
static: false,
|
|
155
|
+
privacy: 'public',
|
|
156
|
+
//inheritedFrom: null,
|
|
157
|
+
//source : null,
|
|
158
|
+
};
|
|
159
|
+
if (desc.value && typeof desc.value === 'function') {
|
|
160
|
+
obj.kind = 'method';
|
|
161
|
+
// obj.parameters: Parameter[];
|
|
162
|
+
// obj.return = {
|
|
163
|
+
// type = Type,
|
|
164
|
+
// description = string,
|
|
165
|
+
// };
|
|
166
|
+
} else {
|
|
167
|
+
obj.kind = 'field';
|
|
168
|
+
// obj.type = Type;
|
|
169
|
+
// obj.default = string;
|
|
170
|
+
}
|
|
171
|
+
membersObj[name] = obj;
|
|
172
|
+
})
|
|
173
|
+
proto = Object.getPrototypeOf(proto);
|
|
174
|
+
if (!proto) break;
|
|
175
|
+
if (proto === HTMLElement.prototype) break;
|
|
176
|
+
if (proto[Symbol.toStringTag] === 'HTMLElement') break;
|
|
177
|
+
if (proto === Object.prototype) break;
|
|
178
|
+
};
|
|
179
|
+
const members = Object.values(membersObj);
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
return {
|
|
183
|
+
/* ce extends classLikes */
|
|
184
|
+
name: klass.name || tagName,
|
|
185
|
+
summary: klass.formAssociated ? 'form element' : '',
|
|
186
|
+
description: '',
|
|
187
|
+
//superclass: null,
|
|
188
|
+
//mixins: [],
|
|
189
|
+
members,
|
|
190
|
+
source: 'https://',
|
|
191
|
+
|
|
192
|
+
tagName,
|
|
193
|
+
attributes,
|
|
194
|
+
events,
|
|
195
|
+
slots,
|
|
196
|
+
cssParts,
|
|
197
|
+
cssProperties,
|
|
198
|
+
demos:[{
|
|
199
|
+
url: location.href,
|
|
200
|
+
description: document.title,
|
|
201
|
+
source: '',
|
|
202
|
+
}],
|
|
203
|
+
customElement:true,
|
|
204
|
+
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
}
|