@nldd/design-system 0.26.0 → 0.26.2
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/custom-elements.json +4559 -1176
- package/dist/cdn/autoloader.js +141 -141
- package/dist/cdn/chunks/{accordion-DA4IlxS5.js → accordion-CCuKxlsg.js} +6 -6
- package/dist/cdn/chunks/{accordion-item-Ca1o93cq.js → accordion-item-Cn1UDWtD.js} +7 -7
- package/dist/cdn/chunks/{activity-indicator-Cj4H0Mbz.js → activity-indicator-BM_atCTY.js} +13 -13
- package/dist/cdn/chunks/{admonition-CdZSoO8O.js → admonition-CqDce27_.js} +11 -11
- package/dist/cdn/chunks/{avatar-Dhqn-Dmv.js → avatar-Dl2tOfc2.js} +18 -18
- package/dist/cdn/chunks/{avatar-group-B017eF-u.js → avatar-group-Br3qBaow.js} +42 -40
- package/dist/cdn/chunks/{badge-Bep5B0_g.js → badge-DjjAl4mn.js} +15 -15
- package/dist/cdn/chunks/{banner-DGpIXuE2.js → banner-s5xMqoEU.js} +16 -16
- package/dist/cdn/chunks/{bar-split-view-CKwJxd3e.js → bar-split-view-B6Mv_cw-.js} +8 -8
- package/dist/cdn/chunks/{blockquote-ChMgaOuI.js → blockquote-CRFPXI9u.js} +8 -8
- package/dist/cdn/chunks/{box-BRmziG-6.js → box-CSZyj31o.js} +5 -5
- package/dist/cdn/chunks/{breadcrumbs-BeVO8bkQ.js → breadcrumbs-DzjbOB7o.js} +13 -13
- package/dist/cdn/chunks/{button-cHBkq_s7.js → button-B7OGt_dX.js} +53 -54
- package/dist/cdn/chunks/{button-bar-CLxOdalJ.js → button-bar-CvDkir22.js} +8 -8
- package/dist/cdn/chunks/{button-group-BIvKtEIX.js → button-group-Bi3dr9Go.js} +6 -6
- package/dist/cdn/chunks/{card-B5gp9Zly.js → card-DceO3pMp.js} +10 -10
- package/dist/cdn/chunks/{cell-D4Nrd5Z9.js → cell-Bgp9n0yQ.js} +13 -13
- package/dist/cdn/chunks/{checkbox-CeLTJhAc.js → checkbox-C1F0Q3g8.js} +26 -43
- package/dist/cdn/chunks/{checkbox-field-C8cU8fuf.js → checkbox-field-DGKc530M.js} +35 -43
- package/dist/cdn/chunks/checkbox-group-x9Ua2a06.js +91 -0
- package/dist/cdn/chunks/choice-group-AZsqoheP.js +64 -0
- package/dist/cdn/chunks/{class-map-xzscTu4B.js → class-map-CAVKoa31.js} +1 -1
- package/dist/cdn/chunks/{code-editor-BNhlXTSl.js → code-editor-C0U5qVW2.js} +11 -11
- package/dist/cdn/chunks/{code-viewer-D_JwouYO.js → code-viewer-C_DzKPSv.js} +17 -17
- package/dist/cdn/chunks/{codemirror-input-DJ0wgYrc.js → codemirror-input-BmIE22aU.js} +5 -5
- package/dist/cdn/chunks/{collection-BXvz_OtU.js → collection-BZK9NzrQ.js} +19 -19
- package/dist/cdn/chunks/{combo-box-8kbmoStb.js → combo-box-DJrQ-2Wr.js} +69 -87
- package/dist/cdn/chunks/{container-Dq-2uHd5.js → container-BT96Wlz6.js} +48 -48
- package/dist/cdn/chunks/{custom-element-DeaCQ2NP.js → custom-element-D5bstafw.js} +2 -2
- package/dist/cdn/chunks/{date-field-CQg1_73u.js → date-field-B8GcDwkD.js} +33 -40
- package/dist/cdn/chunks/{date-picker-CTMxGOiA.js → date-picker-Byi-fA0A.js} +17 -17
- package/dist/cdn/chunks/{decorate-CCYde2ES.js → decorate-Cjb3GqlZ.js} +1 -1
- package/dist/cdn/chunks/deep-active-element-DgiHjYGG.js +7 -0
- package/dist/cdn/chunks/{described-by-mixin-BYFim7aO.js → described-by-mixin-ZWpyWEyB.js} +2 -2
- package/dist/cdn/chunks/{description-cell-GcVeCz2_.js → description-cell-DRXRiZGw.js} +12 -12
- package/dist/cdn/chunks/{dev-checks-CSlbfDuF.js → dev-checks-BYWMWeug.js} +931 -931
- package/dist/cdn/chunks/{directive-helpers-DgaADFyY.js → directive-helpers-mh9SNf0j.js} +1 -1
- package/dist/cdn/chunks/{dist-5vPsM2aV.js → dist-1yCEk2Pe.js} +1 -1
- package/dist/cdn/chunks/{dist-1OQdP4ho.js → dist-BBtyEGZQ.js} +3 -3
- package/dist/cdn/chunks/{dist-Da_liXcd.js → dist-BIhRNYZs.js} +3 -3
- package/dist/cdn/chunks/{dist-B23jHvJ5.js → dist-BfJ8w6Dz.js} +1 -1
- package/dist/cdn/chunks/{dist-CcpLhc4y.js → dist-BlHWe6Ns.js} +1 -1
- package/dist/cdn/chunks/{dist-VCymi0hs.js → dist-C4o16iKF.js} +1 -1
- package/dist/cdn/chunks/{dist-CyDpBAaD.js → dist-CKGgPGjj.js} +2 -2
- package/dist/cdn/chunks/{dist-CNy2sPTt.js → dist-CT0CdAxb.js} +2 -2
- package/dist/cdn/chunks/{dist-D4SViUJx.js → dist-DCzCfm9V.js} +1 -1
- package/dist/cdn/chunks/{dist-DLtwMUDc.js → dist-iYv1GHSb.js} +2 -2
- package/dist/cdn/chunks/{dist-DBxjWahH.js → dist-jyyZH0d2.js} +1 -1
- package/dist/cdn/chunks/{divider-8XD3xTbl.js → divider-CeAw8gBP.js} +2 -2
- package/dist/cdn/chunks/{document-tab-bar-RBAmckHS.js → document-tab-bar-rIsC6EZp.js} +32 -46
- package/dist/cdn/chunks/{dropdown-DVlxPcjr.js → dropdown-MEzKo0TQ.js} +14 -14
- package/dist/cdn/chunks/{file-field-BrHnFplX.js → file-field--wivtgZv.js} +42 -40
- package/dist/cdn/chunks/{form-DGHeGEIr.js → form-ByjlUZuR.js} +1 -1
- package/dist/cdn/chunks/{form-actions-CHwWKfMM.js → form-actions-YK7n_jse.js} +4 -4
- package/dist/cdn/chunks/form-associated-mixin-BCzChLUO.js +123 -0
- package/dist/cdn/chunks/{form-field-CdTSI-8h.js → form-field-y-h-k8x5.js} +11 -11
- package/dist/cdn/chunks/{form-section-CjECOIiZ.js → form-section-jWj88aQa.js} +1 -1
- package/dist/cdn/chunks/{full-bleed-section-CQgq4iGQ.js → full-bleed-section-h6CrFe8F.js} +5 -5
- package/dist/cdn/chunks/{hero-DhdcYt2N.js → hero-Dy1tW9gU.js} +19 -19
- package/dist/cdn/chunks/{icon-button-DT_Bi4Ac.js → icon-button-B0Lb2ccT.js} +37 -38
- package/dist/cdn/chunks/{icon-cell-C-qrZAlN.js → icon-cell-byBTzcEn.js} +10 -10
- package/dist/cdn/chunks/{icon-qpmEfU9B.js → icon-m8JXbN5F.js} +8 -8
- package/dist/cdn/chunks/{identity-DFmvuPkl.js → identity-BpUMGka9.js} +12 -12
- package/dist/cdn/chunks/{if-defined-BINBE69I.js → if-defined-Duzrh8bb.js} +1 -1
- package/dist/cdn/chunks/{image-B4M3h1xJ.js → image-DfpFBPj1.js} +21 -21
- package/dist/cdn/chunks/{inline-dialog-L-NvjANF.js → inline-dialog-D6CMJnYk.js} +16 -16
- package/dist/cdn/chunks/interest-intent-Bk3i_upv.js +63 -0
- package/dist/cdn/chunks/{interest-controller-Ban-3NrX.js → interest-invoker-BY95Duqo.js} +28 -38
- package/dist/cdn/chunks/{just-in-time-education-CWplH4r9.js → just-in-time-education-_1kTZuGb.js} +13 -13
- package/dist/cdn/chunks/{kanban-B6Wa-2aM.js → kanban-DFGaEwfP.js} +25 -29
- package/dist/cdn/chunks/{kanban-column-D2-Xq79_.js → kanban-column-Cs47JSUO.js} +10 -10
- package/dist/cdn/chunks/{keyboard-shortcut-Ci95olxF.js → keyboard-shortcut-4DPqQovv.js} +13 -13
- package/dist/cdn/chunks/{languages-C9AGuuSS.js → languages-D-97TsxL.js} +12 -12
- package/dist/cdn/chunks/{link-BJB2a_fG.js → link-6T0VtDWt.js} +18 -18
- package/dist/cdn/chunks/{link-group-aNoedLZo.js → link-group-ymcl82Ua.js} +7 -7
- package/dist/cdn/chunks/{list-CZWX62tH.js → list-BXpR0UzC.js} +110 -95
- package/dist/cdn/chunks/{list-item-DHzsbK_S.js → list-item-CyZ6uPGG.js} +50 -29
- package/dist/cdn/chunks/{list-item-segment-CHLlU9Gg.js → list-item-segment-BUtAy96X.js} +23 -20
- package/dist/cdn/chunks/{menu-bar-CJazkmY7.js → menu-bar-Cn1Nb2ir.js} +59 -60
- package/dist/cdn/chunks/{menu-bar-item-CSqXWNKE.js → menu-bar-item-CZR2qAzA.js} +35 -35
- package/dist/cdn/chunks/{menu-divider-Cn1hTpcM.js → menu-divider-dF1NvFJO.js} +3 -3
- package/dist/cdn/chunks/{menu-group-C71K1Vmv.js → menu-group-DW3so0Dn.js} +4 -4
- package/dist/cdn/chunks/{menu-item-TqBlQfI2.js → menu-item-7kb18Ypf.js} +4 -4
- package/dist/cdn/chunks/{menu-NGpB1SKq.js → menu-kSZLzjet.js} +101 -93
- package/dist/cdn/chunks/{menu.template-DthELYky.js → menu.template-cgua9dKM.js} +4 -4
- package/dist/cdn/chunks/{modal-dialog-0V2HsrJC.js → modal-dialog-DfKbcw9T.js} +28 -78
- package/dist/cdn/chunks/modal-overlay-Bx0bYzF3.js +95 -0
- package/dist/cdn/chunks/{multi-line-text-field-BV4uUDoK.js → multi-line-text-field-AV-vID1z.js} +28 -45
- package/dist/cdn/chunks/{navigation-split-view-tPhkxEVD.js → navigation-split-view-UwlSFPDE.js} +10 -10
- package/dist/cdn/chunks/{notification-CZccv6qx.js → notification-e5uGGh0b.js} +12 -12
- package/dist/cdn/chunks/{number-field-4R2blHda.js → number-field-COUmvl_s.js} +26 -32
- package/dist/cdn/chunks/{one-half-one-half-section-h2fLPQfP.js → one-half-one-half-section-C-AgSdm9.js} +6 -6
- package/dist/cdn/chunks/{one-third-two-thirds-section-mqUAH5lK.js → one-third-two-thirds-section-D1kq4IEc.js} +6 -6
- package/dist/cdn/chunks/{one-time-code-field-Bf_qymKd.js → one-time-code-field-BDQctC8H.js} +25 -38
- package/dist/cdn/chunks/overflow-menu-C67lAkP8.js +83 -0
- package/dist/cdn/chunks/overlay-invoker-CQpe-JGA.js +95 -0
- package/dist/cdn/chunks/{page-Kipfvmi6.js → page-DXEaFsfo.js} +11 -11
- package/dist/cdn/chunks/{page-footer-DxE966Oe.js → page-footer-DFaIlgHs.js} +13 -13
- package/dist/cdn/chunks/{page-section-mixin-DpF9JDpd.js → page-section-mixin-3XhS4f5q.js} +21 -21
- package/dist/cdn/chunks/{pagination-DUFFhaU8.js → pagination-BE3ERBNx.js} +13 -13
- package/dist/cdn/chunks/{password-field-DdYAVmF3.js → password-field-DjRp78HI.js} +28 -45
- package/dist/cdn/chunks/{popover-CRHxyhGx.js → popover-C3j0KtFh.js} +55 -64
- package/dist/cdn/chunks/{progress-bar-BuYsjmSo.js → progress-bar-iWFq6KS1.js} +26 -26
- package/dist/cdn/chunks/{progress-circle-Cvu1bfNG.js → progress-circle-BPFzTlhn.js} +24 -24
- package/dist/cdn/chunks/{radio-button-B_4AxWDx.js → radio-button-BMVBbe3-.js} +17 -26
- package/dist/cdn/chunks/{radio-button-field-D7jIg6Oi.js → radio-button-field-BqSd0JMd.js} +29 -37
- package/dist/cdn/chunks/radio-button-group-DZTPflZ3.js +112 -0
- package/dist/cdn/chunks/{render-marked-CIuiSS_8.js → render-marked-1xftlCd8.js} +1 -1
- package/dist/cdn/chunks/{reorder-handle-cell-DNPaZjSC.js → reorder-handle-cell-loSG6GRY.js} +7 -7
- package/dist/cdn/chunks/{reorder-handle-mixin-CgvWq4fF.js → reorder-handle-mixin-cLWXCdFC.js} +2 -2
- package/dist/cdn/chunks/{repeat-DfVuWl6o.js → repeat-CWsNVfra.js} +2 -2
- package/dist/cdn/chunks/{return-focus-D0fF2hjd.js → return-focus-CpwHVxYU.js} +10 -14
- package/dist/cdn/chunks/{rich-text-CVHlMQY6.js → rich-text-DSvI9u6v.js} +3 -3
- package/dist/cdn/chunks/{row-header-mixin-B25JK2B3.js → row-header-mixin-vwABKkTO.js} +2 -2
- package/dist/cdn/chunks/{scroll-fade-Dv57rTww.js → scroll-fade-ZNdnDF4p.js} +4 -4
- package/dist/cdn/chunks/{search-field-hmD_DXbG.js → search-field-CBTir8Wu.js} +33 -58
- package/dist/cdn/chunks/{segmented-control-e8e-jYSw.js → segmented-control-hvWn3L0J.js} +92 -103
- package/dist/cdn/chunks/{shadow-resets-CRdvf-Ei.js → shadow-resets-JiVlctXb.js} +2 -2
- package/dist/cdn/chunks/{sheet-D09y3J45.js → sheet-CnbdONF9.js} +39 -90
- package/dist/cdn/chunks/{shell-CV3gooGg.js → shell-BAH9okPd.js} +5 -5
- package/dist/cdn/chunks/{side-by-side-split-view-Ckz1C9zk.js → side-by-side-split-view-D07iBCFK.js} +8 -8
- package/dist/cdn/chunks/{sidebar-section-CdyD-x4t.js → sidebar-section-DAE2lrdn.js} +14 -14
- package/dist/cdn/chunks/{simple-section-CEf38rBZ.js → simple-section-DQZpG3nQ.js} +7 -7
- package/dist/cdn/chunks/{skip-link-DMRhATWw.js → skip-link-D0yYukhb.js} +7 -7
- package/dist/cdn/chunks/{slider-Db3FPiP6.js → slider-C-a97cAu.js} +30 -37
- package/dist/cdn/chunks/{spacer-BPFIYueo.js → spacer-C19W6HrX.js} +8 -8
- package/dist/cdn/chunks/{spacer-cell-kITa3CDV.js → spacer-cell-lRxkFSnp.js} +6 -6
- package/dist/cdn/chunks/{split-button-CJs9-Nha.js → split-button-38xSIAVk.js} +21 -21
- package/dist/cdn/chunks/{split-view-divider-lHlM1Ss8.js → split-view-divider-CViSo7s7.js} +5 -5
- package/dist/cdn/chunks/{split-view-pane-DlsbZtyo.js → split-view-pane-Bb1RFCNJ.js} +7 -7
- package/dist/cdn/chunks/{stacked-split-view-uRSVhrMd.js → stacked-split-view-Bnw5hQ5A.js} +8 -8
- package/dist/cdn/chunks/{static-html-BahSPV_4.js → static-html-7PckS8pf.js} +1 -1
- package/dist/cdn/chunks/{status-bar-DCJLVpsW.js → status-bar-D57SEB_4.js} +8 -8
- package/dist/cdn/chunks/{step-bar-CRR2jiyo.js → step-bar-Q_wc0vqp.js} +18 -18
- package/dist/cdn/chunks/{step-cell-CbtKxJNJ.js → step-cell-DU6sNjnm.js} +15 -15
- package/dist/cdn/chunks/{stepper-Con1_CnB.js → stepper-BM1dp44g.js} +16 -26
- package/dist/cdn/chunks/{style-map-uOwLerwV.js → style-map-BRs_xiW6.js} +1 -1
- package/dist/cdn/chunks/{swatch-picker-Bqn0eaC9.js → swatch-picker-BcRbPWVv.js} +63 -69
- package/dist/cdn/chunks/{switch-CMQcLEBJ.js → switch-7BZAufN0.js} +25 -42
- package/dist/cdn/chunks/{switch-field-D9kWq4Kw.js → switch-field-gjPTIapp.js} +19 -32
- package/dist/cdn/chunks/{tab-bar-DXzyZI3V.js → tab-bar-BKzbb7TE.js} +34 -29
- package/dist/cdn/chunks/{table-CWACLpHx.js → table-CmkkY3M1.js} +15 -15
- package/dist/cdn/chunks/{tag-Bo4yJbtF.js → tag-B4VfItSH.js} +11 -11
- package/dist/cdn/chunks/{term-CQ379ZbN.js → term-C0aNyYXz.js} +42 -39
- package/dist/cdn/chunks/{text-D-dFoj6N.js → text-CLuHOFQt.js} +29 -29
- package/dist/cdn/chunks/{text-cell-Be1hStxp.js → text-cell-Dvujh580.js} +23 -23
- package/dist/cdn/chunks/{text-editor-BjzQEBWm.js → text-editor-0_ZoELkA.js} +12 -12
- package/dist/cdn/chunks/{text-field-DA8nirp6.js → text-field-CrRBrXx0.js} +28 -45
- package/dist/cdn/chunks/{time-field-Dd_TxJuf.js → time-field-DUt1zvLw.js} +66 -148
- package/dist/cdn/chunks/{time-picker-B0-rv1qp.js → time-picker-CDzillxF.js} +119 -40
- package/dist/cdn/chunks/{title-DOoPdG_i.js → title-DQXyEqFW.js} +12 -12
- package/dist/cdn/chunks/{title-cell-BzCNOMGr.js → title-cell-CoUK6h-F.js} +23 -23
- package/dist/cdn/chunks/{toggle-button-9PbDHviQ.js → toggle-button-BhU5vLF8.js} +41 -54
- package/dist/cdn/chunks/{toggle-button-group-C-H-xp0M.js → toggle-button-group-B-0r4xZZ.js} +40 -54
- package/dist/cdn/chunks/{token-CMKFC3gz.js → token-CELUzY2p.js} +31 -34
- package/dist/cdn/chunks/{token-field-D4-XHfnG.js → token-field-C8ynyISX.js} +67 -57
- package/dist/cdn/chunks/{toolbar-z9OhEE5l.js → toolbar--QBCm9qO.js} +34 -78
- package/dist/cdn/chunks/{toolbar-item-ZYoyKOyy.js → toolbar-item-BoRhKFDR.js} +3 -3
- package/dist/cdn/chunks/{toolbar-title-FKtQ8ZC4.js → toolbar-title-CciXdTJR.js} +4 -4
- package/dist/cdn/chunks/{toolbar.styles-DDjpdCHV.js → toolbar.styles-B6kTrAfC.js} +3 -3
- package/dist/cdn/chunks/{tooltip-BvRNYRo3.js → tooltip-CkLC4ooQ.js} +43 -41
- package/dist/cdn/chunks/{top-navigation-bar-BHPQntER.js → top-navigation-bar-CGu2pn4Z.js} +29 -29
- package/dist/cdn/chunks/{top-title-bar-BVjegLlh.js → top-title-bar-2b-XHftB.js} +15 -15
- package/dist/cdn/chunks/{translations-cJjO6nQV.js → translations-D0cgmONm.js} +1 -1
- package/dist/cdn/chunks/{two-thirds-one-third-section-BdBHQuXc.js → two-thirds-one-third-section-CEfd273Z.js} +6 -6
- package/dist/cdn/chunks/{validation-list-5E3-3_95.js → validation-list-DIFEVSIk.js} +12 -12
- package/dist/cdn/chunks/{visibility-mixin-DvRe3O8t.js → visibility-mixin-OjALtpXa.js} +14 -14
- package/dist/cdn/chunks/{visually-hidden-F85D_HcR.js → visually-hidden-DcpY5lun.js} +2 -2
- package/dist/cdn/chunks/{window-CabW35M1.js → window-BGZCu06O.js} +44 -80
- package/dist/cdn/chunks/{with-translations-BHDG37HJ.js → with-translations-DkNkjQym.js} +3 -3
- package/dist/components/actions/button/button.d.ts +4 -4
- package/dist/components/actions/button/button.d.ts.map +1 -1
- package/dist/components/actions/button/button.js +4 -5
- package/dist/components/actions/button/button.js.map +1 -1
- package/dist/components/actions/button/button.template.js +1 -1
- package/dist/components/actions/button/button.template.js.map +1 -1
- package/dist/components/actions/icon-button/icon-button.d.ts +4 -4
- package/dist/components/actions/icon-button/icon-button.d.ts.map +1 -1
- package/dist/components/actions/icon-button/icon-button.js +4 -5
- package/dist/components/actions/icon-button/icon-button.js.map +1 -1
- package/dist/components/actions/icon-button/icon-button.template.js +1 -1
- package/dist/components/actions/icon-button/icon-button.template.js.map +1 -1
- package/dist/components/actions/menu/menu.d.ts +22 -6
- package/dist/components/actions/menu/menu.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.js +50 -70
- package/dist/components/actions/menu/menu.js.map +1 -1
- package/dist/components/actions/split-button/split-button.js +1 -1
- package/dist/components/actions/split-button/split-button.js.map +1 -1
- package/dist/components/actions/toolbar/toolbar.d.ts +3 -3
- package/dist/components/actions/toolbar/toolbar.d.ts.map +1 -1
- package/dist/components/actions/toolbar/toolbar.js +4 -4
- package/dist/components/actions/toolbar/toolbar.js.map +1 -1
- package/dist/components/actions/toolbar/toolbar.template.d.ts.map +1 -1
- package/dist/components/actions/toolbar/toolbar.template.js +5 -9
- package/dist/components/actions/toolbar/toolbar.template.js.map +1 -1
- package/dist/components/content/avatar-group/avatar-group.d.ts +7 -1
- package/dist/components/content/avatar-group/avatar-group.d.ts.map +1 -1
- package/dist/components/content/avatar-group/avatar-group.js +9 -9
- package/dist/components/content/avatar-group/avatar-group.js.map +1 -1
- package/dist/components/content/avatar-group/avatar-group.template.d.ts.map +1 -1
- package/dist/components/content/avatar-group/avatar-group.template.js +0 -1
- package/dist/components/content/avatar-group/avatar-group.template.js.map +1 -1
- package/dist/components/content/term/term.d.ts +5 -5
- package/dist/components/content/term/term.d.ts.map +1 -1
- package/dist/components/content/term/term.js +22 -23
- package/dist/components/content/term/term.js.map +1 -1
- package/dist/components/content/term/term.template.js +1 -1
- package/dist/components/content/term/term.template.js.map +1 -1
- package/dist/components/content/token/token.d.ts +3 -5
- package/dist/components/content/token/token.d.ts.map +1 -1
- package/dist/components/content/token/token.js +23 -33
- package/dist/components/content/token/token.js.map +1 -1
- package/dist/components/content/tooltip/tooltip.d.ts +3 -5
- package/dist/components/content/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/content/tooltip/tooltip.js +34 -119
- package/dist/components/content/tooltip/tooltip.js.map +1 -1
- package/dist/components/forms/form-field/form-field.d.ts.map +1 -1
- package/dist/components/forms/form-field/form-field.js +4 -1
- package/dist/components/forms/form-field/form-field.js.map +1 -1
- package/dist/components/inputs/checkbox/checkbox.d.ts +1 -4
- package/dist/components/inputs/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/inputs/checkbox/checkbox.js +3 -23
- package/dist/components/inputs/checkbox/checkbox.js.map +1 -1
- package/dist/components/inputs/checkbox-field/checkbox-field.d.ts +1 -5
- package/dist/components/inputs/checkbox-field/checkbox-field.d.ts.map +1 -1
- package/dist/components/inputs/checkbox-field/checkbox-field.js +8 -17
- package/dist/components/inputs/checkbox-field/checkbox-field.js.map +1 -1
- package/dist/components/inputs/checkbox-group/checkbox-group.d.ts +1 -9
- package/dist/components/inputs/checkbox-group/checkbox-group.d.ts.map +1 -1
- package/dist/components/inputs/checkbox-group/checkbox-group.js +18 -59
- package/dist/components/inputs/checkbox-group/checkbox-group.js.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.d.ts +6 -7
- package/dist/components/inputs/combo-box/combo-box.d.ts.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.js +25 -58
- package/dist/components/inputs/combo-box/combo-box.js.map +1 -1
- package/dist/components/inputs/date-field/date-field.d.ts +1 -2
- package/dist/components/inputs/date-field/date-field.d.ts.map +1 -1
- package/dist/components/inputs/date-field/date-field.js +4 -14
- package/dist/components/inputs/date-field/date-field.js.map +1 -1
- package/dist/components/inputs/file-field/file-field.d.ts +6 -3
- package/dist/components/inputs/file-field/file-field.d.ts.map +1 -1
- package/dist/components/inputs/file-field/file-field.js +15 -18
- package/dist/components/inputs/file-field/file-field.js.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.d.ts +1 -4
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.d.ts.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.js +3 -23
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.js.map +1 -1
- package/dist/components/inputs/number-field/number-field.d.ts +4 -3
- package/dist/components/inputs/number-field/number-field.d.ts.map +1 -1
- package/dist/components/inputs/number-field/number-field.js +12 -16
- package/dist/components/inputs/number-field/number-field.js.map +1 -1
- package/dist/components/inputs/one-time-code-field/one-time-code-field.d.ts +1 -4
- package/dist/components/inputs/one-time-code-field/one-time-code-field.d.ts.map +1 -1
- package/dist/components/inputs/one-time-code-field/one-time-code-field.js +2 -17
- package/dist/components/inputs/one-time-code-field/one-time-code-field.js.map +1 -1
- package/dist/components/inputs/password-field/password-field.d.ts +1 -4
- package/dist/components/inputs/password-field/password-field.d.ts.map +1 -1
- package/dist/components/inputs/password-field/password-field.js +3 -23
- package/dist/components/inputs/password-field/password-field.js.map +1 -1
- package/dist/components/inputs/radio-button/radio-button.d.ts +1 -4
- package/dist/components/inputs/radio-button/radio-button.d.ts.map +1 -1
- package/dist/components/inputs/radio-button/radio-button.js +1 -10
- package/dist/components/inputs/radio-button/radio-button.js.map +1 -1
- package/dist/components/inputs/radio-button-field/radio-button-field.d.ts +3 -6
- package/dist/components/inputs/radio-button-field/radio-button-field.d.ts.map +1 -1
- package/dist/components/inputs/radio-button-field/radio-button-field.js +6 -14
- package/dist/components/inputs/radio-button-field/radio-button-field.js.map +1 -1
- package/dist/components/inputs/radio-button-group/radio-button-group.d.ts +1 -10
- package/dist/components/inputs/radio-button-group/radio-button-group.d.ts.map +1 -1
- package/dist/components/inputs/radio-button-group/radio-button-group.js +17 -74
- package/dist/components/inputs/radio-button-group/radio-button-group.js.map +1 -1
- package/dist/components/inputs/search-field/search-field.d.ts +1 -4
- package/dist/components/inputs/search-field/search-field.d.ts.map +1 -1
- package/dist/components/inputs/search-field/search-field.js +5 -35
- package/dist/components/inputs/search-field/search-field.js.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.d.ts +1 -3
- package/dist/components/inputs/segmented-control/segmented-control.d.ts.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.js +6 -41
- package/dist/components/inputs/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/inputs/slider/slider.d.ts +1 -4
- package/dist/components/inputs/slider/slider.d.ts.map +1 -1
- package/dist/components/inputs/slider/slider.js +1 -14
- package/dist/components/inputs/slider/slider.js.map +1 -1
- package/dist/components/inputs/stepper/stepper.d.ts +1 -3
- package/dist/components/inputs/stepper/stepper.d.ts.map +1 -1
- package/dist/components/inputs/stepper/stepper.js +2 -13
- package/dist/components/inputs/stepper/stepper.js.map +1 -1
- package/dist/components/inputs/swatch-picker/swatch-picker.d.ts +1 -3
- package/dist/components/inputs/swatch-picker/swatch-picker.d.ts.map +1 -1
- package/dist/components/inputs/swatch-picker/swatch-picker.js +5 -28
- package/dist/components/inputs/swatch-picker/swatch-picker.js.map +1 -1
- package/dist/components/inputs/switch/switch.d.ts +1 -4
- package/dist/components/inputs/switch/switch.d.ts.map +1 -1
- package/dist/components/inputs/switch/switch.js +3 -22
- package/dist/components/inputs/switch/switch.js.map +1 -1
- package/dist/components/inputs/switch-field/switch-field.d.ts +1 -4
- package/dist/components/inputs/switch-field/switch-field.d.ts.map +1 -1
- package/dist/components/inputs/switch-field/switch-field.js +2 -16
- package/dist/components/inputs/switch-field/switch-field.js.map +1 -1
- package/dist/components/inputs/text-field/text-field.d.ts +1 -4
- package/dist/components/inputs/text-field/text-field.d.ts.map +1 -1
- package/dist/components/inputs/text-field/text-field.js +3 -23
- package/dist/components/inputs/text-field/text-field.js.map +1 -1
- package/dist/components/inputs/time-field/time-field.d.ts +8 -2
- package/dist/components/inputs/time-field/time-field.d.ts.map +1 -1
- package/dist/components/inputs/time-field/time-field.js +23 -14
- package/dist/components/inputs/time-field/time-field.js.map +1 -1
- package/dist/components/inputs/time-picker/time-picker.d.ts +11 -7
- package/dist/components/inputs/time-picker/time-picker.d.ts.map +1 -1
- package/dist/components/inputs/time-picker/time-picker.js +19 -14
- package/dist/components/inputs/time-picker/time-picker.js.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.d.ts +3 -6
- package/dist/components/inputs/toggle-button/toggle-button.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.js +6 -20
- package/dist/components/inputs/toggle-button/toggle-button.js.map +1 -1
- package/dist/components/inputs/toggle-button-group/toggle-button-group.d.ts +2 -11
- package/dist/components/inputs/toggle-button-group/toggle-button-group.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button-group/toggle-button-group.js +23 -78
- package/dist/components/inputs/toggle-button-group/toggle-button-group.js.map +1 -1
- package/dist/components/inputs/token-field/token-field.d.ts +12 -10
- package/dist/components/inputs/token-field/token-field.d.ts.map +1 -1
- package/dist/components/inputs/token-field/token-field.js +33 -35
- package/dist/components/inputs/token-field/token-field.js.map +1 -1
- package/dist/components/layout/kanban/kanban.d.ts +0 -1
- package/dist/components/layout/kanban/kanban.d.ts.map +1 -1
- package/dist/components/layout/kanban/kanban.js +2 -7
- package/dist/components/layout/kanban/kanban.js.map +1 -1
- package/dist/components/layout/popover/popover.d.ts +17 -3
- package/dist/components/layout/popover/popover.d.ts.map +1 -1
- package/dist/components/layout/popover/popover.js +34 -126
- package/dist/components/layout/popover/popover.js.map +1 -1
- package/dist/components/layout/sheet/sheet.d.ts +2 -33
- package/dist/components/layout/sheet/sheet.d.ts.map +1 -1
- package/dist/components/layout/sheet/sheet.js +8 -169
- package/dist/components/layout/sheet/sheet.js.map +1 -1
- package/dist/components/layout/sheet/sheet.template.js +5 -5
- package/dist/components/layout/sheet/sheet.template.js.map +1 -1
- package/dist/components/layout/window/window.d.ts +2 -30
- package/dist/components/layout/window/window.d.ts.map +1 -1
- package/dist/components/layout/window/window.js +12 -139
- package/dist/components/layout/window/window.js.map +1 -1
- package/dist/components/layout/window/window.template.d.ts.map +1 -1
- package/dist/components/layout/window/window.template.js +5 -4
- package/dist/components/layout/window/window.template.js.map +1 -1
- package/dist/components/lists-and-tables/list/list.d.ts +8 -32
- package/dist/components/lists-and-tables/list/list.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list/list.js +37 -136
- package/dist/components/lists-and-tables/list/list.js.map +1 -1
- package/dist/components/lists-and-tables/list/list.roving.d.ts +79 -0
- package/dist/components/lists-and-tables/list/list.roving.d.ts.map +1 -0
- package/dist/components/lists-and-tables/list/list.roving.js +122 -0
- package/dist/components/lists-and-tables/list/list.roving.js.map +1 -0
- package/dist/components/lists-and-tables/list-item/list-item.d.ts +32 -17
- package/dist/components/lists-and-tables/list-item/list-item.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.js +49 -36
- package/dist/components/lists-and-tables/list-item/list-item.js.map +1 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.d.ts +3 -2
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.js +5 -5
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.js.map +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.d.ts +4 -5
- package/dist/components/navigation/document-tab-bar/document-tab-bar.d.ts.map +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.js +12 -63
- package/dist/components/navigation/document-tab-bar/document-tab-bar.js.map +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.template.d.ts.map +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.template.js +5 -7
- package/dist/components/navigation/document-tab-bar/document-tab-bar.template.js.map +1 -1
- package/dist/components/navigation/link/link.d.ts +2 -2
- package/dist/components/navigation/link/link.d.ts.map +1 -1
- package/dist/components/navigation/link/link.js +2 -2
- package/dist/components/navigation/link/link.js.map +1 -1
- package/dist/components/navigation/menu-bar/menu-bar.d.ts +11 -17
- package/dist/components/navigation/menu-bar/menu-bar.d.ts.map +1 -1
- package/dist/components/navigation/menu-bar/menu-bar.js +44 -71
- package/dist/components/navigation/menu-bar/menu-bar.js.map +1 -1
- package/dist/components/navigation/menu-bar/menu-bar.template.js +2 -2
- package/dist/components/navigation/menu-bar-item/menu-bar-item.d.ts +2 -3
- package/dist/components/navigation/menu-bar-item/menu-bar-item.d.ts.map +1 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.js +14 -30
- package/dist/components/navigation/menu-bar-item/menu-bar-item.js.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.d.ts +8 -2
- package/dist/components/navigation/tab-bar/tab-bar.d.ts.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.js +18 -4
- package/dist/components/navigation/tab-bar/tab-bar.js.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.template.d.ts.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.template.js +4 -2
- package/dist/components/navigation/tab-bar/tab-bar.template.js.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.d.ts +2 -22
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.d.ts.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.js +4 -124
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.template.d.ts.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.template.js +5 -3
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.template.js.map +1 -1
- package/dist/nldd.min.js +855 -851
- package/dist/types/react.d.ts +96 -6
- package/dist/types/vue.d.ts +182 -9
- package/dist/utilities/choice-group.d.ts +91 -0
- package/dist/utilities/choice-group.d.ts.map +1 -0
- package/dist/utilities/choice-group.js +135 -0
- package/dist/utilities/choice-group.js.map +1 -0
- package/dist/utilities/deep-active-element.d.ts +6 -0
- package/dist/utilities/deep-active-element.d.ts.map +1 -0
- package/dist/utilities/deep-active-element.js +11 -0
- package/dist/utilities/deep-active-element.js.map +1 -0
- package/dist/utilities/dev-rules.generated.js +931 -931
- package/dist/utilities/dev-rules.generated.js.map +1 -1
- package/dist/utilities/form-associated-mixin.d.ts +21 -5
- package/dist/utilities/form-associated-mixin.d.ts.map +1 -1
- package/dist/utilities/form-associated-mixin.js +86 -5
- package/dist/utilities/form-associated-mixin.js.map +1 -1
- package/dist/utilities/interest-intent.d.ts +63 -0
- package/dist/utilities/interest-intent.d.ts.map +1 -0
- package/dist/utilities/interest-intent.js +139 -0
- package/dist/utilities/interest-intent.js.map +1 -0
- package/dist/utilities/{interest-controller.d.ts → interest-invoker.d.ts} +5 -14
- package/dist/utilities/interest-invoker.d.ts.map +1 -0
- package/dist/utilities/{interest-controller.js → interest-invoker.js} +39 -97
- package/dist/utilities/interest-invoker.js.map +1 -0
- package/dist/utilities/modal-overlay.d.ts +73 -0
- package/dist/utilities/modal-overlay.d.ts.map +1 -0
- package/dist/utilities/modal-overlay.js +219 -0
- package/dist/utilities/modal-overlay.js.map +1 -0
- package/dist/utilities/overflow-menu.d.ts +97 -0
- package/dist/utilities/overflow-menu.d.ts.map +1 -0
- package/dist/utilities/overflow-menu.js +209 -0
- package/dist/utilities/overflow-menu.js.map +1 -0
- package/dist/utilities/overlay-invoker.d.ts +185 -0
- package/dist/utilities/overlay-invoker.d.ts.map +1 -0
- package/dist/utilities/overlay-invoker.js +326 -0
- package/dist/utilities/overlay-invoker.js.map +1 -0
- package/dist/utilities/page-section-mixin.d.ts +11 -0
- package/dist/utilities/page-section-mixin.d.ts.map +1 -1
- package/dist/utilities/page-section-mixin.js +11 -0
- package/dist/utilities/page-section-mixin.js.map +1 -1
- package/dist/utilities/return-focus.d.ts +0 -2
- package/dist/utilities/return-focus.d.ts.map +1 -1
- package/dist/utilities/return-focus.js +1 -7
- package/dist/utilities/return-focus.js.map +1 -1
- package/dist/utilities/with-translations.d.ts +3 -0
- package/dist/utilities/with-translations.d.ts.map +1 -1
- package/dist/utilities/with-translations.js +3 -0
- package/dist/utilities/with-translations.js.map +1 -1
- package/lint/data.generated.json +1 -1
- package/lint/engine.js +4 -114
- package/lint/fix.js +53 -136
- package/lint/frontends.js +68 -6
- package/lint/linter.js +1 -0
- package/lint/main.js +21 -123
- package/lint/project.js +31 -0
- package/lint/rule-compiler.js +289 -0
- package/lint/session.js +127 -0
- package/lint/tree.js +46 -0
- package/package.json +5 -3
- package/dist/cdn/chunks/checkbox-group-CC72cq-P.js +0 -103
- package/dist/cdn/chunks/form-associated-mixin-BtStDDYA.js +0 -73
- package/dist/cdn/chunks/open-when-rendered-CW_2_WUZ.js +0 -20
- package/dist/cdn/chunks/popover-target-B25dxnmt.js +0 -10
- package/dist/cdn/chunks/popup-anchor-controller-VZw0bXf2.js +0 -30
- package/dist/cdn/chunks/radio-button-group-D_OezDhB.js +0 -124
- package/dist/components/actions/toolbar/toolbar.overflow-menu.d.ts +0 -52
- package/dist/components/actions/toolbar/toolbar.overflow-menu.d.ts.map +0 -1
- package/dist/components/actions/toolbar/toolbar.overflow-menu.js +0 -105
- package/dist/components/actions/toolbar/toolbar.overflow-menu.js.map +0 -1
- package/dist/utilities/interest-controller.d.ts.map +0 -1
- package/dist/utilities/interest-controller.js.map +0 -1
- package/dist/utilities/open-when-rendered.d.ts +0 -21
- package/dist/utilities/open-when-rendered.d.ts.map +0 -1
- package/dist/utilities/open-when-rendered.js +0 -30
- package/dist/utilities/open-when-rendered.js.map +0 -1
- package/dist/utilities/popover-target.d.ts +0 -25
- package/dist/utilities/popover-target.d.ts.map +0 -1
- package/dist/utilities/popover-target.js +0 -48
- package/dist/utilities/popover-target.js.map +0 -1
- package/dist/utilities/popup-anchor-controller.d.ts +0 -63
- package/dist/utilities/popup-anchor-controller.d.ts.map +0 -1
- package/dist/utilities/popup-anchor-controller.js +0 -72
- package/dist/utilities/popup-anchor-controller.js.map +0 -1
package/lint/engine.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import { compile } from 'css-select';
|
|
13
13
|
import { parse } from 'css-what';
|
|
14
|
-
import {
|
|
14
|
+
import { favorableName, sourcePseudos } from './rule-compiler.js';
|
|
15
15
|
import { BOUND, adapter, walk } from './tree.js';
|
|
16
16
|
|
|
17
17
|
/** In W+ a sibling behind a condition might not show, as with `v-if`, `v-else` and tabs on `v-show`. */
|
|
@@ -23,97 +23,6 @@ const favorableAdapter = {
|
|
|
23
23
|
|
|
24
24
|
const BUILT_IN_PSEUDOS = new Set(['is', 'not', 'has', 'where', 'matches']);
|
|
25
25
|
|
|
26
|
-
/**
|
|
27
|
-
* Whether a field hands its label to `target`, as _findInput in nldd-form-field does:
|
|
28
|
-
* the first input in document order, helper text left out. The answer is `maybe` when
|
|
29
|
-
* something before it may or may not be an input that renders.
|
|
30
|
-
*/
|
|
31
|
-
function findsInput(node, target, isInput, uncertain = false) {
|
|
32
|
-
let maybe = uncertain;
|
|
33
|
-
for (const child of node.children) {
|
|
34
|
-
if (child.name === 'nldd-form-field-help-text') continue;
|
|
35
|
-
const unsure = maybe || child.conditional || child.repeated;
|
|
36
|
-
if (child === target) return maybe ? 'maybe' : 'yes';
|
|
37
|
-
if (isInput(child)) {
|
|
38
|
-
if (!unsure) return 'no';
|
|
39
|
-
maybe = true;
|
|
40
|
-
}
|
|
41
|
-
if (child.opaque) maybe = true;
|
|
42
|
-
const inside = findsInput(child, target, isInput, unsure);
|
|
43
|
-
if (inside !== 'absent') return inside;
|
|
44
|
-
}
|
|
45
|
-
return 'absent';
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* On a running page the attribute is simply there, so the browser checks leave this
|
|
50
|
-
* out. In source it has to be worked out.
|
|
51
|
-
*/
|
|
52
|
-
function createFieldLabelCheck(isInput, allowMaybe) {
|
|
53
|
-
return (node) => {
|
|
54
|
-
for (let parent = node.parent; parent; parent = parent.parent) {
|
|
55
|
-
if (parent.name === 'nldd-form-field') {
|
|
56
|
-
const label = parent.attrs.get('label');
|
|
57
|
-
const unknownLabel = label === BOUND || parent.spread;
|
|
58
|
-
if (!unknownLabel && !label) return false;
|
|
59
|
-
const found = findsInput(parent, node, isInput);
|
|
60
|
-
if (found === 'yes' && !unknownLabel) return true;
|
|
61
|
-
return allowMaybe && found !== 'no';
|
|
62
|
-
}
|
|
63
|
-
if (parent.opaque) return allowMaybe;
|
|
64
|
-
}
|
|
65
|
-
return false;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Whether the nearest component around a plain element styles it, as nldd-dropdown
|
|
71
|
-
* does its <select> and nldd-rich-text everything in it. Each component says so
|
|
72
|
-
* with `@accepts` in its JSDoc.
|
|
73
|
-
*
|
|
74
|
-
* What a file renders is judged in that file: that a parent elsewhere might put it
|
|
75
|
-
* inside an nldd-rich-text does not make plain HTML written here the design system's. A
|
|
76
|
-
* tree the file builds under a name (a helper component, a variable) is judged where
|
|
77
|
-
* the file uses that name. Used nowhere here, or under a component of the app, it is
|
|
78
|
-
* unknown.
|
|
79
|
-
*/
|
|
80
|
-
function createAcceptedCheck(tags, allowUnknown) {
|
|
81
|
-
// `chain` holds the plain elements between the node and the component: the
|
|
82
|
-
// component styles its own children (::slotted) or descendants of what it styles,
|
|
83
|
-
// so each of them has to be accepted too. `seen` keeps a component that places
|
|
84
|
-
// itself from going round in circles.
|
|
85
|
-
const accepted = (node, from, chain, seen) => {
|
|
86
|
-
for (let parent = from; parent; parent = parent.parent) {
|
|
87
|
-
if (parent.name === '#root') {
|
|
88
|
-
if (!parent.detached) return false;
|
|
89
|
-
if (!parent.placements) return allowUnknown;
|
|
90
|
-
if (seen.has(parent)) return false;
|
|
91
|
-
const next = new Set(seen).add(parent);
|
|
92
|
-
// Accepted in any of the places the file uses it is enough.
|
|
93
|
-
return parent.placements.some((place) => accepted(node, place.parent, chain, next));
|
|
94
|
-
}
|
|
95
|
-
if (parent.opaque) return allowUnknown;
|
|
96
|
-
if (!parent.name.startsWith('nldd-')) {
|
|
97
|
-
chain.push(parent.name);
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
const accepts = tags[parent.name]?.accepts ?? [];
|
|
101
|
-
return accepts.includes('*') || [node.name, ...chain].every((name) => accepts.includes(name));
|
|
102
|
-
}
|
|
103
|
-
return false;
|
|
104
|
-
};
|
|
105
|
-
return (node) => accepted(node, node.parent, [], new Set());
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function classPseudos(classes) {
|
|
109
|
-
return Object.fromEntries(
|
|
110
|
-
Object.entries(classes).map(([name, tags]) => {
|
|
111
|
-
const members = new Set(tags);
|
|
112
|
-
return [name, (node) => members.has(node.name)];
|
|
113
|
-
}),
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
26
|
/**
|
|
118
27
|
* Rewrites a selector for one world. W+ lets what is unknown match, W- does not, and
|
|
119
28
|
* `:not()` turns that around: unknown content that might be `x` makes `:not(x)` true
|
|
@@ -127,8 +36,7 @@ function forWorld(tokens, classes, widen) {
|
|
|
127
36
|
return { ...token, data: token.data.map((each) => forWorld(each, classes, inner)) };
|
|
128
37
|
}
|
|
129
38
|
if (!widen) return token;
|
|
130
|
-
if (token.type === 'pseudo' && token.name
|
|
131
|
-
if (token.type === 'pseudo' && token.name === 'accepted') return { ...token, name: 'may-be-accepted' };
|
|
39
|
+
if (token.type === 'pseudo' && favorableName(token.name) !== token.name) return { ...token, name: favorableName(token.name) };
|
|
132
40
|
if (token.type === 'tag' || (token.type === 'pseudo' && token.name in classes)) {
|
|
133
41
|
return { type: 'pseudo', name: 'is', data: [[token], [unknown]] };
|
|
134
42
|
}
|
|
@@ -143,28 +51,10 @@ function forWorld(tokens, classes, widen) {
|
|
|
143
51
|
}
|
|
144
52
|
|
|
145
53
|
export function createEngine({ classes = {}, tags = {}, designSystemCss = {} } = {}) {
|
|
146
|
-
const shared = classPseudos(classes);
|
|
147
54
|
const pseudos = {
|
|
148
|
-
...
|
|
149
|
-
|
|
150
|
-
'may-be-named-by-field': createFieldLabelCheck(shared['form-input'] ?? (() => false), true),
|
|
151
|
-
accepted: createAcceptedCheck(tags, false),
|
|
152
|
-
'may-be-accepted': createAcceptedCheck(tags, true),
|
|
153
|
-
// Inside an element of this name in this file. A drawing's own classes and styles are its business.
|
|
154
|
-
within: (node, name) => {
|
|
155
|
-
for (let parent = node.parent; parent; parent = parent.parent) if (parent.name === name) return true;
|
|
156
|
-
return false;
|
|
157
|
-
},
|
|
158
|
-
// CSS the design system ships: a block it recognizes, or a stylesheet with nothing else in it.
|
|
159
|
-
'design-system': (node) => node.designSystem ?? (node.css !== undefined && isDesignSystemCss(node.css, designSystemCss)),
|
|
160
|
-
// No element and no text: an empty mount point such as <div id="app"></div>.
|
|
161
|
-
blank: (node) => node.children.length === 0 && !node.text,
|
|
162
|
-
// Only exists on a running page, so in source it is never true.
|
|
163
|
-
state: () => false,
|
|
55
|
+
...sourcePseudos({ classes, tags, designSystemCss }),
|
|
56
|
+
// Engine-only: how forWorld lets what is unknown match in W+.
|
|
164
57
|
unknown: (node) => node.opaque,
|
|
165
|
-
// The attribute is in the markup, with a value or bound to one. `[class]` asks for a
|
|
166
|
-
// value we can read, so a bound class would only ever be cantTell.
|
|
167
|
-
written: (node, name) => node.attrs.has(name),
|
|
168
58
|
bound: (node, name) => node.opaque || node.spread || node.attrs.get(name) === BOUND,
|
|
169
59
|
};
|
|
170
60
|
const cache = new Map();
|
package/lint/fix.js
CHANGED
|
@@ -1,154 +1,71 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Applies what `--fix` may do without anyone looking. A rule says what changes, in
|
|
3
3
|
* its `fix`; this file knows how that is written in each framework. A fix works on
|
|
4
|
-
* the text of the file, so the rest of it stays exactly as it was.
|
|
4
|
+
* the text of the file, so the rest of it stays exactly as it was. Where an
|
|
5
|
+
* attribute stands comes from the parser (`startTag` on the node, see tree.js):
|
|
6
|
+
* nothing here reads a tag again.
|
|
5
7
|
*/
|
|
6
8
|
|
|
7
9
|
const toCamelCase = (name) => name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
8
10
|
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* The closing quote of the string at `start`, past the holes in it, which hold
|
|
14
|
-
* quotes of their own. A backslash escapes only in code: HTML has no such thing.
|
|
15
|
-
*/
|
|
16
|
-
function endOfString(source, start, inCode = false) {
|
|
17
|
-
for (let at = start + 1; at < source.length; at++) {
|
|
18
|
-
if (inCode && source[at] === '\\') at += 1;
|
|
19
|
-
else if (source[at] === source[start]) return at;
|
|
20
|
-
else if (isHole(source, at)) {
|
|
21
|
-
at = endOfBraces(source, source.indexOf('{', at));
|
|
22
|
-
if (at === undefined) return undefined;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return undefined;
|
|
11
|
+
/** An attribute as the parser read it, under its own name or in camelCase. */
|
|
12
|
+
function findAttribute(startTag, name) {
|
|
13
|
+
const names = [name, toCamelCase(name)];
|
|
14
|
+
return startTag?.attributes.find((attribute) => names.includes(attribute.name));
|
|
26
15
|
}
|
|
27
16
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const char = source[at];
|
|
33
|
-
if (source.startsWith('/*', at)) {
|
|
34
|
-
at = source.indexOf('*/', at) + 1;
|
|
35
|
-
if (at === 0) return undefined;
|
|
36
|
-
} else if (source.startsWith('//', at)) {
|
|
37
|
-
at = source.indexOf('\n', at);
|
|
38
|
-
if (at === -1) return undefined;
|
|
39
|
-
} else if (/["'`]/.test(char)) {
|
|
40
|
-
at = endOfString(source, at, true);
|
|
41
|
-
if (at === undefined) return undefined;
|
|
42
|
-
} else if (char === '{') depth += 1;
|
|
43
|
-
else if (char === '}' && --depth === 0) return at;
|
|
44
|
-
}
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/** The start tag from `start`, with strings and `{ }` blanked: a value can hold anything. */
|
|
49
|
-
function maskedTag(source, start) {
|
|
50
|
-
let masked = '';
|
|
51
|
-
for (let at = start; at < source.length; at++) {
|
|
52
|
-
const char = source[at];
|
|
53
|
-
const quoted = /["'`]/.test(char);
|
|
54
|
-
if (char === '>') return masked;
|
|
55
|
-
if (quoted || char === '{') {
|
|
56
|
-
const end = quoted ? endOfString(source, at) : endOfBraces(source, at);
|
|
57
|
-
if (end === undefined) return masked;
|
|
58
|
-
masked += ' '.repeat(end - at + 1);
|
|
59
|
-
at = end;
|
|
60
|
-
} else masked += char;
|
|
61
|
-
}
|
|
62
|
-
return masked;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/** Vue, Alpine, Lit and Angular write a name with a prefix, and JSX bare. */
|
|
66
|
-
function attributePattern(name) {
|
|
67
|
-
const names = [...new Set([name, toCamelCase(name)])].join('|');
|
|
68
|
-
return new RegExp(`(?<=\\s)(:|v-bind:|x-bind:|\\.|\\?|\\[attr\\.|\\[\\(?)?(${names})(?=[\\s=/\\])]|$)`);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/** Where the attribute stands in the start tag at `offset`, if it does. */
|
|
72
|
-
function findAttribute(source, offset, name) {
|
|
73
|
-
const masked = maskedTag(source, offset);
|
|
74
|
-
// A comment in a tag can hold anything, and a line comment takes what follows it.
|
|
75
|
-
if (/\/[*/]/.test(masked)) return undefined;
|
|
76
|
-
const match = attributePattern(name).exec(masked);
|
|
77
|
-
if (!match) return undefined;
|
|
78
|
-
const [, prefix = '', written] = match;
|
|
79
|
-
const start = offset + match.index + prefix.length;
|
|
80
|
-
return { prefix, written, start, end: start + written.length };
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function renameEdits(source, offset, from, to) {
|
|
84
|
-
const found = findAttribute(source, offset, from);
|
|
85
|
-
if (!found || findAttribute(source, offset, to)) return [];
|
|
86
|
-
const { prefix, written, start, end } = found;
|
|
17
|
+
function renameEdits(source, startTag, from, to) {
|
|
18
|
+
const found = findAttribute(startTag, from);
|
|
19
|
+
if (!found || findAttribute(startTag, to)) return [];
|
|
20
|
+
const { prefix, name, nameStart, nameEnd } = found;
|
|
87
21
|
const isProperty = prefix === '.' || (prefix.startsWith('[') && prefix !== '[attr.');
|
|
88
|
-
return [{ from:
|
|
22
|
+
return [{ from: nameStart, to: nameEnd, text: isProperty || name !== from ? toCamelCase(to) : to }];
|
|
89
23
|
}
|
|
90
24
|
|
|
91
25
|
/** Only a value written out in the markup: a bound one can hold anything. */
|
|
92
|
-
function valueEdits(source,
|
|
93
|
-
const found = findAttribute(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
return Object.entries(values).flatMap(([from, to]) =>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return source.startsWith(from, at) && whole ? [{ from: at, to: at + from.length, text: to }] : [];
|
|
102
|
-
});
|
|
26
|
+
function valueEdits(source, startTag, name, values) {
|
|
27
|
+
const found = findAttribute(startTag, name);
|
|
28
|
+
const value = found?.value;
|
|
29
|
+
if (!value || found.prefix || value.quote === '{') return [];
|
|
30
|
+
const at = value.quote ? value.start + 1 : value.start;
|
|
31
|
+
const end = value.quote ? value.end - 1 : value.end;
|
|
32
|
+
return Object.entries(values).flatMap(([from, to]) =>
|
|
33
|
+
at + from.length === end && source.startsWith(from, at) ? [{ from: at, to: end, text: to }] : [],
|
|
34
|
+
);
|
|
103
35
|
}
|
|
104
36
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const closers = /^[\])]*/.exec(source.slice(name))[0].length;
|
|
110
|
-
const equals = /^\s*=\s*/.exec(source.slice(name + closers));
|
|
111
|
-
if (!equals) return name + closers;
|
|
112
|
-
const start = name + closers + equals[0].length;
|
|
113
|
-
if (source.startsWith('{%', start)) return undefined;
|
|
114
|
-
let at = start;
|
|
115
|
-
while (at !== undefined && !endsValue(source, at)) {
|
|
116
|
-
if (/["'`]/.test(source[at])) at = endOfString(source, at);
|
|
117
|
-
else if (source[at] === '{') at = endOfBraces(source, at);
|
|
118
|
-
if (at !== undefined) at += 1;
|
|
119
|
-
}
|
|
120
|
-
return at;
|
|
37
|
+
/** What stands before an attribute, back to the one before it or the tag name. */
|
|
38
|
+
function gapBefore(source, { offset, tag, startTag }, found) {
|
|
39
|
+
const previous = startTag.attributes.filter((attribute) => attribute.end <= found.start).at(-1);
|
|
40
|
+
return source.slice(previous ? previous.end : offset + 1 + tag.length, found.start);
|
|
121
41
|
}
|
|
122
42
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
if (
|
|
127
|
-
let from = found.start
|
|
43
|
+
/** The whitespace before it goes too; a comment there would swallow what follows. */
|
|
44
|
+
function removeEdits(source, finding, name) {
|
|
45
|
+
const found = findAttribute(finding.startTag, name);
|
|
46
|
+
if (!found || found.templated || /\/[*/]/.test(gapBefore(source, finding, found))) return [];
|
|
47
|
+
let from = found.start;
|
|
128
48
|
while (/\s/.test(source[from - 1])) from -= 1;
|
|
129
|
-
return [{ from, to: end, text: '' }];
|
|
49
|
+
return [{ from, to: found.end, text: '' }];
|
|
130
50
|
}
|
|
131
51
|
|
|
132
52
|
/** A value written out in the markup that became a boolean: the whole attribute
|
|
133
53
|
* turns into the new name. The rule's context says which value that is. */
|
|
134
|
-
function flagEdits(source,
|
|
135
|
-
const found = findAttribute(
|
|
136
|
-
if (!found || found.prefix || findAttribute(
|
|
137
|
-
|
|
138
|
-
if (end === undefined) return [];
|
|
139
|
-
return [{ from: found.start, to: end, text: to }];
|
|
54
|
+
function flagEdits(source, startTag, from, to) {
|
|
55
|
+
const found = findAttribute(startTag, from);
|
|
56
|
+
if (!found || found.prefix || found.templated || findAttribute(startTag, to)) return [];
|
|
57
|
+
return [{ from: found.start, to: found.end, text: to }];
|
|
140
58
|
}
|
|
141
59
|
|
|
142
60
|
/**
|
|
143
61
|
* The parser says where an element ends: a comment or a string that looks like its
|
|
144
62
|
* closing tag does not count. Without a closing tag of its own it stays as it is.
|
|
145
63
|
*/
|
|
146
|
-
function tagEdits(source, offset, endOffset, name, to) {
|
|
64
|
+
function tagEdits(source, { offset, endOffset, tag: name, startTag }, to) {
|
|
147
65
|
// An element the file never closes ends past the last character.
|
|
148
|
-
if (endOffset === undefined || endOffset >= source.length || !source.startsWith(`<${name}`, offset)) return [];
|
|
66
|
+
if (!startTag || endOffset === undefined || endOffset >= source.length || !source.startsWith(`<${name}`, offset)) return [];
|
|
149
67
|
const open = { from: offset + 1, to: offset + 1 + name.length, text: to };
|
|
150
|
-
|
|
151
|
-
if (startTag.trimEnd().endsWith('/') && offset + startTag.length === endOffset) return [open];
|
|
68
|
+
if (startTag.selfClosing && startTag.end === endOffset) return [open];
|
|
152
69
|
const closing = source.lastIndexOf('</', endOffset);
|
|
153
70
|
if (closing <= offset || !new RegExp(`^</${name}\\s*>$`).test(source.slice(closing, endOffset + 1))) return [];
|
|
154
71
|
return [open, { from: closing + 2, to: closing + 2 + name.length, text: to, closing: true }];
|
|
@@ -159,24 +76,23 @@ function tagEdits(source, offset, endOffset, name, to) {
|
|
|
159
76
|
* file says it for certain: no hole a template fills (`{ }`, `${ }`, `{{ }}`)
|
|
160
77
|
* and no comment, which could hold anything.
|
|
161
78
|
*/
|
|
162
|
-
function contentOf(source, offset, endOffset, name) {
|
|
163
|
-
if (endOffset === undefined || endOffset >= source.length || !source.startsWith(`<${name}`, offset)) return undefined;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const start = offset + startTag.length + 1;
|
|
79
|
+
function contentOf(source, { offset, endOffset, tag: name, startTag }) {
|
|
80
|
+
if (!startTag || endOffset === undefined || endOffset >= source.length || !source.startsWith(`<${name}`, offset)) return undefined;
|
|
81
|
+
if (startTag.selfClosing) return undefined;
|
|
82
|
+
const start = startTag.end + 1;
|
|
167
83
|
const closing = source.lastIndexOf('</', endOffset);
|
|
168
84
|
if (closing < start || !new RegExp(`^</${name}\\s*>$`).test(source.slice(closing, endOffset + 1))) return undefined;
|
|
169
85
|
const text = source.slice(start, closing);
|
|
170
86
|
if (/[{}]|<!--/.test(text)) return undefined;
|
|
171
|
-
return {
|
|
87
|
+
return { start, end: closing, text };
|
|
172
88
|
}
|
|
173
89
|
|
|
174
90
|
/** Elements that stand in a line of text, and so in a `<p>`. */
|
|
175
91
|
const INLINE = new Set(['a', 'abbr', 'b', 'br', 'cite', 'code', 'del', 'em', 'i', 'ins', 'kbd', 'mark', 'q', 's', 'samp', 'small', 'span', 'strong', 'sub', 'sup', 'time', 'u', 'var', 'nldd-avatar', 'nldd-badge', 'nldd-icon', 'nldd-link', 'nldd-status-dot', 'nldd-tag', 'nldd-term', 'nldd-token']);
|
|
176
92
|
|
|
177
93
|
/** Text, with or without inline elements, goes in an element of its own, such as a `<p>`. */
|
|
178
|
-
function wrapEdits(source,
|
|
179
|
-
const content = contentOf(source,
|
|
94
|
+
function wrapEdits(source, finding, wrapper) {
|
|
95
|
+
const content = contentOf(source, finding);
|
|
180
96
|
const inner = content?.text.trim();
|
|
181
97
|
// A blank line ends raw HTML in Markdown, and indenting it leaves trailing space.
|
|
182
98
|
if (!inner || /\n[ \t]*\n/.test(inner)) return [];
|
|
@@ -194,15 +110,16 @@ function wrapEdits(source, { offset, endOffset, tag }, wrapper) {
|
|
|
194
110
|
}
|
|
195
111
|
|
|
196
112
|
/** An edit is `{ from, to, text }` in the source. What is not certain makes none. */
|
|
197
|
-
function editsOf(source,
|
|
113
|
+
function editsOf(source, finding) {
|
|
114
|
+
const { fix, offset, tag, mention, startTag } = finding;
|
|
198
115
|
return [
|
|
199
|
-
...Object.entries(fix.rename ?? {}).flatMap(([from, to]) => renameEdits(source,
|
|
200
|
-
...Object.entries(fix.value ?? {}).flatMap(([name, values]) => valueEdits(source,
|
|
201
|
-
...(fix.remove ?? []).flatMap((name) => removeEdits(source,
|
|
202
|
-
...Object.entries(fix.flag ?? {}).flatMap(([from, to]) => flagEdits(source,
|
|
116
|
+
...Object.entries(fix.rename ?? {}).flatMap(([from, to]) => renameEdits(source, startTag, from, to)),
|
|
117
|
+
...Object.entries(fix.value ?? {}).flatMap(([name, values]) => valueEdits(source, startTag, name, values)),
|
|
118
|
+
...(fix.remove ?? []).flatMap((name) => removeEdits(source, finding, name)),
|
|
119
|
+
...Object.entries(fix.flag ?? {}).flatMap(([from, to]) => flagEdits(source, startTag, from, to)),
|
|
203
120
|
...(fix.tag && mention ? [{ from: offset + 1, to: offset + 1 + tag.length, text: fix.tag }] : []),
|
|
204
|
-
...(fix.tag && !mention ? tagEdits(source,
|
|
205
|
-
...(fix.wrap ? wrapEdits(source,
|
|
121
|
+
...(fix.tag && !mention ? tagEdits(source, finding, fix.tag) : []),
|
|
122
|
+
...(fix.wrap ? wrapEdits(source, finding, fix.wrap) : []),
|
|
206
123
|
];
|
|
207
124
|
}
|
|
208
125
|
|
package/lint/frontends.js
CHANGED
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
* `nldd-list > template[v-for] > nldd-list-item` would break every child selector.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { DomHandler, Parser } from 'htmlparser2';
|
|
11
11
|
import { cssBlocks } from './css.js';
|
|
12
12
|
import {
|
|
13
13
|
BOUND,
|
|
14
14
|
appendChild,
|
|
15
|
+
attributeSpan,
|
|
15
16
|
appendUnknown,
|
|
16
17
|
createNode,
|
|
17
18
|
createRoot,
|
|
@@ -141,6 +142,7 @@ function readHtmlChildren(children, parent, given) {
|
|
|
141
142
|
}
|
|
142
143
|
const element = createNode(name, node.startIndex ?? 0);
|
|
143
144
|
element.endOffset = node.endIndex ?? undefined;
|
|
145
|
+
element.startTag = node.startTag;
|
|
144
146
|
for (const [key, value] of Object.entries(attribs)) {
|
|
145
147
|
// MDX writes JSX: a handler or a prop for React is no attribute.
|
|
146
148
|
if (inherited.jsx && (/^on[A-Z]/.test(key) || REACT_ONLY.has(key))) continue;
|
|
@@ -154,14 +156,53 @@ function readHtmlChildren(children, parent, given) {
|
|
|
154
156
|
}
|
|
155
157
|
}
|
|
156
158
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
+
/**
|
|
160
|
+
* The document handler, plus where each attribute stands: the parser knows it
|
|
161
|
+
* while it reads the tag, and the tree keeps it for `--fix`.
|
|
162
|
+
*/
|
|
163
|
+
class SpanHandler extends DomHandler {
|
|
164
|
+
constructor(source, original, options) {
|
|
165
|
+
super(undefined, options);
|
|
166
|
+
this.source = source;
|
|
167
|
+
this.original = original;
|
|
168
|
+
this.pending = [];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
onattribute(name) {
|
|
172
|
+
const span = attributeSpan(this.source, name, this.parser.startIndex, this.parser.endIndex);
|
|
173
|
+
if (this.original !== this.source) span.templated = this.rewritten(span);
|
|
174
|
+
this.pending.push(span);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** Quieting a template keeps lengths, so a quoted value it filled in still ends where it did. */
|
|
178
|
+
rewritten({ start, end, value }) {
|
|
179
|
+
const [read, written] = [this.source, this.original].map((text) => text.slice(start, end));
|
|
180
|
+
if (read === written) return false;
|
|
181
|
+
const quote = value?.quote;
|
|
182
|
+
const quoted = (quote === '"' || quote === "'") && this.original[value.start] === quote && this.original[end - 1] === quote;
|
|
183
|
+
return !quoted || this.source.slice(start, value.start) !== this.original.slice(start, value.start);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
onopentag(name, attribs) {
|
|
187
|
+
super.onopentag(name, attribs);
|
|
188
|
+
const end = this.parser.endIndex;
|
|
189
|
+
this.tagStack.at(-1).startTag = { end, selfClosing: this.source[end - 1] === '/', attributes: this.pending };
|
|
190
|
+
this.pending = [];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** `original` is the source before quieting a template, of the same length. */
|
|
195
|
+
function parseMarkup(source, { selfClosing, original = source }) {
|
|
196
|
+
const options = {
|
|
159
197
|
lowerCaseTags: false,
|
|
160
198
|
lowerCaseAttributeNames: false,
|
|
161
199
|
recognizeSelfClosing: selfClosing,
|
|
162
200
|
withStartIndices: true,
|
|
163
201
|
withEndIndices: true,
|
|
164
|
-
}
|
|
202
|
+
};
|
|
203
|
+
const handler = new SpanHandler(source, original, options);
|
|
204
|
+
new Parser(handler, options).end(source);
|
|
205
|
+
return handler.root;
|
|
165
206
|
}
|
|
166
207
|
|
|
167
208
|
const OPENS_BLOCK = /^\{%-?\s*(if|for|with|block|macro|call|filter|autoescape|trans|blocktrans)\b/;
|
|
@@ -230,7 +271,7 @@ const quietIfTemplated = (source) => (/\{[%{#]/.test(source) ? quietTemplateTags
|
|
|
230
271
|
|
|
231
272
|
export function parseHtml(source) {
|
|
232
273
|
const root = createRoot({ closed: /<html[\s>]/i.test(source) });
|
|
233
|
-
readHtmlChildren(parseMarkup(quietIfTemplated(source), { selfClosing: ANGULAR.test(source) }).children, root, { inert: true });
|
|
274
|
+
readHtmlChildren(parseMarkup(quietIfTemplated(source), { selfClosing: ANGULAR.test(source), original: source }).children, root, { inert: true });
|
|
234
275
|
return [root];
|
|
235
276
|
}
|
|
236
277
|
|
|
@@ -388,7 +429,7 @@ export function parseMarkdown(source, filename = '') {
|
|
|
388
429
|
const read = (text, offset, given = {}) => {
|
|
389
430
|
const root = createRoot();
|
|
390
431
|
const padded = ' '.repeat(offset) + quietIfTemplated(text);
|
|
391
|
-
readHtmlChildren(parseMarkup(padded, { selfClosing: true }).children, root, given);
|
|
432
|
+
readHtmlChildren(parseMarkup(padded, { selfClosing: true, original: ' '.repeat(offset) + text }).children, root, given);
|
|
392
433
|
roots.push(root);
|
|
393
434
|
};
|
|
394
435
|
const fences = /^( *)(```|~~~)[^\n]*\n([\s\S]*?)^ *\2/gm;
|
|
@@ -708,6 +749,26 @@ function readJsxChildren(children, parent, flags, roots) {
|
|
|
708
749
|
}
|
|
709
750
|
}
|
|
710
751
|
|
|
752
|
+
/** What the parser of JSX says about the start tag, in the shape the HTML parsers give. */
|
|
753
|
+
function jsxStartTag(opening) {
|
|
754
|
+
const attributes = opening.attributes
|
|
755
|
+
.filter((attribute) => attribute.type === 'JSXAttribute')
|
|
756
|
+
.map((attribute) => {
|
|
757
|
+
const { value } = attribute;
|
|
758
|
+
const quote = !value ? undefined : value.type === 'Literal' ? (value.raw?.[0] ?? '"') : '{';
|
|
759
|
+
return {
|
|
760
|
+
name: jsxName(attribute.name),
|
|
761
|
+
prefix: '',
|
|
762
|
+
start: attribute.start,
|
|
763
|
+
end: attribute.end,
|
|
764
|
+
nameStart: attribute.name.start,
|
|
765
|
+
nameEnd: attribute.name.end,
|
|
766
|
+
value: value ? { start: value.start, end: value.end, quote } : undefined,
|
|
767
|
+
};
|
|
768
|
+
});
|
|
769
|
+
return { end: opening.end - 1, selfClosing: opening.selfClosing, attributes };
|
|
770
|
+
}
|
|
771
|
+
|
|
711
772
|
function readJsxNode(node, parent, flags, roots) {
|
|
712
773
|
if (node.type === 'JSXFragment') {
|
|
713
774
|
readJsxChildren(node.children, parent, flags, roots);
|
|
@@ -723,6 +784,7 @@ function readJsxNode(node, parent, flags, roots) {
|
|
|
723
784
|
element.conditional = Boolean(flags.conditional);
|
|
724
785
|
element.repeated = Boolean(flags.repeated);
|
|
725
786
|
element.opaque = isOpaqueTag(name);
|
|
787
|
+
element.startTag = jsxStartTag(node.openingElement);
|
|
726
788
|
readJsxAttributes(element, node.openingElement.attributes, roots);
|
|
727
789
|
appendChild(parent, element);
|
|
728
790
|
readJsxChildren(node.children, element, {}, roots);
|
package/lint/linter.js
CHANGED