@tmorrow/cre8-wc 2.0.7 → 2.0.8
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/a2ui/catalog +5 -5
- package/a2ui/catalog-kg.json +156 -20
- package/a2ui/catalog.json +393 -34
- package/a2ui/catalog.svg +2445 -2445
- package/a2ui/examples/compound-families.json +298 -0
- package/a2ui/examples/llm-observability.json +678 -650
- package/a2ui/generate-catalog.mjs +116 -3
- package/a2ui/inert-props.json +32 -0
- package/a2ui/render-audit.mjs +294 -0
- package/a2ui/renderer.d.ts +2 -1
- package/a2ui/renderer.js +1 -1
- package/a2ui/renderer.ts +1 -1
- package/a2ui/smoke-test.mjs +3 -3
- package/a2ui/stream/diff-test.mjs +299 -0
- package/a2ui/stream/diff.d.ts +28 -0
- package/a2ui/stream/diff.js +130 -0
- package/a2ui/stream/diff.ts +145 -0
- package/a2ui/stream/index.d.ts +11 -0
- package/a2ui/stream/index.js +11 -0
- package/a2ui/stream/index.ts +43 -0
- package/a2ui/stream/model.d.ts +66 -0
- package/a2ui/stream/model.js +429 -0
- package/a2ui/stream/model.ts +472 -0
- package/a2ui/stream/pointer.d.ts +34 -0
- package/a2ui/stream/pointer.js +146 -0
- package/a2ui/stream/pointer.ts +147 -0
- package/a2ui/stream/renderer.d.ts +51 -0
- package/a2ui/stream/renderer.js +282 -0
- package/a2ui/stream/renderer.ts +291 -0
- package/a2ui/stream/stream-test.mjs +592 -0
- package/a2ui/stream/types.d.ts +173 -0
- package/a2ui/stream/types.js +17 -0
- package/a2ui/stream/types.ts +127 -0
- package/cdn/cre8-wc.esm.js +3527 -3226
- package/cdn/cre8-wc.esm.js.map +1 -1
- package/cdn/cre8-wc.min.js +289 -289
- package/cdn/cre8-wc.min.js.map +1 -1
- package/dist/assets/{Changelog-Documentation-BguNswiM.js → Changelog-Documentation-CeOetLxK.js} +1 -1
- package/dist/assets/{Code-Guidelines-BM3dZyzL.js → Code-Guidelines-BjdezAjj.js} +1 -1
- package/dist/assets/{Color-6AOWCN3U-C4AEGNk3.js → Color-6AOWCN3U-DPFGZitI.js} +1 -1
- package/dist/assets/{Contributing-Guidelines-DZURVehh.js → Contributing-Guidelines-B1M2V1hW.js} +1 -1
- package/dist/assets/{DocsRenderer-JROSPFPF-DeZmCI9u.js → DocsRenderer-JROSPFPF-BBy8KWNl.js} +1 -1
- package/dist/assets/{Tokens-Documentation-ZecGbtQg.js → Tokens-Documentation-CdTxFDLe.js} +1 -1
- package/dist/assets/{WithTooltip-7X4HQR7L-2Hfrkir-.js → WithTooltip-7X4HQR7L-DZzTNMQ7.js} +1 -1
- package/dist/assets/{accordion-item.stories-D-MjrX5G.js → accordion-item.stories-Bl26JlHp.js} +1 -9
- package/dist/assets/{accordion.stories-icgNa1dl.js → accordion.stories-DjoLApQw.js} +3 -11
- package/dist/assets/{alert.stories-BzDaXtj-.js → alert.stories-pO1y3YCQ.js} +15 -31
- package/dist/assets/{badge-C5wOWgyg.js → badge-BTxW3bN2.js} +3 -11
- package/dist/assets/{badge.stories-5GfB4jVI.js → badge.stories-vqh63RJ2.js} +1 -1
- package/dist/assets/{band.stories-DhXaP_kL.js → band.stories-CjKRppSb.js} +1 -9
- package/dist/assets/{blocks-DhUVut8Z.js → blocks-1be_-L6v.js} +5 -5
- package/dist/assets/{breadcrumbs.stories-CrPUBVk1.js → breadcrumbs.stories-Doyfy3V9.js} +2 -18
- package/dist/assets/{button-CJL8yzAT.js → button-CgaWukz0.js} +1 -9
- package/dist/assets/{button-group-BgwgtSFC.js → button-group-G7qN4MwM.js} +1 -9
- package/dist/assets/{button-group.stories-W-07gO63.js → button-group.stories-cL3Kay6M.js} +1 -1
- package/dist/assets/{button.stories-BPzJ-sCv.js → button.stories-C9HSpxWb.js} +6 -6
- package/dist/assets/{card.stories-mlFGY2Xn.js → card.stories-BbU8YymD.js} +3 -11
- package/dist/assets/{chart.stories-C8yuHHeK.js → chart.stories-BL4FxIA_.js} +1 -1
- package/dist/assets/{checkbox-field-item-iHcdmTNw.js → checkbox-field-item-DIMHcWM0.js} +1 -9
- package/dist/assets/{checkbox-field-item.stories-D1aVLDXn.js → checkbox-field-item.stories-XbB4x_lO.js} +1 -1
- package/dist/assets/{checkbox-field.stories-BoVB2jCx.js → checkbox-field.stories-YnqFUI4K.js} +2 -10
- package/dist/assets/{cre8-element-DfmMtHJO.js → cre8-element-B35i4Lyg.js} +1 -1
- package/dist/assets/{cre8-form-element-bQpK8UYN.js → cre8-form-element-Cfc5VeYV.js} +1 -1
- package/dist/assets/{danger-button.stories-Cb4ljnhQ.js → danger-button.stories-xh25hmfd.js} +1 -9
- package/dist/assets/{date-picker.stories-Cje3qk8D.js → date-picker.stories-DD_ctzEF.js} +1 -49
- package/dist/assets/{divider-B_PXBGWD.js → divider-xZ2KARHf.js} +2 -10
- package/dist/assets/{divider.stories-CtfeBqVV.js → divider.stories-Bk9oF-OV.js} +1 -1
- package/dist/assets/{dropdown-Cgwne34I.js → dropdown-BEP5x3CW.js} +6 -22
- package/dist/assets/{dropdown-item.stories-pXkDLRuv.js → dropdown-item.stories-Iaw_UrEP.js} +1 -1
- package/dist/assets/{dropdown.stories-DZnmHieY.js → dropdown.stories-B0OlKD7h.js} +1 -1
- package/dist/assets/{example-drug-card.stories-DTzLXTFx.js → example-drug-card.stories-Bp5JIeE_.js} +1 -1
- package/dist/assets/{f-po-C2WpbOFJ.js → f-po-BdPzDRD-.js} +1 -1
- package/dist/assets/{feature.stories-DffXdJch.js → feature.stories-DYE1Js70.js} +1 -9
- package/dist/assets/{field-DzYRqQb2.js → field-BpUYyRW1.js} +1 -9
- package/dist/assets/{field-note-DKXZiXLU.js → field-note-fccBckVl.js} +3 -11
- package/dist/assets/{field-note.stories-DS_0bQul.js → field-note.stories-BH9AZMbF.js} +1 -1
- package/dist/assets/{field.stories-BvXn0oG6.js → field.stories-BQPtmziK.js} +1 -1
- package/dist/assets/{footer.stories-C3ZibisU.js → footer.stories-DCWEciqD.js} +1 -9
- package/dist/assets/{form-example.stories-C-TuOeF2.js → form-example.stories-9IDC0AgX.js} +1 -1
- package/dist/assets/{formatter-L2YTDE3Q-CJVnxOUW.js → formatter-L2YTDE3Q-B9u1AOWn.js} +1 -1
- package/dist/assets/{global-nav-item-xQL7wVjY.js → global-nav-item-T4htN-yO.js} +6 -14
- package/dist/assets/{global-nav-item.stories-Dp9TE3aR.js → global-nav-item.stories-2dWRfCXv.js} +1 -1
- package/dist/assets/{global-nav.stories-B5Nk8JZ0.js → global-nav.stories-Fh1gScqg.js} +2 -10
- package/dist/assets/{grid-DYgnZBsd.js → grid-C5CKMXNe.js} +3 -19
- package/dist/assets/{grid.stories-BFiXTq2C.js → grid.stories-BLmCNdeA.js} +1 -1
- package/dist/assets/{header.stories-D1f7xhjV.js → header.stories-BkDrjJtj.js} +1 -9
- package/dist/assets/{heading-485Jz7JZ.js → heading-Dbka33DK.js} +2 -10
- package/dist/assets/{heading.stories-gPF_SmTc.js → heading.stories-Be40_bmG.js} +1 -1
- package/dist/assets/{hero.stories-BHlFNdvF.js → hero.stories-vRu7PZG9.js} +1 -9
- package/dist/assets/{icon-DeTLDzTS.js → icon-ChfRWXWy.js} +2 -10
- package/dist/assets/{icon-description-o-YaiEjK.js → icon-description-BBSwDykJ.js} +1 -1
- package/dist/assets/{icon-description.stories-BdPRvEwe.js → icon-description.stories-Cg6ekOme.js} +1 -1
- package/dist/assets/{icon.stories-BxWpqxT5.js → icon.stories-Cj4U7L5G.js} +1 -1
- package/dist/assets/if-defined-Bxnzk64Q.js +1 -0
- package/dist/assets/{iframe-dHvya7sk.js → iframe-BNJP6ovU.js} +35 -35
- package/dist/assets/{inline-alert.stories-FH0bQ0jh.js → inline-alert.stories-CygBYI02.js} +1 -9
- package/dist/assets/{layout-container.stories-D6Z6Kx78.js → layout-container.stories-TMyIJteJ.js} +2 -10
- package/dist/assets/{layout.stories-CNYuwC_r.js → layout.stories-ylRM-ANL.js} +7 -23
- package/dist/assets/{linelength-container.stories-pCRXZvxS.js → linelength-container.stories-Br2v8jXE.js} +1 -9
- package/dist/assets/{link-BpCiLxNW.js → link-CRE0Eqdo.js} +1 -9
- package/dist/assets/{link-list.stories-12vsAa1P.js → link-list.stories--y-urrVo.js} +7 -23
- package/dist/assets/{link.stories-DAoQtY4_.js → link.stories-C3WQOgkY.js} +2 -2
- package/dist/assets/{list.stories-D0N3yBIf.js → list.stories-Bd2bxkxn.js} +7 -23
- package/dist/assets/{loading-spinner-g6iJajXH.js → loading-spinner-C52KNq6y.js} +4 -12
- package/dist/assets/{loading-spinner.stories-B6_mgPxB.js → loading-spinner.stories-DPRGEeHT.js} +1 -1
- package/dist/assets/{logo.stories-BvMwN2qg.js → logo.stories-2LBqqraT.js} +1 -9
- package/dist/assets/{main.stories-pL4zefbs.js → main.stories-BQzD7iWD.js} +2 -10
- package/dist/assets/{medication-card.stories-DK1XGJic.js → medication-card.stories-Wc-hA0-s.js} +5 -5
- package/dist/assets/{medication-form.stories-Bj5dLp5S.js → medication-form.stories-DfFOCDaU.js} +1 -1
- package/dist/assets/{modal-CO0M4e_8.js → modal-CCfbY4fF.js} +1 -9
- package/dist/assets/{modal-BNu8xy08.js → modal-GglWRNJp.js} +1 -1
- package/dist/assets/{modal.stories-CHYBrq_E.js → modal.stories-CpybCs79.js} +1 -1
- package/dist/assets/{multi-select.stories-C9XXsWio.js → multi-select.stories-BhzEKRui.js} +1 -9
- package/dist/assets/{nav-container.stories-DU9fhvDu.js → nav-container.stories-Be1YlegP.js} +3 -11
- package/dist/assets/{page-header.stories-BrstKiEY.js → page-header.stories-BOVLQ0YF.js} +1 -9
- package/dist/assets/{pagination.stories-Bw2M2iOn.js → pagination.stories-D62sa_1K.js} +9 -25
- package/dist/assets/{percent-bar.stories-UQRXYUqd.js → percent-bar.stories-CYi4El7T.js} +1 -9
- package/dist/assets/{popover.stories-ZkwrRFpR.js → popover.stories-B9O8F4yv.js} +1 -9
- package/dist/assets/{primary-nav.stories-wqOKwgQn.js → primary-nav.stories-Bt-o7h45.js} +1 -17
- package/dist/assets/{progress-meter-TzASasu0.js → progress-meter-Dit59091.js} +1 -9
- package/dist/assets/{progress-meter.stories-qfJALZf8.js → progress-meter.stories-CYnOCmjo.js} +1 -1
- package/dist/assets/{progress-steps-item-KvW1d_7L.js → progress-steps-item-CWJsad0s.js} +1 -9
- package/dist/assets/{progress-steps-item.stories-uOn6tJ1W.js → progress-steps-item.stories-ePn_6bPn.js} +1 -1
- package/dist/assets/{progress-steps.stories-CKFPx8D0.js → progress-steps.stories-CblrEcXF.js} +1 -9
- package/dist/assets/{radio-field-item-CTaR50XR.js → radio-field-item-Bm-0RWPe.js} +5 -21
- package/dist/assets/{radio-field-item.stories-DQSLj8W1.js → radio-field-item.stories-y_TrTRIW.js} +1 -1
- package/dist/assets/{radio-field.stories-Btmc_Iep.js → radio-field.stories-CSWrbUrn.js} +1 -1
- package/dist/assets/{remove-tag-BSEZ7VT8.js → remove-tag-lCr57c5r.js} +1 -9
- package/dist/assets/{remove-tag.stories-diRKi7Ua.js → remove-tag.stories-CDfwCdvZ.js} +1 -1
- package/dist/assets/{request-prescription.stories-DQvra7ia.js → request-prescription.stories-O4zqokfb.js} +1 -1
- package/dist/assets/{sample-modal.stories-deE1EBfZ.js → sample-modal.stories-BZ4N2R2Z.js} +1 -1
- package/dist/assets/{section.stories-DF4mcy2O.js → section.stories-D_1InThX.js} +1 -9
- package/dist/assets/{select-tile-D-C8oSrm.js → select-tile-BqqB3ZtE.js} +2 -10
- package/dist/assets/{select-tile-list.stories-vsBQUIcl.js → select-tile-list.stories-Di4ILgV8.js} +1 -9
- package/dist/assets/{select-tile.stories-CqHzN5fc.js → select-tile.stories-D3h_6zlV.js} +6 -6
- package/dist/assets/{select.stories-8aOGxTtr.js → select.stories-BB2phP9A.js} +1 -9
- package/dist/assets/{skeleton-loader.stories-CwR2-aC5.js → skeleton-loader.stories-y4uml_kV.js} +5 -13
- package/dist/assets/{split-button.stories-CyfdrK4u.js → split-button.stories-C_82I4ME.js} +2 -10
- package/dist/assets/{spread-BPiNgQQF.js → spread-CnPic3C2.js} +1 -1
- package/dist/assets/state-DkQhleoO.js +1 -0
- package/dist/assets/{submenu.stories-CDhNzZzh.js → submenu.stories-UDtaREr1.js} +2 -18
- package/dist/assets/{syntaxhighlighter-T5IQBZDB-BzI6WxUR.js → syntaxhighlighter-T5IQBZDB-D-I_s_yD.js} +1 -1
- package/dist/assets/{table-header-CfcchoYz.js → table-header-2837i43H.js} +3 -51
- package/dist/assets/{table-object.stories-Bd5qdfMU.js → table-object.stories-D4KoI-wA.js} +1 -9
- package/dist/assets/{table.stories-DxuBe9dJ.js → table.stories-DUJDibEp.js} +1 -1
- package/dist/assets/{tabs.stories-Cpc3OHJx.js → tabs.stories-C06SngOF.js} +5 -29
- package/dist/assets/{tag-list.stories-BmyCmrTF.js → tag-list.stories-Du-IoYzu.js} +2 -10
- package/dist/assets/{tag-vQFuZneb.js → tag-oHGdclJl.js} +1 -9
- package/dist/assets/{tag.stories-DGzrNUbb.js → tag.stories-C5D5IbuK.js} +1 -1
- package/dist/assets/{tertiary-nav.stories-D4q5K-am.js → tertiary-nav.stories-B1GU8Zi4.js} +3 -19
- package/dist/assets/{text-link-4qLRIeJB.js → text-link-B3m3KEqY.js} +1 -9
- package/dist/assets/{text-link.stories-D6BRm2I5.js → text-link.stories-4O6qn82H.js} +1 -1
- package/dist/assets/{text-passage-DGaI5i2I.js → text-passage-xQVosjOr.js} +3 -19
- package/dist/assets/{text-passage.stories-DkmXVUhH.js → text-passage.stories-Da1nspwG.js} +1 -1
- package/dist/assets/{tooltip.stories-B7ADDq7o.js → tooltip.stories-DLKyyeKn.js} +6 -14
- package/dist/assets/{utility-nav.stories-ffXVvyLp.js → utility-nav.stories-B6xBFe7z.js} +5 -21
- package/dist/design-tokens/brands/cre8/css/tokens_brand.css +1 -1
- package/dist/design-tokens/core/scss/theming/component.css +1 -1
- package/dist/design-tokens/core/scss/theming/variables.css +1 -7
- package/dist/design-tokens/core/scss/theming/variables.scss +0 -11
- package/dist/icons/cre8-icons.svg +1 -1
- package/dist/iframe.html +1 -24
- package/dist/index.html +25 -77
- package/dist/project.json +1 -1
- package/lib/a2ui/renderer.d.ts +2 -1
- package/lib/a2ui/renderer.d.ts.map +1 -1
- package/lib/a2ui/renderer.js +1 -1
- package/lib/a2ui/renderer.js.map +1 -1
- package/lib/a2ui/stream/diff.d.ts +29 -0
- package/lib/a2ui/stream/diff.d.ts.map +1 -0
- package/lib/a2ui/stream/diff.js +131 -0
- package/lib/a2ui/stream/diff.js.map +1 -0
- package/lib/a2ui/stream/index.d.ts +12 -0
- package/lib/a2ui/stream/index.d.ts.map +1 -0
- package/lib/a2ui/stream/index.js +12 -0
- package/lib/a2ui/stream/index.js.map +1 -0
- package/lib/a2ui/stream/model.d.ts +67 -0
- package/lib/a2ui/stream/model.d.ts.map +1 -0
- package/lib/a2ui/stream/model.js +423 -0
- package/lib/a2ui/stream/model.js.map +1 -0
- package/lib/a2ui/stream/pointer.d.ts +35 -0
- package/lib/a2ui/stream/pointer.d.ts.map +1 -0
- package/lib/a2ui/stream/pointer.js +147 -0
- package/lib/a2ui/stream/pointer.js.map +1 -0
- package/lib/a2ui/stream/renderer.d.ts +52 -0
- package/lib/a2ui/stream/renderer.d.ts.map +1 -0
- package/lib/a2ui/stream/renderer.js +279 -0
- package/lib/a2ui/stream/renderer.js.map +1 -0
- package/lib/a2ui/stream/types.d.ts +174 -0
- package/lib/a2ui/stream/types.d.ts.map +1 -0
- package/lib/a2ui/stream/types.js +18 -0
- package/lib/a2ui/stream/types.js.map +1 -0
- package/lib/components/accordion/accordion.d.ts +15 -0
- package/lib/components/accordion/accordion.d.ts.map +1 -1
- package/lib/components/accordion/accordion.js +23 -0
- package/lib/components/accordion/accordion.js.map +1 -1
- package/lib/components/badge/badge.d.ts +4 -17
- package/lib/components/badge/badge.d.ts.map +1 -1
- package/lib/components/badge/badge.js +0 -15
- package/lib/components/badge/badge.js.map +1 -1
- package/lib/components/breadcrumbs/breadcrumbs.d.ts +14 -0
- package/lib/components/breadcrumbs/breadcrumbs.d.ts.map +1 -1
- package/lib/components/breadcrumbs/breadcrumbs.js +21 -0
- package/lib/components/breadcrumbs/breadcrumbs.js.map +1 -1
- package/lib/components/chart/chart.d.ts +3 -3
- package/lib/components/chart/chart.js +6 -6
- package/lib/components/chart/chart.js.map +1 -1
- package/lib/components/checkbox-field/checkbox-field.d.ts +19 -0
- package/lib/components/checkbox-field/checkbox-field.d.ts.map +1 -1
- package/lib/components/checkbox-field/checkbox-field.js +28 -0
- package/lib/components/checkbox-field/checkbox-field.js.map +1 -1
- package/lib/components/cre8-element.d.ts +19 -0
- package/lib/components/cre8-element.d.ts.map +1 -1
- package/lib/components/cre8-element.js +51 -2
- package/lib/components/cre8-element.js.map +1 -1
- package/lib/components/divider/divider.d.ts +1 -1
- package/lib/components/divider/divider.d.ts.map +1 -1
- package/lib/components/divider/divider.js.map +1 -1
- package/lib/components/dropdown/dropdown.d.ts +13 -0
- package/lib/components/dropdown/dropdown.d.ts.map +1 -1
- package/lib/components/dropdown/dropdown.js +19 -0
- package/lib/components/dropdown/dropdown.js.map +1 -1
- package/lib/components/dropdown-item/dropdown-item.d.ts +1 -1
- package/lib/components/dropdown-item/dropdown-item.js +2 -2
- package/lib/components/dropdown-item/dropdown-item.js.map +1 -1
- package/lib/components/heading/heading.d.ts +3 -5
- package/lib/components/heading/heading.d.ts.map +1 -1
- package/lib/components/heading/heading.js +2 -4
- package/lib/components/heading/heading.js.map +1 -1
- package/lib/components/link-list/link-list.d.ts +19 -0
- package/lib/components/link-list/link-list.d.ts.map +1 -1
- package/lib/components/link-list/link-list.js +19 -0
- package/lib/components/link-list/link-list.js.map +1 -1
- package/lib/components/list/list.d.ts +13 -0
- package/lib/components/list/list.d.ts.map +1 -1
- package/lib/components/list/list.js +15 -0
- package/lib/components/list/list.js.map +1 -1
- package/lib/components/modal/modal.d.ts +2 -2
- package/lib/components/modal/modal.js +2 -2
- package/lib/components/modal/modal.js.map +1 -1
- package/lib/components/multi-select/multi-select.d.ts +2 -2
- package/lib/components/multi-select/multi-select.js +5 -5
- package/lib/components/multi-select/multi-select.js.map +1 -1
- package/lib/components/pagination/pagination.d.ts +1 -1
- package/lib/components/pagination/pagination.js +2 -2
- package/lib/components/pagination/pagination.js.map +1 -1
- package/lib/components/percent-bar/percent-bar.d.ts +2 -0
- package/lib/components/percent-bar/percent-bar.d.ts.map +1 -1
- package/lib/components/percent-bar/percent-bar.js +3 -1
- package/lib/components/percent-bar/percent-bar.js.map +1 -1
- package/lib/components/popover/popover.d.ts +6 -7
- package/lib/components/popover/popover.d.ts.map +1 -1
- package/lib/components/popover/popover.js +4 -4
- package/lib/components/popover/popover.js.map +1 -1
- package/lib/components/progress-meter/progress-meter.d.ts +0 -8
- package/lib/components/progress-meter/progress-meter.d.ts.map +1 -1
- package/lib/components/progress-meter/progress-meter.js +0 -7
- package/lib/components/progress-meter/progress-meter.js.map +1 -1
- package/lib/components/progress-steps/progress-steps.d.ts +16 -0
- package/lib/components/progress-steps/progress-steps.d.ts.map +1 -1
- package/lib/components/progress-steps/progress-steps.js +25 -0
- package/lib/components/progress-steps/progress-steps.js.map +1 -1
- package/lib/components/progress-steps-item/progress-steps-item.d.ts +1 -3
- package/lib/components/progress-steps-item/progress-steps-item.d.ts.map +1 -1
- package/lib/components/progress-steps-item/progress-steps-item.js +0 -1
- package/lib/components/progress-steps-item/progress-steps-item.js.map +1 -1
- package/lib/components/radio-field/radio-field.d.ts +33 -0
- package/lib/components/radio-field/radio-field.d.ts.map +1 -1
- package/lib/components/radio-field/radio-field.js +62 -0
- package/lib/components/radio-field/radio-field.js.map +1 -1
- package/lib/components/remove-tag/remove-tag.d.ts +1 -1
- package/lib/components/remove-tag/remove-tag.js +3 -3
- package/lib/components/remove-tag/remove-tag.js.map +1 -1
- package/lib/components/split-button/split-button.d.ts +3 -0
- package/lib/components/split-button/split-button.d.ts.map +1 -1
- package/lib/components/split-button/split-button.js +5 -2
- package/lib/components/split-button/split-button.js.map +1 -1
- package/lib/components/tab/tab.d.ts +1 -1
- package/lib/components/tab/tab.js +3 -3
- package/lib/components/tab/tab.js.map +1 -1
- package/lib/components/table/table.d.ts +36 -0
- package/lib/components/table/table.d.ts.map +1 -1
- package/lib/components/table/table.js +55 -0
- package/lib/components/table/table.js.map +1 -1
- package/lib/components/tabs/tabs.d.ts +20 -3
- package/lib/components/tabs/tabs.d.ts.map +1 -1
- package/lib/components/tabs/tabs.js +33 -5
- package/lib/components/tabs/tabs.js.map +1 -1
- package/lib/components/tag-list/tag-list.d.ts +17 -0
- package/lib/components/tag-list/tag-list.d.ts.map +1 -1
- package/lib/components/tag-list/tag-list.js +25 -0
- package/lib/components/tag-list/tag-list.js.map +1 -1
- package/lib/components/tooltip/tooltip.d.ts +2 -2
- package/lib/components/tooltip/tooltip.js +4 -4
- package/lib/components/tooltip/tooltip.js.map +1 -1
- package/lib/components/utils/light-children.d.ts +40 -0
- package/lib/components/utils/light-children.d.ts.map +1 -0
- package/lib/components/utils/light-children.js +100 -0
- package/lib/components/utils/light-children.js.map +1 -0
- package/lib/directives/if-truthy.d.ts +1 -1
- package/lib/light-children-TlEXev5S.js +39 -0
- package/lib/scripts/generate-react-wrappers.d.ts +8 -1
- package/lib/scripts/generate-react-wrappers.d.ts.map +1 -1
- package/lib/scripts/generate-react-wrappers.js +45 -1
- package/lib/scripts/generate-react-wrappers.js.map +1 -1
- package/mcp-manifest.json +162 -52
- package/package.json +11 -4
- package/react-manifest.json +153 -47
- package/dist/assets/if-defined-HKKhGupN.js +0 -1
- package/dist/assets/iframe-CWwoGI65.css +0 -1
- package/dist/assets/state-CfuknrX8.js +0 -1
- package/dist/fonts/PlusJakartaSans-Bold.woff2 +0 -0
- package/dist/fonts/PlusJakartaSans-Medium.woff2 +0 -0
- package/dist/fonts/PlusJakartaSans-Regular.woff2 +0 -0
- package/dist/fonts/PlusJakartaSans-SemiBold.woff2 +0 -0
- package/dist/logo.svg +0 -1
- package/dist/sb-addons/storybook-4/manager-bundle.js +0 -8
- /package/dist/icons/{express-scripts copy.svg → pharmacy copy.svg} +0 -0
- /package/dist/icons/{express-scripts.svg → pharmacy.svg} +0 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Two addressing schemes, kept in one file because they are easy to confuse.
|
|
3
|
+
*
|
|
4
|
+
* **Spec paths** (`$.slots.footer[0].children[2]`) address nodes in the
|
|
5
|
+
* component tree. This grammar is not invented here — it is what the one-shot
|
|
6
|
+
* renderer already puts in `EmittedEvent.path`, which is why streaming can reuse
|
|
7
|
+
* it as node identity.
|
|
8
|
+
*
|
|
9
|
+
* **JSON Pointers** (`/user/name`) address values in the surface data model,
|
|
10
|
+
* per RFC 6901.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export type PathSegment =
|
|
14
|
+
| { kind: 'children'; index: number }
|
|
15
|
+
| { kind: 'slot'; name: string; index: number };
|
|
16
|
+
|
|
17
|
+
const SEGMENT_RE = /^\.(?:children\[(\d+)\]|slots\.([A-Za-z_][\w-]*)\[(\d+)\])/;
|
|
18
|
+
|
|
19
|
+
/** Parse `$.slots.footer[0]` into segments. Throws on malformed input. */
|
|
20
|
+
export function parsePath(path: string): PathSegment[] {
|
|
21
|
+
if (typeof path !== 'string' || path.length === 0) {
|
|
22
|
+
throw new Error(`path: must be a non-empty string, got ${JSON.stringify(path)}`);
|
|
23
|
+
}
|
|
24
|
+
if (path[0] !== '$') {
|
|
25
|
+
throw new Error(`path "${path}": must start with "$"`);
|
|
26
|
+
}
|
|
27
|
+
const segments: PathSegment[] = [];
|
|
28
|
+
let rest = path.slice(1);
|
|
29
|
+
while (rest.length > 0) {
|
|
30
|
+
const m = SEGMENT_RE.exec(rest);
|
|
31
|
+
if (!m) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
`path "${path}": cannot parse at "${rest}" — expected ".children[N]" or ".slots.NAME[N]"`
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
if (m[1] !== undefined) {
|
|
37
|
+
segments.push({ kind: 'children', index: Number(m[1]) });
|
|
38
|
+
} else {
|
|
39
|
+
segments.push({ kind: 'slot', name: m[2], index: Number(m[3]) });
|
|
40
|
+
}
|
|
41
|
+
rest = rest.slice(m[0].length);
|
|
42
|
+
}
|
|
43
|
+
return segments;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function formatPath(segments: PathSegment[]): string {
|
|
47
|
+
let out = '$';
|
|
48
|
+
for (const seg of segments) {
|
|
49
|
+
out += seg.kind === 'children' ? `.children[${seg.index}]` : `.slots.${seg.name}[${seg.index}]`;
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** `$.children[0]` + `{children,2}` → `$.children[0].children[2]`. */
|
|
55
|
+
export function childPath(parentPath: string, slot: string | null, index: number): string {
|
|
56
|
+
return slot === null || slot === undefined
|
|
57
|
+
? `${parentPath}.children[${index}]`
|
|
58
|
+
: `${parentPath}.slots.${slot}[${index}]`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ─── RFC 6901 JSON Pointer ──────────────────────────────────────────────────
|
|
62
|
+
|
|
63
|
+
function unescapeToken(token: string): string {
|
|
64
|
+
return token.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function parsePointer(pointer: string): string[] {
|
|
68
|
+
if (pointer === '' || pointer === '/') return [];
|
|
69
|
+
if (pointer[0] !== '/') {
|
|
70
|
+
throw new Error(`pointer "${pointer}": must be empty or start with "/"`);
|
|
71
|
+
}
|
|
72
|
+
return pointer.slice(1).split('/').map(unescapeToken);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function pointerGet(root: unknown, pointer: string): unknown {
|
|
76
|
+
let cur: unknown = root;
|
|
77
|
+
for (const token of parsePointer(pointer)) {
|
|
78
|
+
if (cur === null || cur === undefined) return undefined;
|
|
79
|
+
if (Array.isArray(cur)) {
|
|
80
|
+
const i = Number(token);
|
|
81
|
+
if (!Number.isInteger(i)) return undefined;
|
|
82
|
+
cur = cur[i];
|
|
83
|
+
} else if (typeof cur === 'object') {
|
|
84
|
+
cur = (cur as Record<string, unknown>)[token];
|
|
85
|
+
} else {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return cur;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Write `value` at `pointer`, creating intermediate containers as needed. An
|
|
94
|
+
* array is created when the next token looks like an index, an object otherwise.
|
|
95
|
+
* Mutates and returns `root` — except for the whole-document pointer `""`,
|
|
96
|
+
* where the caller must use the returned value.
|
|
97
|
+
*/
|
|
98
|
+
export function pointerSet(root: Record<string, unknown>, pointer: string, value: unknown): unknown {
|
|
99
|
+
const tokens = parsePointer(pointer);
|
|
100
|
+
if (tokens.length === 0) return value;
|
|
101
|
+
|
|
102
|
+
let cur: unknown = root;
|
|
103
|
+
for (let i = 0; i < tokens.length - 1; i++) {
|
|
104
|
+
const token = tokens[i];
|
|
105
|
+
const container = cur as Record<string, unknown> | unknown[];
|
|
106
|
+
const existing = Array.isArray(container)
|
|
107
|
+
? (container as unknown[])[Number(token)]
|
|
108
|
+
: (container as Record<string, unknown>)[token];
|
|
109
|
+
|
|
110
|
+
if (existing === undefined || existing === null || typeof existing !== 'object') {
|
|
111
|
+
const next: unknown = /^\d+$/.test(tokens[i + 1]) ? [] : {};
|
|
112
|
+
if (Array.isArray(container)) (container as unknown[])[Number(token)] = next;
|
|
113
|
+
else (container as Record<string, unknown>)[token] = next;
|
|
114
|
+
cur = next;
|
|
115
|
+
} else {
|
|
116
|
+
cur = existing;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const last = tokens[tokens.length - 1];
|
|
121
|
+
if (Array.isArray(cur)) {
|
|
122
|
+
if (last === '-') (cur as unknown[]).push(value);
|
|
123
|
+
else (cur as unknown[])[Number(last)] = value;
|
|
124
|
+
} else {
|
|
125
|
+
(cur as Record<string, unknown>)[last] = value;
|
|
126
|
+
}
|
|
127
|
+
return root;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function pointerRemove(root: Record<string, unknown>, pointer: string): void {
|
|
131
|
+
const tokens = parsePointer(pointer);
|
|
132
|
+
if (tokens.length === 0) {
|
|
133
|
+
for (const key of Object.keys(root)) delete root[key];
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
let cur: unknown = root;
|
|
137
|
+
for (let i = 0; i < tokens.length - 1; i++) {
|
|
138
|
+
if (cur === null || typeof cur !== 'object') return;
|
|
139
|
+
cur = Array.isArray(cur)
|
|
140
|
+
? (cur as unknown[])[Number(tokens[i])]
|
|
141
|
+
: (cur as Record<string, unknown>)[tokens[i]];
|
|
142
|
+
}
|
|
143
|
+
if (cur === null || typeof cur !== 'object') return;
|
|
144
|
+
const last = tokens[tokens.length - 1];
|
|
145
|
+
if (Array.isArray(cur)) (cur as unknown[]).splice(Number(last), 1);
|
|
146
|
+
else delete (cur as Record<string, unknown>)[last];
|
|
147
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SurfaceRenderer — mirrors a SurfaceModel into live DOM, incrementally.
|
|
3
|
+
*
|
|
4
|
+
* The model is the source of truth; a `SurfaceChange` is only an invalidation
|
|
5
|
+
* hint, so the renderer always re-reads current state rather than trusting a
|
|
6
|
+
* diff it was handed. Elements are keyed by spec-node *object identity* (a
|
|
7
|
+
* WeakMap), not by path — paths shift when a sibling is inserted, and an element
|
|
8
|
+
* that keeps its identity keeps its internal state, its focus, and its
|
|
9
|
+
* animations.
|
|
10
|
+
*/
|
|
11
|
+
import type { ComponentSpec, EmittedEvent } from '../types.js';
|
|
12
|
+
import type { ApplyResult, SurfaceModel } from './model.js';
|
|
13
|
+
import type { SurfaceChange, SurfaceMessage } from './types.js';
|
|
14
|
+
export interface SurfaceRendererOptions {
|
|
15
|
+
root: HTMLElement;
|
|
16
|
+
doc?: Document;
|
|
17
|
+
onEvent?: (evt: EmittedEvent) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare class SurfaceRenderer {
|
|
20
|
+
readonly model: SurfaceModel;
|
|
21
|
+
private readonly rootEl;
|
|
22
|
+
private readonly doc;
|
|
23
|
+
private readonly onEvent?;
|
|
24
|
+
private readonly elements;
|
|
25
|
+
private readonly book;
|
|
26
|
+
constructor(model: SurfaceModel, options: SurfaceRendererOptions);
|
|
27
|
+
/** Apply a message to the model, then mirror the resulting changes to DOM. */
|
|
28
|
+
apply(message: SurfaceMessage): ApplyResult;
|
|
29
|
+
reconcile(changes: SurfaceChange[]): void;
|
|
30
|
+
/** Full (re)render of the surface root. */
|
|
31
|
+
mount(): void;
|
|
32
|
+
/** The element currently rendering the node at `path`, if it exists. */
|
|
33
|
+
elementAt(path: string): HTMLElement | undefined;
|
|
34
|
+
private elementFor;
|
|
35
|
+
private applyProps;
|
|
36
|
+
private applyEvents;
|
|
37
|
+
private makeListener;
|
|
38
|
+
private reconcileContainer;
|
|
39
|
+
/**
|
|
40
|
+
* Rebuild the container's DOM child list in place. `children` first, then each
|
|
41
|
+
* named slot in declaration order — DOM order inside a slotted host does not
|
|
42
|
+
* affect layout, but a stable order keeps the reconcile a no-op when nothing
|
|
43
|
+
* moved.
|
|
44
|
+
*/
|
|
45
|
+
private reconcileChildren;
|
|
46
|
+
private nodeFor;
|
|
47
|
+
/** Re-resolve bound props across the whole tree after a data-model change. */
|
|
48
|
+
private refreshProps;
|
|
49
|
+
}
|
|
50
|
+
/** Locate a node in the tree by object identity, returning its current path. */
|
|
51
|
+
export declare function findPath(root: ComponentSpec | null, target: ComponentSpec, path?: string): string | null;
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SurfaceRenderer — mirrors a SurfaceModel into live DOM, incrementally.
|
|
3
|
+
*
|
|
4
|
+
* The model is the source of truth; a `SurfaceChange` is only an invalidation
|
|
5
|
+
* hint, so the renderer always re-reads current state rather than trusting a
|
|
6
|
+
* diff it was handed. Elements are keyed by spec-node *object identity* (a
|
|
7
|
+
* WeakMap), not by path — paths shift when a sibling is inserted, and an element
|
|
8
|
+
* that keeps its identity keeps its internal state, its focus, and its
|
|
9
|
+
* animations.
|
|
10
|
+
*/
|
|
11
|
+
import { applyProp } from '../renderer.js';
|
|
12
|
+
import { resolveNode } from './model.js';
|
|
13
|
+
export class SurfaceRenderer {
|
|
14
|
+
model;
|
|
15
|
+
rootEl;
|
|
16
|
+
doc;
|
|
17
|
+
onEvent;
|
|
18
|
+
elements = new WeakMap();
|
|
19
|
+
book = new WeakMap();
|
|
20
|
+
constructor(model, options) {
|
|
21
|
+
this.model = model;
|
|
22
|
+
this.rootEl = options.root;
|
|
23
|
+
this.doc = options.doc ?? options.root.ownerDocument ?? document;
|
|
24
|
+
this.onEvent = options.onEvent;
|
|
25
|
+
}
|
|
26
|
+
/** Apply a message to the model, then mirror the resulting changes to DOM. */
|
|
27
|
+
apply(message) {
|
|
28
|
+
let result;
|
|
29
|
+
try {
|
|
30
|
+
result = this.model.apply(message);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
// A rolled-back patch restored the tree from a copy, so every node object
|
|
34
|
+
// this renderer knows about is now a stranger. Remount before rethrowing.
|
|
35
|
+
if (error?.rolledBack)
|
|
36
|
+
this.mount();
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
this.reconcile(result.changes);
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
reconcile(changes) {
|
|
43
|
+
for (const change of changes) {
|
|
44
|
+
switch (change.kind) {
|
|
45
|
+
case 'root':
|
|
46
|
+
this.mount();
|
|
47
|
+
break;
|
|
48
|
+
case 'data':
|
|
49
|
+
if (this.model.root)
|
|
50
|
+
this.refreshProps(this.model.root);
|
|
51
|
+
break;
|
|
52
|
+
case 'content':
|
|
53
|
+
case 'text':
|
|
54
|
+
this.reconcileContainer(change.path);
|
|
55
|
+
break;
|
|
56
|
+
case 'props': {
|
|
57
|
+
const node = this.model.nodeAt(change.path);
|
|
58
|
+
if (typeof node !== 'string')
|
|
59
|
+
this.applyProps(node);
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
case 'events': {
|
|
63
|
+
const node = this.model.nodeAt(change.path);
|
|
64
|
+
if (typeof node !== 'string')
|
|
65
|
+
this.applyEvents(node);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** Full (re)render of the surface root. */
|
|
72
|
+
mount() {
|
|
73
|
+
const root = this.model.root;
|
|
74
|
+
if (!root) {
|
|
75
|
+
this.rootEl.replaceChildren();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const el = this.elementFor(root);
|
|
79
|
+
this.reconcileChildren(root, el);
|
|
80
|
+
if (this.rootEl.firstChild !== el || this.rootEl.childNodes.length !== 1) {
|
|
81
|
+
this.rootEl.replaceChildren(el);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/** The element currently rendering the node at `path`, if it exists. */
|
|
85
|
+
elementAt(path) {
|
|
86
|
+
const node = this.model.nodeAt(path);
|
|
87
|
+
return typeof node === 'string' ? undefined : this.elements.get(node);
|
|
88
|
+
}
|
|
89
|
+
// ─── internals ────────────────────────────────────────────────────────────
|
|
90
|
+
elementFor(node) {
|
|
91
|
+
const existing = this.elements.get(node);
|
|
92
|
+
if (existing)
|
|
93
|
+
return existing;
|
|
94
|
+
const el = this.doc.createElement(node.component);
|
|
95
|
+
this.elements.set(node, el);
|
|
96
|
+
this.book.set(el, { props: new Set(), events: new Map(), texts: new Map() });
|
|
97
|
+
this.applyProps(node);
|
|
98
|
+
this.applyEvents(node);
|
|
99
|
+
this.reconcileChildren(node, el);
|
|
100
|
+
return el;
|
|
101
|
+
}
|
|
102
|
+
applyProps(node) {
|
|
103
|
+
const el = this.elements.get(node);
|
|
104
|
+
if (!el)
|
|
105
|
+
return;
|
|
106
|
+
const bk = this.book.get(el);
|
|
107
|
+
const defs = this.model.catalog.components.get(node.component)?.properties?.props?.properties ?? {};
|
|
108
|
+
const resolved = resolveNode(node, this.model.data);
|
|
109
|
+
const next = resolved.props ?? {};
|
|
110
|
+
for (const key of bk.props) {
|
|
111
|
+
if (!(key in next)) {
|
|
112
|
+
el.removeAttribute(key);
|
|
113
|
+
try {
|
|
114
|
+
delete el[key];
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
/* a component may define the property non-configurable; leaving it is fine */
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
bk.props = new Set(Object.keys(next));
|
|
122
|
+
for (const [key, value] of Object.entries(next)) {
|
|
123
|
+
applyProp(el, key, value, defs[key]);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
applyEvents(node) {
|
|
127
|
+
const el = this.elements.get(node);
|
|
128
|
+
if (!el)
|
|
129
|
+
return;
|
|
130
|
+
const bk = this.book.get(el);
|
|
131
|
+
for (const [name, listener] of bk.events)
|
|
132
|
+
el.removeEventListener(name, listener);
|
|
133
|
+
bk.events.clear();
|
|
134
|
+
if (!node.events || !this.onEvent)
|
|
135
|
+
return;
|
|
136
|
+
for (const [eventName, binding] of Object.entries(node.events)) {
|
|
137
|
+
const listener = this.makeListener(node, eventName, binding);
|
|
138
|
+
el.addEventListener(eventName, listener);
|
|
139
|
+
bk.events.set(eventName, listener);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
makeListener(node, eventName, binding) {
|
|
143
|
+
const handler = typeof binding === 'string' ? binding : binding.handler;
|
|
144
|
+
const stop = typeof binding === 'object' && binding.stopPropagation === true;
|
|
145
|
+
const prevent = typeof binding === 'object' && binding.preventDefault === true;
|
|
146
|
+
return (nativeEvent) => {
|
|
147
|
+
if (stop)
|
|
148
|
+
nativeEvent.stopPropagation();
|
|
149
|
+
if (prevent)
|
|
150
|
+
nativeEvent.preventDefault();
|
|
151
|
+
this.onEvent?.({
|
|
152
|
+
component: node.component,
|
|
153
|
+
// Resolved at fire time: an insert above this node moves its path.
|
|
154
|
+
path: findPath(this.model.root, node) ?? '$',
|
|
155
|
+
event: eventName,
|
|
156
|
+
handler,
|
|
157
|
+
detail: 'detail' in nativeEvent ? nativeEvent.detail : undefined,
|
|
158
|
+
nativeEvent,
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
reconcileContainer(path) {
|
|
163
|
+
const node = this.model.nodeAt(path);
|
|
164
|
+
if (typeof node === 'string')
|
|
165
|
+
return;
|
|
166
|
+
const el = this.elements.get(node);
|
|
167
|
+
if (!el)
|
|
168
|
+
return;
|
|
169
|
+
this.reconcileChildren(node, el);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Rebuild the container's DOM child list in place. `children` first, then each
|
|
173
|
+
* named slot in declaration order — DOM order inside a slotted host does not
|
|
174
|
+
* affect layout, but a stable order keeps the reconcile a no-op when nothing
|
|
175
|
+
* moved.
|
|
176
|
+
*/
|
|
177
|
+
reconcileChildren(node, el) {
|
|
178
|
+
const bk = this.book.get(el);
|
|
179
|
+
const desired = [];
|
|
180
|
+
const liveTextKeys = new Set();
|
|
181
|
+
const push = (child, slot, index) => {
|
|
182
|
+
if (typeof child === 'string')
|
|
183
|
+
liveTextKeys.add(textKey(slot, index));
|
|
184
|
+
desired.push(this.nodeFor(child, slot, index, bk));
|
|
185
|
+
};
|
|
186
|
+
(node.children ?? []).forEach((child, i) => push(child, null, i));
|
|
187
|
+
if (node.slots) {
|
|
188
|
+
for (const [slotName, list] of Object.entries(node.slots)) {
|
|
189
|
+
list.forEach((child, i) => push(child, slotName, i));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
for (const key of [...bk.texts.keys()]) {
|
|
193
|
+
if (!liveTextKeys.has(key))
|
|
194
|
+
bk.texts.delete(key);
|
|
195
|
+
}
|
|
196
|
+
for (let i = 0; i < desired.length; i++) {
|
|
197
|
+
const current = el.childNodes[i];
|
|
198
|
+
if (current === desired[i])
|
|
199
|
+
continue;
|
|
200
|
+
el.insertBefore(desired[i], current ?? null);
|
|
201
|
+
}
|
|
202
|
+
while (el.childNodes.length > desired.length) {
|
|
203
|
+
el.removeChild(el.childNodes[el.childNodes.length - 1]);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
nodeFor(child, slot, index, bk) {
|
|
207
|
+
if (typeof child === 'string') {
|
|
208
|
+
const key = textKey(slot, index);
|
|
209
|
+
const bare = slot === null || slot === 'default';
|
|
210
|
+
const cached = bk.texts.get(key);
|
|
211
|
+
if (cached && (bare ? cached.nodeType === 3 : cached.nodeType === 1)) {
|
|
212
|
+
if (cached.textContent !== child)
|
|
213
|
+
cached.textContent = child;
|
|
214
|
+
return cached;
|
|
215
|
+
}
|
|
216
|
+
let created;
|
|
217
|
+
if (bare) {
|
|
218
|
+
created = this.doc.createTextNode(child);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
created = this.doc.createElement('span');
|
|
222
|
+
created.setAttribute('slot', slot);
|
|
223
|
+
created.textContent = child;
|
|
224
|
+
}
|
|
225
|
+
bk.texts.set(key, created);
|
|
226
|
+
return created;
|
|
227
|
+
}
|
|
228
|
+
const el = this.elementFor(child);
|
|
229
|
+
if (slot !== null && slot !== 'default')
|
|
230
|
+
el.setAttribute('slot', slot);
|
|
231
|
+
else
|
|
232
|
+
el.removeAttribute('slot');
|
|
233
|
+
return el;
|
|
234
|
+
}
|
|
235
|
+
/** Re-resolve bound props across the whole tree after a data-model change. */
|
|
236
|
+
refreshProps(node) {
|
|
237
|
+
this.applyProps(node);
|
|
238
|
+
for (const child of node.children ?? []) {
|
|
239
|
+
if (typeof child !== 'string')
|
|
240
|
+
this.refreshProps(child);
|
|
241
|
+
}
|
|
242
|
+
if (node.slots) {
|
|
243
|
+
for (const list of Object.values(node.slots)) {
|
|
244
|
+
for (const child of list)
|
|
245
|
+
if (typeof child !== 'string')
|
|
246
|
+
this.refreshProps(child);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
function textKey(slot, index) {
|
|
252
|
+
return `${slot ?? ''}#${index}`;
|
|
253
|
+
}
|
|
254
|
+
/** Locate a node in the tree by object identity, returning its current path. */
|
|
255
|
+
export function findPath(root, target, path = '$') {
|
|
256
|
+
if (!root)
|
|
257
|
+
return null;
|
|
258
|
+
if (root === target)
|
|
259
|
+
return path;
|
|
260
|
+
const children = root.children ?? [];
|
|
261
|
+
for (let i = 0; i < children.length; i++) {
|
|
262
|
+
const child = children[i];
|
|
263
|
+
if (typeof child === 'string')
|
|
264
|
+
continue;
|
|
265
|
+
const found = findPath(child, target, `${path}.children[${i}]`);
|
|
266
|
+
if (found)
|
|
267
|
+
return found;
|
|
268
|
+
}
|
|
269
|
+
if (root.slots) {
|
|
270
|
+
for (const [slotName, list] of Object.entries(root.slots)) {
|
|
271
|
+
for (let i = 0; i < list.length; i++) {
|
|
272
|
+
const child = list[i];
|
|
273
|
+
if (typeof child === 'string')
|
|
274
|
+
continue;
|
|
275
|
+
const found = findPath(child, target, `${path}.slots.${slotName}[${i}]`);
|
|
276
|
+
if (found)
|
|
277
|
+
return found;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return null;
|
|
282
|
+
}
|