@0001-labs/design-system-1 0.3.0-alpha.28 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DS1/0-face/button-label.ts +28 -0
- package/DS1/0-face/calendar.ts +6 -4
- package/DS1/0-face/carousel.ts +70 -0
- package/DS1/0-face/constraint-panel.ts +422 -0
- package/DS1/0-face/constraint-site.ts +200 -0
- package/DS1/0-face/constraints.ts +281 -0
- package/DS1/0-face/copy-text.ts +1 -1
- package/DS1/0-face/cut-fade.ts +312 -0
- package/DS1/0-face/define.ts +30 -2
- package/DS1/0-face/face-correction.ts +96 -0
- package/DS1/0-face/failures.ts +32 -0
- package/DS1/0-face/feedback-overlays.ts +5 -3
- package/DS1/0-face/feedback.ts +3 -0
- package/DS1/0-face/focus-vision.swift +31 -0
- package/DS1/0-face/focus.ts +181 -0
- package/DS1/0-face/google-face-metrics.json +102 -0
- package/DS1/0-face/grid.ts +61 -4
- package/DS1/0-face/i18n.ts +36 -18
- package/DS1/0-face/layout-inspector.ts +124 -98
- package/DS1/0-face/preference-options.ts +4 -0
- package/DS1/0-face/scaling.ts +21 -3
- package/DS1/0-face/shape.ts +43 -0
- package/DS1/0-face/text-contrast.ts +164 -0
- package/DS1/0-face/theme-bootstrap.js +43 -0
- package/DS1/0-face/toast-queue.ts +7 -1
- package/DS1/0-face/translations/da.json +10 -1
- package/DS1/0-face/translations/de.json +10 -1
- package/DS1/0-face/translations/en.json +10 -1
- package/DS1/0-face/translations/es.json +10 -1
- package/DS1/0-face/translations/fi.json +10 -1
- package/DS1/0-face/translations/fr.json +10 -1
- package/DS1/0-face/translations/is.json +10 -1
- package/DS1/0-face/translations/it.json +10 -1
- package/DS1/0-face/translations/ja.json +10 -1
- package/DS1/0-face/translations/ko.json +10 -1
- package/DS1/0-face/translations/nb.json +10 -1
- package/DS1/0-face/translations/pt-BR.json +10 -1
- package/DS1/0-face/translations/pt.json +10 -1
- package/DS1/0-face/translations/sv.json +10 -1
- package/DS1/0-face/translations/zh.json +10 -1
- package/DS1/0-face/word-wrap.ts +113 -0
- package/DS1/1-root/card.css +47 -20
- package/DS1/1-root/carousel.css +7 -0
- package/DS1/1-root/cjk.css +1 -1
- package/DS1/1-root/component-tokens.css +3 -2
- package/DS1/1-root/context.css +44 -6
- package/DS1/1-root/controls.css +99 -8
- package/DS1/1-root/document.css +9 -1
- package/DS1/1-root/empty.css +46 -5
- package/DS1/1-root/figures.css +50 -3
- package/DS1/1-root/fonts.css +1 -1
- package/DS1/1-root/footer.css +147 -16
- package/DS1/1-root/foundation.ts +60 -0
- package/DS1/1-root/guide.css +35 -0
- package/DS1/1-root/header.css +30 -9
- package/DS1/1-root/material.css +67 -0
- package/DS1/1-root/notice.css +10 -2
- package/DS1/1-root/one.css +14 -7
- package/DS1/1-root/progress.css +9 -1
- package/DS1/1-root/row.css +68 -2
- package/DS1/1-root/table.css +47 -4
- package/DS1/1-root/text.css +26 -0
- package/DS1/2-core/button-split.ts +10 -5
- package/DS1/2-core/chart/chart.css +71 -2
- package/DS1/2-core/chart/grid-chart.ts +2 -1
- package/DS1/2-core/ds-activity.ts +32 -0
- package/DS1/2-core/ds-app-chrome.ts +1 -0
- package/DS1/2-core/ds-avatar.ts +35 -6
- package/DS1/2-core/ds-badge.ts +8 -1
- package/DS1/2-core/ds-button.ts +7 -1
- package/DS1/2-core/ds-chart.ts +184 -49
- package/DS1/2-core/ds-cycle.ts +27 -186
- package/DS1/2-core/ds-device-bezel.ts +1 -0
- package/DS1/2-core/ds-empty.ts +6 -4
- package/DS1/2-core/ds-input.ts +23 -3
- package/DS1/2-core/ds-message.ts +22 -0
- package/DS1/2-core/ds-number.ts +349 -0
- package/DS1/2-core/ds-progress.ts +3 -0
- package/DS1/2-core/ds-radio.ts +3 -0
- package/DS1/2-core/ds-stat.ts +3 -0
- package/DS1/2-core/ds-switch.ts +5 -1
- package/DS1/2-core/ds-tag.ts +9 -2
- package/DS1/2-core/ds-text.ts +7 -0
- package/DS1/2-core/ds-token.ts +3 -0
- package/DS1/2-core/ds-tooltip.ts +17 -2
- package/DS1/2-core/ds-window.ts +1 -0
- package/DS1/2-core/generated/ds-icon-map.ts +47 -5
- package/DS1/2-core/generated/icons-extra.ts +24 -3
- package/DS1/2-core/generated/icons-immediate.ts +3 -3
- package/DS1/2-core/number-expression.ts +64 -0
- package/DS1/2-core/styles/ds-activity.css +16 -0
- package/DS1/2-core/styles/ds-badge.css +4 -1
- package/DS1/2-core/styles/ds-button-host.css +45 -12
- package/DS1/2-core/styles/ds-button-split.css +8 -0
- package/DS1/2-core/styles/ds-button.css +92 -19
- package/DS1/2-core/styles/ds-card.css +6 -0
- package/DS1/2-core/styles/ds-checkbox.css +20 -8
- package/DS1/2-core/styles/ds-image.css +2 -1
- package/DS1/2-core/styles/ds-input.css +37 -4
- package/DS1/2-core/styles/ds-number.css +127 -0
- package/DS1/2-core/styles/ds-radio.css +4 -1
- package/DS1/2-core/styles/ds-switch.css +34 -4
- package/DS1/2-core/styles/ds-tag.css +32 -5
- package/DS1/2-core/styles/ds-text.css +13 -4
- package/DS1/2-core/styles/ds-token.css +4 -1
- package/DS1/2-core/styles/ds-tooltip.css +13 -7
- package/DS1/3-unit/calendar-base.ts +5 -2
- package/DS1/3-unit/ds-calendar.ts +711 -37
- package/DS1/3-unit/ds-carousel.ts +13 -1
- package/DS1/3-unit/ds-context.ts +40 -2
- package/DS1/3-unit/ds-form.ts +45 -10
- package/DS1/3-unit/ds-list.ts +31 -3
- package/DS1/3-unit/ds-matrix.ts +3 -0
- package/DS1/3-unit/ds-menu.ts +9 -5
- package/DS1/3-unit/ds-row.ts +17 -2
- package/DS1/3-unit/ds-select.ts +1 -1
- package/DS1/3-unit/ds-sidebar.ts +18 -3
- package/DS1/3-unit/ds-table-of-contents.ts +166 -0
- package/DS1/3-unit/ds-tabs.ts +40 -2
- package/DS1/3-unit/styles/ds-calendar.css +356 -42
- package/DS1/3-unit/styles/ds-context.css +38 -0
- package/DS1/3-unit/styles/ds-list.css +26 -1
- package/DS1/3-unit/styles/ds-matrix.css +4 -1
- package/DS1/3-unit/styles/ds-row.css +39 -0
- package/DS1/3-unit/styles/ds-select.css +22 -12
- package/DS1/3-unit/styles/ds-sidebar.css +16 -2
- package/DS1/3-unit/styles/ds-table-of-contents.css +40 -0
- package/DS1/3-unit/styles/ds-tabs.css +95 -0
- package/DS1/4-page/ds-document.ts +3 -0
- package/DS1/4-page/ds-footer.ts +93 -18
- package/DS1/4-page/ds-header.ts +5 -1
- package/DS1/4-page/ds-overlay.ts +8 -3
- package/DS1/4-page/ds-page.ts +22 -1
- package/DS1/4-page/email.ts +7 -4
- package/DS1/4-page/styles/ds-container.css +0 -1
- package/DS1/4-page/styles/ds-overlay.css +7 -0
- package/DS1/4-page/styles/ds-page.css +10 -0
- package/DS1/5-visual-kit/app-chrome.ts +129 -0
- package/DS1/5-visual-kit/bezels.ts +394 -0
- package/DS1/5-visual-kit/browser-icons.LICENSE +53 -0
- package/DS1/5-visual-kit/browser-icons.ts +47 -0
- package/DS1/5-visual-kit/browser-styles.ts +53 -0
- package/DS1/5-visual-kit/device-bezel.ts +55 -0
- package/DS1/5-visual-kit/instagram-frame.ts +15 -0
- package/DS1/5-visual-kit/instagram.ts +41 -0
- package/DS1/5-visual-kit/mobile-chrome.ts +25 -0
- package/DS1/5-visual-kit/native-icon-paths.ts +145 -0
- package/DS1/5-visual-kit/window.ts +22 -0
- package/DS1/components.ts +1 -0
- package/DS1/index.ts +14 -1
- package/DS1/react/choice.ts +4 -2
- package/DS1/react/context.ts +11 -6
- package/DS1/react/empty.ts +2 -2
- package/DS1/react/footer.ts +5 -5
- package/DS1/react/header.ts +1 -1
- package/DS1/react/message.ts +4 -2
- package/DS1/react/number.ts +53 -0
- package/DS1/react/sidebar.ts +4 -2
- package/DS1/react/table-of-contents.ts +28 -0
- package/DS1/x-flag/LICENSE.md +26 -0
- package/DS1/x-flag/ac.svg +1 -0
- package/DS1/x-flag/ad.svg +1 -0
- package/DS1/x-flag/ae.svg +1 -0
- package/DS1/x-flag/af.svg +1 -0
- package/DS1/x-flag/ag.svg +1 -0
- package/DS1/x-flag/ai.svg +1 -0
- package/DS1/x-flag/al.svg +1 -0
- package/DS1/x-flag/am.svg +1 -0
- package/DS1/x-flag/ao.svg +1 -0
- package/DS1/x-flag/aq.svg +1 -0
- package/DS1/x-flag/ar.svg +1 -0
- package/DS1/x-flag/as.svg +1 -0
- package/DS1/x-flag/at.svg +1 -0
- package/DS1/x-flag/au.svg +1 -0
- package/DS1/x-flag/aw.svg +1 -0
- package/DS1/x-flag/ax.svg +1 -0
- package/DS1/x-flag/az.svg +1 -0
- package/DS1/x-flag/ba.svg +1 -0
- package/DS1/x-flag/bb.svg +1 -0
- package/DS1/x-flag/bd.svg +1 -0
- package/DS1/x-flag/be.svg +1 -0
- package/DS1/x-flag/bf.svg +1 -0
- package/DS1/x-flag/bg.svg +1 -0
- package/DS1/x-flag/bh.svg +1 -0
- package/DS1/x-flag/bi.svg +1 -0
- package/DS1/x-flag/bj.svg +1 -0
- package/DS1/x-flag/bl.svg +1 -0
- package/DS1/x-flag/bm.svg +1 -0
- package/DS1/x-flag/bn.svg +1 -0
- package/DS1/x-flag/bo.svg +1 -0
- package/DS1/x-flag/bq-bo.svg +1 -0
- package/DS1/x-flag/bq-sa.svg +1 -0
- package/DS1/x-flag/bq-se.svg +1 -0
- package/DS1/x-flag/bq.svg +1 -0
- package/DS1/x-flag/br.svg +1 -0
- package/DS1/x-flag/bs.svg +1 -0
- package/DS1/x-flag/bt.svg +1 -0
- package/DS1/x-flag/bv.svg +1 -0
- package/DS1/x-flag/bw.svg +1 -0
- package/DS1/x-flag/by.svg +1 -0
- package/DS1/x-flag/bz.svg +1 -0
- package/DS1/x-flag/ca.svg +1 -0
- package/DS1/x-flag/cc.svg +1 -0
- package/DS1/x-flag/cd.svg +1 -0
- package/DS1/x-flag/cf.svg +1 -0
- package/DS1/x-flag/cg.svg +1 -0
- package/DS1/x-flag/ch.svg +1 -0
- package/DS1/x-flag/ci.svg +1 -0
- package/DS1/x-flag/ck.svg +1 -0
- package/DS1/x-flag/cl.svg +1 -0
- package/DS1/x-flag/cm.svg +1 -0
- package/DS1/x-flag/cn.svg +1 -0
- package/DS1/x-flag/co.svg +1 -0
- package/DS1/x-flag/cr.svg +1 -0
- package/DS1/x-flag/cu.svg +1 -0
- package/DS1/x-flag/cv.svg +1 -0
- package/DS1/x-flag/cw.svg +1 -0
- package/DS1/x-flag/cx.svg +1 -0
- package/DS1/x-flag/cy.svg +1 -0
- package/DS1/x-flag/cz.svg +1 -0
- package/DS1/x-flag/de.svg +1 -0
- package/DS1/x-flag/dj.svg +1 -0
- package/DS1/x-flag/dk.svg +1 -0
- package/DS1/x-flag/dm.svg +1 -0
- package/DS1/x-flag/do.svg +1 -0
- package/DS1/x-flag/dz.svg +1 -0
- package/DS1/x-flag/ec.svg +1 -0
- package/DS1/x-flag/ee.svg +1 -0
- package/DS1/x-flag/eg.svg +1 -0
- package/DS1/x-flag/eh.svg +1 -0
- package/DS1/x-flag/er.svg +1 -0
- package/DS1/x-flag/es-ct.svg +1 -0
- package/DS1/x-flag/es.svg +1 -0
- package/DS1/x-flag/et.svg +1 -0
- package/DS1/x-flag/eu.svg +1 -0
- package/DS1/x-flag/fi.svg +1 -0
- package/DS1/x-flag/fj.svg +1 -0
- package/DS1/x-flag/fk.svg +1 -0
- package/DS1/x-flag/fm.svg +1 -0
- package/DS1/x-flag/fo.svg +1 -0
- package/DS1/x-flag/fr.svg +1 -0
- package/DS1/x-flag/ga.svg +1 -0
- package/DS1/x-flag/gb-eng.svg +1 -0
- package/DS1/x-flag/gb-nir.svg +1 -0
- package/DS1/x-flag/gb-sct.svg +1 -0
- package/DS1/x-flag/gb-wls.svg +1 -0
- package/DS1/x-flag/gb.svg +1 -0
- package/DS1/x-flag/gd.svg +1 -0
- package/DS1/x-flag/ge.svg +1 -0
- package/DS1/x-flag/gf.svg +1 -0
- package/DS1/x-flag/gg.svg +1 -0
- package/DS1/x-flag/gh.svg +1 -0
- package/DS1/x-flag/gi.svg +1 -0
- package/DS1/x-flag/gl.svg +1 -0
- package/DS1/x-flag/gm.svg +1 -0
- package/DS1/x-flag/gn.svg +1 -0
- package/DS1/x-flag/gp.svg +1 -0
- package/DS1/x-flag/gq.svg +1 -0
- package/DS1/x-flag/gr.svg +1 -0
- package/DS1/x-flag/gs.svg +1 -0
- package/DS1/x-flag/gt.svg +1 -0
- package/DS1/x-flag/gu.svg +1 -0
- package/DS1/x-flag/gw.svg +1 -0
- package/DS1/x-flag/gy.svg +1 -0
- package/DS1/x-flag/hk.svg +1 -0
- package/DS1/x-flag/hm.svg +1 -0
- package/DS1/x-flag/hn.svg +1 -0
- package/DS1/x-flag/hr.svg +1 -0
- package/DS1/x-flag/ht.svg +1 -0
- package/DS1/x-flag/hu.svg +1 -0
- package/DS1/x-flag/ic.svg +1 -0
- package/DS1/x-flag/id.svg +1 -0
- package/DS1/x-flag/ie.svg +1 -0
- package/DS1/x-flag/il.svg +1 -0
- package/DS1/x-flag/im.svg +1 -0
- package/DS1/x-flag/in.svg +1 -0
- package/DS1/x-flag/io.svg +1 -0
- package/DS1/x-flag/iq.svg +1 -0
- package/DS1/x-flag/ir.svg +1 -0
- package/DS1/x-flag/is.svg +1 -0
- package/DS1/x-flag/it.svg +1 -0
- package/DS1/x-flag/je.svg +1 -0
- package/DS1/x-flag/jm.svg +1 -0
- package/DS1/x-flag/jo.svg +1 -0
- package/DS1/x-flag/jp.svg +1 -0
- package/DS1/x-flag/ke.svg +1 -0
- package/DS1/x-flag/kg.svg +1 -0
- package/DS1/x-flag/kh.svg +1 -0
- package/DS1/x-flag/ki.svg +1 -0
- package/DS1/x-flag/km.svg +1 -0
- package/DS1/x-flag/kn.svg +1 -0
- package/DS1/x-flag/kp.svg +1 -0
- package/DS1/x-flag/kr.svg +1 -0
- package/DS1/x-flag/kw.svg +1 -0
- package/DS1/x-flag/ky.svg +1 -0
- package/DS1/x-flag/kz.svg +1 -0
- package/DS1/x-flag/la.svg +1 -0
- package/DS1/x-flag/lb.svg +1 -0
- package/DS1/x-flag/lc.svg +1 -0
- package/DS1/x-flag/li.svg +1 -0
- package/DS1/x-flag/lk.svg +1 -0
- package/DS1/x-flag/lr.svg +1 -0
- package/DS1/x-flag/ls.svg +1 -0
- package/DS1/x-flag/lt.svg +1 -0
- package/DS1/x-flag/lu.svg +1 -0
- package/DS1/x-flag/lv.svg +1 -0
- package/DS1/x-flag/ly.svg +1 -0
- package/DS1/x-flag/ma.svg +1 -0
- package/DS1/x-flag/mc.svg +1 -0
- package/DS1/x-flag/md.svg +1 -0
- package/DS1/x-flag/me.svg +1 -0
- package/DS1/x-flag/mf.svg +1 -0
- package/DS1/x-flag/mg.svg +1 -0
- package/DS1/x-flag/mh.svg +1 -0
- package/DS1/x-flag/mk.svg +1 -0
- package/DS1/x-flag/ml.svg +1 -0
- package/DS1/x-flag/mm.svg +1 -0
- package/DS1/x-flag/mn.svg +1 -0
- package/DS1/x-flag/mo.svg +1 -0
- package/DS1/x-flag/mp.svg +1 -0
- package/DS1/x-flag/mq.svg +1 -0
- package/DS1/x-flag/mr.svg +1 -0
- package/DS1/x-flag/ms.svg +1 -0
- package/DS1/x-flag/mt.svg +1 -0
- package/DS1/x-flag/mu.svg +1 -0
- package/DS1/x-flag/mv.svg +1 -0
- package/DS1/x-flag/mw.svg +1 -0
- package/DS1/x-flag/mx.svg +1 -0
- package/DS1/x-flag/my.svg +1 -0
- package/DS1/x-flag/mz.svg +1 -0
- package/DS1/x-flag/na.svg +1 -0
- package/DS1/x-flag/nc.svg +1 -0
- package/DS1/x-flag/ne.svg +1 -0
- package/DS1/x-flag/nf.svg +1 -0
- package/DS1/x-flag/ng.svg +1 -0
- package/DS1/x-flag/ni.svg +1 -0
- package/DS1/x-flag/nl.svg +1 -0
- package/DS1/x-flag/no.svg +1 -0
- package/DS1/x-flag/np.svg +1 -0
- package/DS1/x-flag/nr.svg +1 -0
- package/DS1/x-flag/nu.svg +1 -0
- package/DS1/x-flag/nz.svg +1 -0
- package/DS1/x-flag/om.svg +1 -0
- package/DS1/x-flag/pa.svg +1 -0
- package/DS1/x-flag/pe.svg +1 -0
- package/DS1/x-flag/pf.svg +1 -0
- package/DS1/x-flag/pg.svg +1 -0
- package/DS1/x-flag/ph.svg +1 -0
- package/DS1/x-flag/pk.svg +1 -0
- package/DS1/x-flag/pl.svg +1 -0
- package/DS1/x-flag/pm.svg +1 -0
- package/DS1/x-flag/pn.svg +1 -0
- package/DS1/x-flag/pr.svg +1 -0
- package/DS1/x-flag/ps.svg +1 -0
- package/DS1/x-flag/pt.svg +1 -0
- package/DS1/x-flag/pw.svg +1 -0
- package/DS1/x-flag/py.svg +1 -0
- package/DS1/x-flag/qa.svg +1 -0
- package/DS1/x-flag/re.svg +1 -0
- package/DS1/x-flag/ro.svg +1 -0
- package/DS1/x-flag/rs.svg +1 -0
- package/DS1/x-flag/ru.svg +1 -0
- package/DS1/x-flag/rw.svg +1 -0
- package/DS1/x-flag/sa.svg +1 -0
- package/DS1/x-flag/sb.svg +1 -0
- package/DS1/x-flag/sc.svg +1 -0
- package/DS1/x-flag/sd.svg +1 -0
- package/DS1/x-flag/se.svg +1 -0
- package/DS1/x-flag/sg.svg +1 -0
- package/DS1/x-flag/sh.svg +1 -0
- package/DS1/x-flag/si.svg +1 -0
- package/DS1/x-flag/sj.svg +1 -0
- package/DS1/x-flag/sk.svg +1 -0
- package/DS1/x-flag/sl.svg +1 -0
- package/DS1/x-flag/sm.svg +1 -0
- package/DS1/x-flag/sn.svg +1 -0
- package/DS1/x-flag/so.svg +1 -0
- package/DS1/x-flag/sr.svg +1 -0
- package/DS1/x-flag/ss.svg +1 -0
- package/DS1/x-flag/st.svg +1 -0
- package/DS1/x-flag/sv.svg +1 -0
- package/DS1/x-flag/sx.svg +1 -0
- package/DS1/x-flag/sy.svg +1 -0
- package/DS1/x-flag/sz.svg +1 -0
- package/DS1/x-flag/ta.svg +1 -0
- package/DS1/x-flag/tc.svg +1 -0
- package/DS1/x-flag/td.svg +1 -0
- package/DS1/x-flag/tf.svg +1 -0
- package/DS1/x-flag/tg.svg +1 -0
- package/DS1/x-flag/th.svg +1 -0
- package/DS1/x-flag/tj.svg +1 -0
- package/DS1/x-flag/tk.svg +1 -0
- package/DS1/x-flag/tl.svg +1 -0
- package/DS1/x-flag/tm.svg +1 -0
- package/DS1/x-flag/tn.svg +1 -0
- package/DS1/x-flag/to.svg +1 -0
- package/DS1/x-flag/tr.svg +1 -0
- package/DS1/x-flag/tt.svg +1 -0
- package/DS1/x-flag/tv.svg +1 -0
- package/DS1/x-flag/tw.svg +1 -0
- package/DS1/x-flag/tz.svg +1 -0
- package/DS1/x-flag/ua.svg +1 -0
- package/DS1/x-flag/ug.svg +1 -0
- package/DS1/x-flag/um.svg +1 -0
- package/DS1/x-flag/us.svg +1 -0
- package/DS1/x-flag/uy.svg +1 -0
- package/DS1/x-flag/uz.svg +1 -0
- package/DS1/x-flag/va.svg +1 -0
- package/DS1/x-flag/vc.svg +1 -0
- package/DS1/x-flag/ve.svg +1 -0
- package/DS1/x-flag/vg.svg +1 -0
- package/DS1/x-flag/vi.svg +1 -0
- package/DS1/x-flag/vn.svg +1 -0
- package/DS1/x-flag/vu.svg +1 -0
- package/DS1/x-flag/wf.svg +1 -0
- package/DS1/x-flag/ws.svg +1 -0
- package/DS1/x-flag/xk.svg +1 -0
- package/DS1/x-flag/ye.svg +1 -0
- package/DS1/x-flag/yt.svg +1 -0
- package/DS1/x-flag/za.svg +1 -0
- package/DS1/x-flag/zm.svg +1 -0
- package/DS1/x-flag/zw.svg +1 -0
- package/DS1/x-icon/android.svg +9 -0
- package/DS1/x-icon/arrange-check.svg +1 -1
- package/DS1/x-icon/arrange-page.svg +1 -1
- package/DS1/x-icon/chrome.svg +7 -0
- package/DS1/x-icon/edge-brand.svg +6 -0
- package/DS1/x-icon/firefox.svg +4 -0
- package/DS1/x-icon/health.svg +3 -0
- package/DS1/x-icon/left.svg +2 -3
- package/DS1/x-icon/linux.svg +1 -0
- package/DS1/x-icon/material.svg +1 -0
- package/DS1/x-icon/milestone-planned.svg +3 -0
- package/DS1/x-icon/milestone.svg +3 -0
- package/DS1/x-icon/more.svg +1 -5
- package/DS1/x-icon/network.svg +3 -0
- package/DS1/x-icon/opera.svg +4 -0
- package/DS1/x-icon/prediction.svg +3 -0
- package/DS1/x-icon/priority-high.svg +3 -0
- package/DS1/x-icon/priority-low.svg +3 -0
- package/DS1/x-icon/priority-medium.svg +3 -0
- package/DS1/x-icon/project.svg +3 -0
- package/DS1/x-icon/redo.svg +2 -2
- package/DS1/x-icon/repeat-small.svg +3 -0
- package/DS1/x-icon/safari.svg +4 -0
- package/DS1/x-icon/scaling.svg +3 -0
- package/DS1/x-icon/tabs.svg +4 -0
- package/DS1/x-icon/windows.svg +5 -0
- package/README.md +3 -3
- package/dist/0-face/button-label.d.ts +5 -0
- package/dist/0-face/button-label.d.ts.map +1 -0
- package/dist/0-face/button-label.js +31 -0
- package/dist/0-face/calendar.d.ts +1 -1
- package/dist/0-face/calendar.d.ts.map +1 -1
- package/dist/0-face/calendar.js +6 -3
- package/dist/0-face/carousel.d.ts +9 -0
- package/dist/0-face/carousel.d.ts.map +1 -1
- package/dist/0-face/carousel.js +80 -0
- package/dist/0-face/constraint-panel.d.ts +43 -0
- package/dist/0-face/constraint-panel.d.ts.map +1 -0
- package/dist/0-face/constraint-panel.js +429 -0
- package/dist/0-face/constraint-site.d.ts +72 -0
- package/dist/0-face/constraint-site.d.ts.map +1 -0
- package/dist/0-face/constraint-site.js +185 -0
- package/dist/0-face/constraints.d.ts +47 -0
- package/dist/0-face/constraints.d.ts.map +1 -0
- package/dist/0-face/constraints.js +247 -0
- package/dist/0-face/copy-text.js +1 -1
- package/dist/0-face/cut-fade.d.ts +112 -0
- package/dist/0-face/cut-fade.d.ts.map +1 -0
- package/dist/0-face/cut-fade.js +274 -0
- package/dist/0-face/define.d.ts.map +1 -1
- package/dist/0-face/define.js +24 -3
- package/dist/0-face/face-correction.d.ts +51 -0
- package/dist/0-face/face-correction.d.ts.map +1 -0
- package/dist/0-face/face-correction.js +80 -0
- package/dist/0-face/failures.d.ts +16 -0
- package/dist/0-face/failures.d.ts.map +1 -0
- package/dist/0-face/failures.js +21 -0
- package/dist/0-face/feedback-overlays.d.ts.map +1 -1
- package/dist/0-face/feedback-overlays.js +5 -3
- package/dist/0-face/feedback.d.ts +2 -0
- package/dist/0-face/feedback.d.ts.map +1 -1
- package/dist/0-face/feedback.js +1 -0
- package/dist/0-face/focus.d.ts +71 -0
- package/dist/0-face/focus.d.ts.map +1 -0
- package/dist/0-face/focus.js +196 -0
- package/dist/0-face/grid.d.ts +11 -1
- package/dist/0-face/grid.d.ts.map +1 -1
- package/dist/0-face/grid.js +90 -4
- package/dist/0-face/i18n.d.ts.map +1 -1
- package/dist/0-face/i18n.js +38 -16
- package/dist/0-face/layout-inspector.d.ts +5 -1
- package/dist/0-face/layout-inspector.d.ts.map +1 -1
- package/dist/0-face/layout-inspector.js +130 -104
- package/dist/0-face/preference-options.d.ts +4 -0
- package/dist/0-face/preference-options.d.ts.map +1 -1
- package/dist/0-face/scaling.d.ts +8 -1
- package/dist/0-face/scaling.d.ts.map +1 -1
- package/dist/0-face/scaling.js +19 -2
- package/dist/0-face/shape.d.ts +35 -0
- package/dist/0-face/shape.d.ts.map +1 -0
- package/dist/0-face/shape.js +23 -0
- package/dist/0-face/text-contrast.d.ts +22 -0
- package/dist/0-face/text-contrast.d.ts.map +1 -0
- package/dist/0-face/text-contrast.js +178 -0
- package/dist/0-face/theme-bootstrap.js +56 -0
- package/dist/0-face/toast-queue.d.ts +4 -0
- package/dist/0-face/toast-queue.d.ts.map +1 -1
- package/dist/0-face/toast-queue.js +4 -1
- package/dist/0-face/translations/da.json +10 -1
- package/dist/0-face/translations/de.json +10 -1
- package/dist/0-face/translations/en.json +10 -1
- package/dist/0-face/translations/es.json +10 -1
- package/dist/0-face/translations/fi.json +10 -1
- package/dist/0-face/translations/fr.json +10 -1
- package/dist/0-face/translations/is.json +10 -1
- package/dist/0-face/translations/it.json +10 -1
- package/dist/0-face/translations/ja.json +10 -1
- package/dist/0-face/translations/ko.json +10 -1
- package/dist/0-face/translations/nb.json +10 -1
- package/dist/0-face/translations/pt-BR.json +10 -1
- package/dist/0-face/translations/pt.json +10 -1
- package/dist/0-face/translations/sv.json +10 -1
- package/dist/0-face/translations/zh.json +10 -1
- package/dist/0-face/word-wrap.d.ts +6 -0
- package/dist/0-face/word-wrap.d.ts.map +1 -0
- package/dist/0-face/word-wrap.js +119 -0
- package/dist/1-root/foundation.d.ts +12 -0
- package/dist/1-root/foundation.d.ts.map +1 -0
- package/dist/1-root/foundation.js +59 -0
- package/dist/2-core/button-split.d.ts +1 -0
- package/dist/2-core/button-split.d.ts.map +1 -1
- package/dist/2-core/button-split.js +9 -4
- package/dist/2-core/chart/grid-chart.d.ts +2 -0
- package/dist/2-core/chart/grid-chart.d.ts.map +1 -1
- package/dist/2-core/chart/grid-chart.js +2 -1
- package/dist/2-core/ds-activity.d.ts +25 -0
- package/dist/2-core/ds-activity.d.ts.map +1 -0
- package/dist/2-core/ds-activity.js +28 -0
- package/dist/2-core/ds-app-chrome.d.ts +2 -0
- package/dist/2-core/ds-app-chrome.d.ts.map +1 -0
- package/dist/2-core/ds-app-chrome.js +1 -0
- package/dist/2-core/ds-avatar.d.ts +7 -0
- package/dist/2-core/ds-avatar.d.ts.map +1 -1
- package/dist/2-core/ds-avatar.js +41 -6
- package/dist/2-core/ds-badge.d.ts +7 -1
- package/dist/2-core/ds-badge.d.ts.map +1 -1
- package/dist/2-core/ds-badge.js +8 -1
- package/dist/2-core/ds-button.d.ts +12 -0
- package/dist/2-core/ds-button.d.ts.map +1 -1
- package/dist/2-core/ds-button.js +4 -0
- package/dist/2-core/ds-chart.d.ts +28 -3
- package/dist/2-core/ds-chart.d.ts.map +1 -1
- package/dist/2-core/ds-chart.js +110 -130
- package/dist/2-core/ds-cycle.d.ts +2 -2
- package/dist/2-core/ds-cycle.d.ts.map +1 -1
- package/dist/2-core/ds-cycle.js +36 -171
- package/dist/2-core/ds-device-bezel.d.ts +2 -0
- package/dist/2-core/ds-device-bezel.d.ts.map +1 -0
- package/dist/2-core/ds-device-bezel.js +1 -0
- package/dist/2-core/ds-empty.d.ts +2 -2
- package/dist/2-core/ds-empty.d.ts.map +1 -1
- package/dist/2-core/ds-empty.js +6 -4
- package/dist/2-core/ds-input.d.ts +7 -0
- package/dist/2-core/ds-input.d.ts.map +1 -1
- package/dist/2-core/ds-input.js +23 -3
- package/dist/2-core/ds-message.d.ts +11 -0
- package/dist/2-core/ds-message.d.ts.map +1 -1
- package/dist/2-core/ds-message.js +18 -0
- package/dist/2-core/ds-number.d.ts +86 -0
- package/dist/2-core/ds-number.d.ts.map +1 -0
- package/dist/2-core/ds-number.js +326 -0
- package/dist/2-core/ds-progress.d.ts +3 -0
- package/dist/2-core/ds-progress.d.ts.map +1 -1
- package/dist/2-core/ds-progress.js +3 -0
- package/dist/2-core/ds-radio.d.ts +3 -0
- package/dist/2-core/ds-radio.d.ts.map +1 -1
- package/dist/2-core/ds-radio.js +10 -1
- package/dist/2-core/ds-stat.d.ts +3 -0
- package/dist/2-core/ds-stat.d.ts.map +1 -1
- package/dist/2-core/ds-stat.js +3 -0
- package/dist/2-core/ds-switch.d.ts +14 -1
- package/dist/2-core/ds-switch.d.ts.map +1 -1
- package/dist/2-core/ds-switch.js +3 -1
- package/dist/2-core/ds-tag.d.ts +8 -1
- package/dist/2-core/ds-tag.d.ts.map +1 -1
- package/dist/2-core/ds-tag.js +12 -2
- package/dist/2-core/ds-text.d.ts +7 -0
- package/dist/2-core/ds-text.d.ts.map +1 -1
- package/dist/2-core/ds-text.js +7 -0
- package/dist/2-core/ds-token.d.ts +3 -0
- package/dist/2-core/ds-token.d.ts.map +1 -1
- package/dist/2-core/ds-token.js +3 -0
- package/dist/2-core/ds-tooltip.d.ts.map +1 -1
- package/dist/2-core/ds-tooltip.js +23 -2
- package/dist/2-core/ds-window.d.ts +2 -0
- package/dist/2-core/ds-window.d.ts.map +1 -0
- package/dist/2-core/ds-window.js +1 -0
- package/dist/2-core/generated/ds-icon-map.d.ts +27 -6
- package/dist/2-core/generated/ds-icon-map.d.ts.map +1 -1
- package/dist/2-core/generated/ds-icon-map.js +47 -5
- package/dist/2-core/generated/icons-extra.d.ts.map +1 -1
- package/dist/2-core/generated/icons-extra.js +24 -3
- package/dist/2-core/generated/icons-immediate.d.ts +1 -1
- package/dist/2-core/generated/icons-immediate.d.ts.map +1 -1
- package/dist/2-core/generated/icons-immediate.js +3 -3
- package/dist/2-core/number-expression.d.ts +12 -0
- package/dist/2-core/number-expression.d.ts.map +1 -0
- package/dist/2-core/number-expression.js +82 -0
- package/dist/3-unit/calendar-base.d.ts +5 -0
- package/dist/3-unit/calendar-base.d.ts.map +1 -1
- package/dist/3-unit/calendar-base.js +3 -2
- package/dist/3-unit/ds-calendar.d.ts +197 -4
- package/dist/3-unit/ds-calendar.d.ts.map +1 -1
- package/dist/3-unit/ds-calendar.js +687 -45
- package/dist/3-unit/ds-carousel.d.ts +3 -0
- package/dist/3-unit/ds-carousel.d.ts.map +1 -1
- package/dist/3-unit/ds-carousel.js +13 -1
- package/dist/3-unit/ds-context.d.ts +18 -1
- package/dist/3-unit/ds-context.d.ts.map +1 -1
- package/dist/3-unit/ds-context.js +37 -1
- package/dist/3-unit/ds-form.d.ts +9 -0
- package/dist/3-unit/ds-form.d.ts.map +1 -1
- package/dist/3-unit/ds-form.js +50 -10
- package/dist/3-unit/ds-list.d.ts +20 -1
- package/dist/3-unit/ds-list.d.ts.map +1 -1
- package/dist/3-unit/ds-list.js +31 -3
- package/dist/3-unit/ds-matrix.d.ts +3 -0
- package/dist/3-unit/ds-matrix.d.ts.map +1 -1
- package/dist/3-unit/ds-matrix.js +3 -0
- package/dist/3-unit/ds-menu.d.ts.map +1 -1
- package/dist/3-unit/ds-menu.js +17 -1
- package/dist/3-unit/ds-row.d.ts +13 -0
- package/dist/3-unit/ds-row.d.ts.map +1 -1
- package/dist/3-unit/ds-row.js +15 -2
- package/dist/3-unit/ds-select.js +1 -1
- package/dist/3-unit/ds-sidebar.d.ts +17 -0
- package/dist/3-unit/ds-sidebar.d.ts.map +1 -1
- package/dist/3-unit/ds-sidebar.js +14 -3
- package/dist/3-unit/ds-table-of-contents.d.ts +68 -0
- package/dist/3-unit/ds-table-of-contents.d.ts.map +1 -0
- package/dist/3-unit/ds-table-of-contents.js +190 -0
- package/dist/3-unit/ds-tabs.d.ts +32 -1
- package/dist/3-unit/ds-tabs.d.ts.map +1 -1
- package/dist/3-unit/ds-tabs.js +39 -1
- package/dist/4-page/ds-document.d.ts +3 -0
- package/dist/4-page/ds-document.d.ts.map +1 -1
- package/dist/4-page/ds-document.js +3 -0
- package/dist/4-page/ds-footer.d.ts +47 -7
- package/dist/4-page/ds-footer.d.ts.map +1 -1
- package/dist/4-page/ds-footer.js +58 -14
- package/dist/4-page/ds-header.d.ts +6 -0
- package/dist/4-page/ds-header.d.ts.map +1 -1
- package/dist/4-page/ds-header.js +4 -1
- package/dist/4-page/ds-overlay.d.ts +2 -2
- package/dist/4-page/ds-overlay.d.ts.map +1 -1
- package/dist/4-page/ds-overlay.js +8 -3
- package/dist/4-page/ds-page.d.ts +12 -0
- package/dist/4-page/ds-page.d.ts.map +1 -1
- package/dist/4-page/ds-page.js +19 -1
- package/dist/4-page/email.d.ts +2 -0
- package/dist/4-page/email.d.ts.map +1 -1
- package/dist/4-page/email.js +5 -4
- package/dist/5-visual-kit/app-chrome.d.ts +98 -0
- package/dist/5-visual-kit/app-chrome.d.ts.map +1 -0
- package/dist/5-visual-kit/app-chrome.js +119 -0
- package/dist/5-visual-kit/bezels.d.ts +30 -0
- package/dist/5-visual-kit/bezels.d.ts.map +1 -0
- package/dist/5-visual-kit/bezels.js +388 -0
- package/dist/5-visual-kit/browser-icons.d.ts +5 -0
- package/dist/5-visual-kit/browser-icons.d.ts.map +1 -0
- package/dist/5-visual-kit/browser-icons.js +51 -0
- package/dist/5-visual-kit/browser-styles.d.ts +3 -0
- package/dist/5-visual-kit/browser-styles.d.ts.map +1 -0
- package/dist/5-visual-kit/browser-styles.js +52 -0
- package/dist/5-visual-kit/device-bezel.d.ts +84 -0
- package/dist/5-visual-kit/device-bezel.d.ts.map +1 -0
- package/dist/5-visual-kit/device-bezel.js +56 -0
- package/dist/5-visual-kit/instagram-frame.d.ts +8 -0
- package/dist/5-visual-kit/instagram-frame.d.ts.map +1 -0
- package/dist/5-visual-kit/instagram-frame.js +13 -0
- package/dist/5-visual-kit/instagram.d.ts +18 -0
- package/dist/5-visual-kit/instagram.d.ts.map +1 -0
- package/dist/5-visual-kit/instagram.js +39 -0
- package/dist/5-visual-kit/mobile-chrome.d.ts +4 -0
- package/dist/5-visual-kit/mobile-chrome.d.ts.map +1 -0
- package/dist/5-visual-kit/mobile-chrome.js +24 -0
- package/dist/5-visual-kit/native-icon-paths.d.ts +146 -0
- package/dist/5-visual-kit/native-icon-paths.d.ts.map +1 -0
- package/dist/5-visual-kit/native-icon-paths.js +145 -0
- package/dist/5-visual-kit/window.d.ts +51 -0
- package/dist/5-visual-kit/window.d.ts.map +1 -0
- package/dist/5-visual-kit/window.js +20 -0
- package/dist/browser-icons-BFbS1tIx.js +56 -0
- package/dist/browser-icons-BFbS1tIx.js.map +1 -0
- package/dist/browser-icons-CT8qU77Z.js +48 -0
- package/dist/browser-icons-CT8qU77Z.js.map +1 -0
- package/dist/components.d.ts +1 -0
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +1 -0
- package/dist/design-system-1.bundle.js +5514 -2077
- package/dist/design-system-1.bundle.js.map +1 -1
- package/dist/design-system-1.bundle.min.js +7026 -4628
- package/dist/design-system-1.bundle.min.js.map +1 -1
- package/dist/design-system-1.css +1 -1
- package/dist/feedback.js +197 -167
- package/dist/feedback.js.map +1 -1
- package/dist/{icons-extra-CRxxWFjX.js → icons-extra-BMPvmQPI.js} +25 -4
- package/dist/icons-extra-BMPvmQPI.js.map +1 -0
- package/dist/{icons-extra-H5pqCM_R.js → icons-extra-BfYOw-cR.js} +83 -5
- package/dist/icons-extra-BfYOw-cR.js.map +1 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/instagram-CKofs55A.js +50 -0
- package/dist/instagram-CKofs55A.js.map +1 -0
- package/dist/instagram-CcYf5oiM.js +48 -0
- package/dist/instagram-CcYf5oiM.js.map +1 -0
- package/dist/lit-Ce_uWYM4.js +612 -0
- package/dist/lit-Ce_uWYM4.js.map +1 -0
- package/dist/lit-DGUVm1Ce.js +557 -0
- package/dist/lit-DGUVm1Ce.js.map +1 -0
- package/dist/native-icon-paths-CB9evXBM.js +93 -0
- package/dist/native-icon-paths-CB9evXBM.js.map +1 -0
- package/dist/native-icon-paths-zay-3g_n.js +150 -0
- package/dist/native-icon-paths-zay-3g_n.js.map +1 -0
- package/dist/react/avatar.d.ts +1 -1
- package/dist/react/choice.d.ts +4 -0
- package/dist/react/choice.d.ts.map +1 -1
- package/dist/react/choice.js +2 -2
- package/dist/react/context.d.ts +19 -4
- package/dist/react/context.d.ts.map +1 -1
- package/dist/react/context.js +4 -4
- package/dist/react/empty.d.ts +2 -2
- package/dist/react/empty.d.ts.map +1 -1
- package/dist/react/empty.js +1 -1
- package/dist/react/footer.d.ts +5 -5
- package/dist/react/footer.d.ts.map +1 -1
- package/dist/react/footer.js +2 -2
- package/dist/react/header.d.ts +2 -2
- package/dist/react/header.d.ts.map +1 -1
- package/dist/react/message.d.ts +4 -0
- package/dist/react/message.d.ts.map +1 -1
- package/dist/react/message.js +2 -2
- package/dist/react/number.d.ts +53 -0
- package/dist/react/number.d.ts.map +1 -0
- package/dist/react/number.js +25 -0
- package/dist/react/page.d.ts +1 -1
- package/dist/react/sidebar.d.ts +4 -0
- package/dist/react/sidebar.d.ts.map +1 -1
- package/dist/react/sidebar.js +2 -2
- package/dist/react/table-of-contents.d.ts +19 -0
- package/dist/react/table-of-contents.d.ts.map +1 -0
- package/dist/react/table-of-contents.js +28 -0
- package/dist/{shared-words-CdMDVtXx.js → shared-words-C5cjxMjZ.js} +151 -16
- package/dist/shared-words-C5cjxMjZ.js.map +1 -0
- package/dist/{shared-words-BtRee8xR.js → shared-words-Cdm7xd-_.js} +163 -28
- package/dist/shared-words-Cdm7xd-_.js.map +1 -0
- package/package.json +23 -12
- package/DS1/3-unit/ds-calendar-large.ts +0 -353
- package/DS1/3-unit/styles/ds-calendar-large.css +0 -178
- package/dist/3-unit/ds-calendar-large.d.ts +0 -142
- package/dist/3-unit/ds-calendar-large.d.ts.map +0 -1
- package/dist/3-unit/ds-calendar-large.js +0 -308
- package/dist/icons-extra-CRxxWFjX.js.map +0 -1
- package/dist/icons-extra-H5pqCM_R.js.map +0 -1
- package/dist/shared-words-BtRee8xR.js.map +0 -1
- package/dist/shared-words-CdMDVtXx.js.map +0 -1
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Inspect a page's layout without changing its size, opacity, or interaction:
|
|
3
|
+
* named areas in dashed outlines with their name and size, text and fields in
|
|
4
|
+
* green boxes, and every component (a custom element) outlined with its tag name.
|
|
5
|
+
*/
|
|
2
6
|
export function createLayoutInspector() {
|
|
3
7
|
const root = document.documentElement;
|
|
4
8
|
const overlay = document.createElement('div');
|
|
@@ -17,145 +21,167 @@ export function createLayoutInspector() {
|
|
|
17
21
|
color-scheme: inherit !important;
|
|
18
22
|
}
|
|
19
23
|
:host([hidden]) { display: none !important; }
|
|
20
|
-
.
|
|
21
|
-
.
|
|
22
|
-
.area {
|
|
24
|
+
.boxes { position: absolute; inset: 0; overflow: hidden; }
|
|
25
|
+
.box {
|
|
23
26
|
position: absolute;
|
|
24
27
|
box-sizing: border-box;
|
|
25
|
-
|
|
26
|
-
place-items: center;
|
|
27
|
-
background: color-mix(in srgb, var(--pastel) 40%, transparent);
|
|
28
|
-
border: 1px solid color-mix(in srgb, var(--pastel) 65%, #82718d);
|
|
28
|
+
border: 1px solid var(--tint);
|
|
29
29
|
}
|
|
30
|
-
.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
color: var(--base-slate, CanvasText);
|
|
36
|
-
font: 400 14px/20px var(--font-regular, var(--typeface-regular, sans-serif));
|
|
37
|
-
text-align: center;
|
|
38
|
-
overflow-wrap: anywhere;
|
|
39
|
-
}
|
|
40
|
-
.area[data-container] {
|
|
41
|
-
background: transparent;
|
|
42
|
-
}
|
|
43
|
-
.area[data-container] > .name {
|
|
30
|
+
.area { --tint: #efc9dc; border-style: dashed; }
|
|
31
|
+
.text { --tint: #bfe0cd; background: color-mix(in srgb, var(--tint) 18%, transparent); }
|
|
32
|
+
.field { --tint: #bfe0cd; background: color-mix(in srgb, var(--tint) 45%, transparent); }
|
|
33
|
+
.component { --tint: #d5c9ef; }
|
|
34
|
+
.tag {
|
|
44
35
|
position: absolute;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
transform: translateX(-50%);
|
|
53
|
-
width: max-content;
|
|
54
|
-
max-width: none;
|
|
55
|
-
padding: 2px 4px;
|
|
56
|
-
font-size: 12px;
|
|
57
|
-
line-height: 16px;
|
|
58
|
-
white-space: nowrap;
|
|
59
|
-
}
|
|
60
|
-
.dimensions {
|
|
61
|
-
display: block;
|
|
62
|
-
font-size: 12px;
|
|
63
|
-
line-height: 16px;
|
|
36
|
+
box-sizing: border-box;
|
|
37
|
+
display: flex;
|
|
38
|
+
gap: 6px;
|
|
39
|
+
padding: 0 4px;
|
|
40
|
+
background: var(--tint);
|
|
41
|
+
color: #2a2530;
|
|
42
|
+
font: 400 12px/16px var(--font-regular, var(--typeface-regular, sans-serif));
|
|
64
43
|
font-variant-numeric: tabular-nums;
|
|
65
44
|
white-space: nowrap;
|
|
66
45
|
}
|
|
46
|
+
.area > .tag { top: -1px; right: -1px; }
|
|
47
|
+
.component > .tag { bottom: 100%; left: -1px; }
|
|
48
|
+
.component[data-inside] > .tag { bottom: auto; top: -1px; }
|
|
49
|
+
.measure { opacity: 0.7; }
|
|
67
50
|
@media print { :host { display: none !important; } }
|
|
68
|
-
</style><div class="
|
|
51
|
+
</style><div class="boxes"></div>`;
|
|
69
52
|
document.body.appendChild(overlay);
|
|
70
|
-
const layer = shadow.querySelector('.
|
|
71
|
-
|
|
53
|
+
const layer = shadow.querySelector('.boxes');
|
|
54
|
+
// A page of thousands of words draws its first boxes and stops.
|
|
55
|
+
const limit = 2000;
|
|
56
|
+
const fields = new Set(['input', 'textarea', 'select', 'img', 'picture', 'svg', 'video', 'canvas', 'iframe']);
|
|
57
|
+
const skipped = new Set(['script', 'style', 'template', 'noscript', 'link', 'meta', 'slot']);
|
|
58
|
+
// Primitives drawn as what they show rather than named: words, an icon,
|
|
59
|
+
// and a gap with nothing to see.
|
|
60
|
+
const primitives = { 'ds-text': 'text', 'ds-icon': 'field', 'ds-gap': 'none' };
|
|
72
61
|
let frame = 0;
|
|
73
62
|
let visible = false;
|
|
74
63
|
const observed = new Set();
|
|
75
64
|
const observedRoots = new Set();
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
|
|
65
|
+
const collect = () => {
|
|
66
|
+
const areas = [];
|
|
67
|
+
const words = [];
|
|
68
|
+
const components = [];
|
|
69
|
+
const visit = (parent, inText) => {
|
|
70
|
+
for (const element of Array.from(parent.children)) {
|
|
71
|
+
const name = element.localName;
|
|
72
|
+
if (skipped.has(name) || element.hasAttribute('data-ds-layout-overlay') || element.hasAttribute('data-ds-grid-overlay'))
|
|
73
|
+
continue;
|
|
74
|
+
if (element.hasAttribute('data-ds-area'))
|
|
75
|
+
areas.push(element);
|
|
76
|
+
const primitive = primitives[name];
|
|
77
|
+
if (primitive === 'none')
|
|
78
|
+
continue;
|
|
79
|
+
const component = !primitive && name.includes('-');
|
|
80
|
+
if (component)
|
|
81
|
+
components.push(element);
|
|
82
|
+
if (fields.has(name) || primitive === 'field') {
|
|
83
|
+
if (!inText)
|
|
84
|
+
words.push([element, 'field']);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const text = !inText && !component && (primitive === 'text' || Array.from(element.childNodes).some((node) => node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== ''));
|
|
88
|
+
if (text)
|
|
89
|
+
words.push([element, 'text']);
|
|
90
|
+
// A design system component is drawn whole; an app's own component is
|
|
91
|
+
// opened, so what it holds is drawn too.
|
|
92
|
+
const content = element.shadowRoot;
|
|
93
|
+
if (content && !primitive && (!name.startsWith('ds-') || element.hasAttribute('data-ds-layout-root'))) {
|
|
94
|
+
if (!observedRoots.has(content)) {
|
|
95
|
+
mutations.observe(content, { subtree: true, childList: true, characterData: true });
|
|
96
|
+
observedRoots.add(content);
|
|
97
|
+
}
|
|
98
|
+
visit(content, inText || text);
|
|
86
99
|
}
|
|
87
|
-
|
|
88
|
-
}
|
|
100
|
+
visit(element, inText || text);
|
|
101
|
+
}
|
|
89
102
|
};
|
|
90
|
-
|
|
91
|
-
if (named.length)
|
|
92
|
-
return named;
|
|
103
|
+
visit(document.querySelector('[data-ds-inspect-active]') ?? document.body, false);
|
|
93
104
|
// Semantic fallback for pages that have not supplied their own area names.
|
|
94
|
-
|
|
105
|
+
const named = areas.length ? areas : Array.from(document.querySelectorAll('header, main, section, footer, one-footer'))
|
|
95
106
|
.filter((element) => !element.querySelector('section, header, footer, one-footer'));
|
|
107
|
+
return { areas: named, words, components };
|
|
108
|
+
};
|
|
109
|
+
const tag = (name, ...measures) => {
|
|
110
|
+
const label = document.createElement('span');
|
|
111
|
+
label.className = 'tag';
|
|
112
|
+
label.textContent = name;
|
|
113
|
+
for (const measure of measures) {
|
|
114
|
+
const part = document.createElement('span');
|
|
115
|
+
part.className = 'measure';
|
|
116
|
+
part.textContent = measure;
|
|
117
|
+
label.appendChild(part);
|
|
118
|
+
}
|
|
119
|
+
return label;
|
|
120
|
+
};
|
|
121
|
+
const box = (element, kind, rect) => {
|
|
122
|
+
const panel = document.createElement('div');
|
|
123
|
+
panel.className = `box ${kind}`;
|
|
124
|
+
panel.style.left = `${rect.left}px`;
|
|
125
|
+
panel.style.top = `${rect.top}px`;
|
|
126
|
+
panel.style.width = `${rect.width}px`;
|
|
127
|
+
panel.style.height = `${rect.height}px`;
|
|
128
|
+
if (kind === 'area') {
|
|
129
|
+
const areaName = element.dataset.dsArea || element.getAttribute('aria-label') ||
|
|
130
|
+
(element.localName === 'one-footer' ? 'footer' : element.localName);
|
|
131
|
+
// Reduce dimensions measured to a tenth of a CSS pixel; use a decimal
|
|
132
|
+
// for fluid shapes whose exact fraction would be too long to read.
|
|
133
|
+
const width = Math.max(1, Math.round(rect.width * 10));
|
|
134
|
+
const height = Math.max(1, Math.round(rect.height * 10));
|
|
135
|
+
let divisor = width;
|
|
136
|
+
let remainder = height;
|
|
137
|
+
while (remainder) {
|
|
138
|
+
[divisor, remainder] = [remainder, divisor % remainder];
|
|
139
|
+
}
|
|
140
|
+
const horizontal = width / divisor;
|
|
141
|
+
const vertical = height / divisor;
|
|
142
|
+
panel.appendChild(tag(areaName.replace(/[-_]/g, ' ').replace(/^./, (letter) => letter.toUpperCase()), `${Number(rect.width.toFixed(1))} × ${Number(rect.height.toFixed(1))}`, horizontal <= 100 && vertical <= 100 ? `${horizontal}:${vertical}` : `≈ ${Number((rect.width / rect.height).toFixed(2))}:1`));
|
|
143
|
+
}
|
|
144
|
+
else if (kind === 'component') {
|
|
145
|
+
// A name with no room above the component stands inside it.
|
|
146
|
+
panel.toggleAttribute('data-inside', rect.top < 16);
|
|
147
|
+
panel.appendChild(tag(element.localName));
|
|
148
|
+
}
|
|
149
|
+
return panel;
|
|
96
150
|
};
|
|
97
151
|
const render = () => {
|
|
98
152
|
frame = 0;
|
|
99
153
|
if (!visible)
|
|
100
154
|
return;
|
|
101
|
-
const areas =
|
|
102
|
-
const
|
|
155
|
+
const { areas, words, components } = collect();
|
|
156
|
+
const watched = new Set([...areas, ...components]);
|
|
103
157
|
for (const element of observed) {
|
|
104
|
-
if (!
|
|
158
|
+
if (!watched.has(element)) {
|
|
105
159
|
resize.unobserve(element);
|
|
106
160
|
observed.delete(element);
|
|
107
161
|
}
|
|
108
162
|
}
|
|
109
|
-
const
|
|
110
|
-
areas.forEach((element, index) => {
|
|
163
|
+
for (const element of watched) {
|
|
111
164
|
if (!observed.has(element)) {
|
|
112
165
|
resize.observe(element);
|
|
113
166
|
observed.add(element);
|
|
114
167
|
}
|
|
168
|
+
}
|
|
169
|
+
// Areas first, then words, then components, so component names lie on top.
|
|
170
|
+
const drawn = [];
|
|
171
|
+
const draw = (element, kind) => {
|
|
172
|
+
if (drawn.length >= limit)
|
|
173
|
+
return;
|
|
115
174
|
const rect = element.getBoundingClientRect();
|
|
116
175
|
if (!rect.width || !rect.height || rect.bottom <= 0 || rect.top >= innerHeight || rect.right <= 0 || rect.left >= innerWidth)
|
|
117
176
|
return;
|
|
118
177
|
if (getComputedStyle(element).visibility === 'hidden')
|
|
119
178
|
return;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
panel.style.width = `${rect.width}px`;
|
|
127
|
-
panel.style.height = `${rect.height}px`;
|
|
128
|
-
panel.style.setProperty('--pastel', colors[index % colors.length] ?? null);
|
|
129
|
-
const label = document.createElement('span');
|
|
130
|
-
label.className = 'name';
|
|
131
|
-
const areaName = element.dataset.dsArea || element.getAttribute('aria-label') ||
|
|
132
|
-
(element.localName === 'one-footer' ? 'footer' : element.localName);
|
|
133
|
-
label.textContent = areaName.replace(/[-_]/g, ' ').replace(/^./, (letter) => letter.toUpperCase());
|
|
134
|
-
const dimensions = document.createElement('span');
|
|
135
|
-
dimensions.className = 'dimensions';
|
|
136
|
-
dimensions.textContent = `${Number(rect.width.toFixed(1))} × ${Number(rect.height.toFixed(1))} px`;
|
|
137
|
-
label.appendChild(dimensions);
|
|
138
|
-
const ratio = document.createElement('span');
|
|
139
|
-
ratio.className = 'dimensions';
|
|
140
|
-
// Reduce dimensions measured to a tenth of a CSS pixel; use a decimal
|
|
141
|
-
// for fluid shapes whose exact fraction would be too long to read.
|
|
142
|
-
const width = Math.max(1, Math.round(rect.width * 10));
|
|
143
|
-
const height = Math.max(1, Math.round(rect.height * 10));
|
|
144
|
-
let divisor = width;
|
|
145
|
-
let remainder = height;
|
|
146
|
-
while (remainder) {
|
|
147
|
-
[divisor, remainder] = [remainder, divisor % remainder];
|
|
148
|
-
}
|
|
149
|
-
const horizontal = width / divisor;
|
|
150
|
-
const vertical = height / divisor;
|
|
151
|
-
ratio.textContent = horizontal <= 100 && vertical <= 100
|
|
152
|
-
? `${horizontal}:${vertical}`
|
|
153
|
-
: `≈ ${Number((rect.width / rect.height).toFixed(2))}:1`;
|
|
154
|
-
label.appendChild(ratio);
|
|
155
|
-
panel.appendChild(label);
|
|
156
|
-
fragments.appendChild(panel);
|
|
157
|
-
});
|
|
158
|
-
layer.replaceChildren(fragments);
|
|
179
|
+
drawn.push(box(element, kind, rect));
|
|
180
|
+
};
|
|
181
|
+
areas.forEach((element) => draw(element, 'area'));
|
|
182
|
+
words.forEach(([element, kind]) => draw(element, kind));
|
|
183
|
+
components.forEach((element) => draw(element, 'component'));
|
|
184
|
+
layer.replaceChildren(...drawn);
|
|
159
185
|
};
|
|
160
186
|
const schedule = () => { if (visible && !frame)
|
|
161
187
|
frame = requestAnimationFrame(render); };
|
|
@@ -25,6 +25,10 @@ export interface PreferenceOptions {
|
|
|
25
25
|
light: string;
|
|
26
26
|
dark: string;
|
|
27
27
|
} | false;
|
|
28
|
+
/** Where the shape is stored: `"ds-one:shape"` by default. */
|
|
29
|
+
shapeStorageKey?: string;
|
|
30
|
+
/** The shape for a visitor who has chosen none; without it the components keep their own corners. */
|
|
31
|
+
shapeDefault?: "square" | "rounded" | "circular";
|
|
28
32
|
}
|
|
29
33
|
declare global {
|
|
30
34
|
interface Window {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preference-options.d.ts","sourceRoot":"","sources":["../../DS1/0-face/preference-options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC3C;;;;OAIG;IACH,UAAU,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"preference-options.d.ts","sourceRoot":"","sources":["../../DS1/0-face/preference-options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC3C;;;;OAIG;IACH,UAAU,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,KAAK,CAAC;IACrD,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qGAAqG;IACrG,YAAY,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QAAG,kBAAkB,CAAC,EAAE,iBAAiB,CAAC;KAAE;CAC7D"}
|
package/dist/0-face/scaling.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* mobile browser, or a touch screen whose shorter side is at most 820px) is
|
|
6
6
|
* drawn as if the screen were 280 units wide: the scale is the page's width
|
|
7
7
|
* over 280, never under 0.75 or over 2, so a 375px phone draws everything a
|
|
8
|
-
* third larger.
|
|
8
|
+
* third larger. The page's width is never taken as more than the screen's, so
|
|
9
|
+
* a page that a phone has widened and zoomed out never scales itself larger.
|
|
9
10
|
*
|
|
10
11
|
* `startScaling()` puts the scale on the page and keeps it there through
|
|
11
12
|
* resizes and turns; `applyScaling()` does it once. Both set `--sf` and, on a
|
|
@@ -71,6 +72,12 @@ export declare function detectMobileDevice(): boolean;
|
|
|
71
72
|
* the factor (the first surface's, or 1 when there is none).
|
|
72
73
|
*/
|
|
73
74
|
export declare function applyScaling(options?: ScalingOptions): number;
|
|
75
|
+
/**
|
|
76
|
+
* The screen's own width as it is held, in CSS pixels: the widest a page on it
|
|
77
|
+
* is laid out at, or 0 when the browser does not say. iOS gives the screen's
|
|
78
|
+
* upright width whichever way it is turned, so the side is taken by the turn.
|
|
79
|
+
*/
|
|
80
|
+
export declare function screenWidth(): number;
|
|
74
81
|
/**
|
|
75
82
|
* Puts the scale on the page now and again on every resize and turn; a
|
|
76
83
|
* surface is followed as its own size changes. Returns a function that stops
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaling.d.ts","sourceRoot":"","sources":["../../DS1/0-face/scaling.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"scaling.d.ts","sourceRoot":"","sources":["../../DS1/0-face/scaling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AAErD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED,MAAM,WAAW,cAAe,SAAQ,OAAO,CAAC,aAAa,CAAC;IAC5D;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;CACjC;AAMD,eAAO,MAAM,oBAAoB,EAAE,aAKlC,CAAC;AAOF,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,oFAAoF;AACpF,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,SAAI,GAAG,MAAM,CAGpE;AAED,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,GAAE,aAAoC,EAAE,UAAU,SAAI,GAAG,MAAM,CAMlI;AAMD;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAO5C;AAsBD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,cAAmB,GAAG,MAAM,CAQjE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAMpC;AAgBD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,cAAmB,GAAG,MAAM,IAAI,CAkBrE"}
|
package/dist/0-face/scaling.js
CHANGED
|
@@ -81,10 +81,27 @@ export function applyScaling(options = {}) {
|
|
|
81
81
|
}
|
|
82
82
|
return applyPage(root ?? document.documentElement, config);
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* The screen's own width as it is held, in CSS pixels: the widest a page on it
|
|
86
|
+
* is laid out at, or 0 when the browser does not say. iOS gives the screen's
|
|
87
|
+
* upright width whichever way it is turned, so the side is taken by the turn.
|
|
88
|
+
*/
|
|
89
|
+
export function screenWidth() {
|
|
90
|
+
const { width = 0, height = 0 } = window.screen ?? {};
|
|
91
|
+
if (!width || !height)
|
|
92
|
+
return 0;
|
|
93
|
+
const turn = window.screen.orientation?.type;
|
|
94
|
+
const landscape = turn ? turn.startsWith("landscape") : window.matchMedia?.("(orientation: landscape)").matches ?? width > height;
|
|
95
|
+
return landscape ? Math.max(width, height) : Math.min(width, height);
|
|
96
|
+
}
|
|
84
97
|
function applyPage(root, config) {
|
|
85
98
|
const mobile = detectMobileDevice();
|
|
86
|
-
// The page's width without its scroll bar
|
|
87
|
-
|
|
99
|
+
// The page's width without its scroll bar, never more than the screen's: when something reaches
|
|
100
|
+
// past the edge, a phone's browser widens the page and zooms out, and a scale read from that
|
|
101
|
+
// width would draw everything larger, which keeps the page too wide and zoomed out.
|
|
102
|
+
const page = document.documentElement.clientWidth || window.innerWidth || 0;
|
|
103
|
+
const held = mobile ? screenWidth() : 0;
|
|
104
|
+
const width = held ? Math.min(page, held) : page;
|
|
88
105
|
const factor = mobile ? calculateScalingFactor(width, { ...defaultScalingConfig, ...config }, window.devicePixelRatio || 1) : 1;
|
|
89
106
|
root.style.setProperty("--sf", String(factor));
|
|
90
107
|
root.toggleAttribute("data-mobile", mobile);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Square, rounded or circular: the corners every component draws, chosen once
|
|
3
|
+
* and remembered (Ezo's Shape setting, for every product).
|
|
4
|
+
*
|
|
5
|
+
* The runtime is the second part of `theme-bootstrap.js`, which a page inlines
|
|
6
|
+
* in its <head> so the first paint already has the shape; imported here, it
|
|
7
|
+
* installs itself when the page did not. It marks the root with
|
|
8
|
+
* `data-ds-shape`, which `1-root/component-appearance.css` reads: square
|
|
9
|
+
* corners, rounded ones (squircles where the browser draws them) or pills. A
|
|
10
|
+
* visitor who has chosen nothing sees `shapeDefault` from
|
|
11
|
+
* `window.DS_ONE_PREFERENCES`, or the components' own corners. Offer the
|
|
12
|
+
* choice with `<ds-cycle type="shape">`.
|
|
13
|
+
*/
|
|
14
|
+
import "./theme-bootstrap.js";
|
|
15
|
+
export type Shape = "square" | "rounded" | "circular";
|
|
16
|
+
export declare const SHAPES: readonly Shape[];
|
|
17
|
+
/** `window.DS_ONE_SHAPE`, installed by `theme-bootstrap.js`. */
|
|
18
|
+
export interface ShapeRuntime {
|
|
19
|
+
/** The shape in effect, or null when none is chosen. */
|
|
20
|
+
shape(): Shape | null;
|
|
21
|
+
/** Choose and remember a shape, and put it on the page. */
|
|
22
|
+
set(shape: Shape): void;
|
|
23
|
+
/** Read the stored choice and the options again, and put them on the page. */
|
|
24
|
+
apply(): Shape | null;
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
interface Window {
|
|
28
|
+
DS_ONE_SHAPE?: ShapeRuntime;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** The shape in effect: the stored choice, else `shapeDefault`, else rounded (the components' own corners). */
|
|
32
|
+
export declare function getShape(): Shape;
|
|
33
|
+
/** Choose and remember a shape. */
|
|
34
|
+
export declare function setShape(shape: Shape): void;
|
|
35
|
+
//# sourceMappingURL=shape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../../DS1/0-face/shape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,sBAAsB,CAAC;AAE9B,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AACtD,eAAO,MAAM,MAAM,EAAE,SAAS,KAAK,EAAsC,CAAC;AAE1E,gEAAgE;AAChE,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,KAAK,IAAI,KAAK,GAAG,IAAI,CAAC;IACtB,2DAA2D;IAC3D,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACxB,8EAA8E;IAC9E,KAAK,IAAI,KAAK,GAAG,IAAI,CAAC;CACvB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,YAAY,CAAC,EAAE,YAAY,CAAC;KAC7B;CACF;AAED,+GAA+G;AAC/G,wBAAgB,QAAQ,IAAI,KAAK,CAEhC;AAED,mCAAmC;AACnC,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAE3C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Square, rounded or circular: the corners every component draws, chosen once
|
|
3
|
+
* and remembered (Ezo's Shape setting, for every product).
|
|
4
|
+
*
|
|
5
|
+
* The runtime is the second part of `theme-bootstrap.js`, which a page inlines
|
|
6
|
+
* in its <head> so the first paint already has the shape; imported here, it
|
|
7
|
+
* installs itself when the page did not. It marks the root with
|
|
8
|
+
* `data-ds-shape`, which `1-root/component-appearance.css` reads: square
|
|
9
|
+
* corners, rounded ones (squircles where the browser draws them) or pills. A
|
|
10
|
+
* visitor who has chosen nothing sees `shapeDefault` from
|
|
11
|
+
* `window.DS_ONE_PREFERENCES`, or the components' own corners. Offer the
|
|
12
|
+
* choice with `<ds-cycle type="shape">`.
|
|
13
|
+
*/
|
|
14
|
+
import "./theme-bootstrap.js";
|
|
15
|
+
export const SHAPES = ["square", "rounded", "circular"];
|
|
16
|
+
/** The shape in effect: the stored choice, else `shapeDefault`, else rounded (the components' own corners). */
|
|
17
|
+
export function getShape() {
|
|
18
|
+
return window.DS_ONE_SHAPE?.shape() ?? "rounded";
|
|
19
|
+
}
|
|
20
|
+
/** Choose and remember a shape. */
|
|
21
|
+
export function setShape(shape) {
|
|
22
|
+
window.DS_ONE_SHAPE?.set(shape);
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type RGBA = [number, number, number, number];
|
|
2
|
+
export declare const TEXT_CONTRAST_MINIMUM = 4.5;
|
|
3
|
+
export declare const contrastRatio: (a: RGBA, b: RGBA) => number;
|
|
4
|
+
export declare function composite(top: RGBA, bottom: RGBA): RGBA;
|
|
5
|
+
/** The painted parent, including the slot's styles and the shadow host's surface. */
|
|
6
|
+
export declare function paintedParent(e: Element): Element | null;
|
|
7
|
+
/** Computed RGB stays full precision; modern colour spaces use the browser's sRGB canvas conversion. */
|
|
8
|
+
export declare function colorReader(document: Document): (value: string) => RGBA | null;
|
|
9
|
+
export type TextContrastResult = {
|
|
10
|
+
element: Element;
|
|
11
|
+
text: string;
|
|
12
|
+
ratio?: number;
|
|
13
|
+
reason?: string;
|
|
14
|
+
foreground?: string;
|
|
15
|
+
background?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function measureTextContrast(root: ParentNode): TextContrastResult[];
|
|
18
|
+
export declare function inspectTextContrast(root: ParentNode): {
|
|
19
|
+
element: Element;
|
|
20
|
+
message: string;
|
|
21
|
+
}[];
|
|
22
|
+
//# sourceMappingURL=text-contrast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-contrast.d.ts","sourceRoot":"","sources":["../../DS1/0-face/text-contrast.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpD,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,aAAa,GAAI,GAAG,IAAI,EAAE,GAAG,IAAI,WAK7C,CAAC;AACF,wBAAgB,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,CAGvD;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAExD;AAED,wGAAwG;AACxG,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,IAGpC,OAAO,MAAM,KAAG,IAAI,GAAG,IAAI,CAoBpC;AAoED,MAAM,MAAM,kBAAkB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAG/I,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,kBAAkB,EAAE,CAsC1E;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU;;;IAOnD"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
const clear = [0, 0, 0, 0];
|
|
2
|
+
export const TEXT_CONTRAST_MINIMUM = 4.5;
|
|
3
|
+
export const contrastRatio = (a, b) => {
|
|
4
|
+
const luminance = (c) => c.slice(0, 3).map(v => v <= .04045 ? v / 12.92 : ((v + .055) / 1.055) ** 2.4)
|
|
5
|
+
.reduce((sum, v, i) => sum + v * [0.2126, 0.7152, 0.0722][i], 0);
|
|
6
|
+
const [high, low] = [luminance(a), luminance(b)].sort((x, y) => y - x);
|
|
7
|
+
return (high + .05) / (low + .05);
|
|
8
|
+
};
|
|
9
|
+
export function composite(top, bottom) {
|
|
10
|
+
const alpha = top[3] + bottom[3] * (1 - top[3]);
|
|
11
|
+
return alpha ? [...[0, 1, 2].map(i => (top[i] * top[3] + bottom[i] * bottom[3] * (1 - top[3])) / alpha), alpha] : [...clear];
|
|
12
|
+
}
|
|
13
|
+
const styleOf = (e, pseudo) => e.ownerDocument.defaultView.getComputedStyle(e, pseudo);
|
|
14
|
+
/** The painted parent, including the slot's styles and the shadow host's surface. */
|
|
15
|
+
export function paintedParent(e) {
|
|
16
|
+
return e.assignedSlot ?? e.parentElement ?? e.getRootNode().host ?? null;
|
|
17
|
+
}
|
|
18
|
+
/** Computed RGB stays full precision; modern colour spaces use the browser's sRGB canvas conversion. */
|
|
19
|
+
export function colorReader(document) {
|
|
20
|
+
const cache = new Map();
|
|
21
|
+
let context;
|
|
22
|
+
return (value) => {
|
|
23
|
+
if (cache.has(value))
|
|
24
|
+
return cache.get(value);
|
|
25
|
+
let color = null;
|
|
26
|
+
if (value === 'transparent')
|
|
27
|
+
color = [...clear];
|
|
28
|
+
const rgb = /^rgba?\(([^)]+)\)$/.exec(value);
|
|
29
|
+
if (rgb) {
|
|
30
|
+
const parts = rgb[1].split(/[\s,/]+/).filter(Boolean);
|
|
31
|
+
if (parts.length >= 3)
|
|
32
|
+
color = [...parts.slice(0, 3).map(v => parseFloat(v) / (v.endsWith('%') ? 100 : 255)), parts[3] ? parseFloat(parts[3]) / (parts[3].endsWith('%') ? 100 : 1) : 1];
|
|
33
|
+
}
|
|
34
|
+
else if (value && document.defaultView?.CSS.supports('color', value)) {
|
|
35
|
+
context ?? (context = document.createElement('canvas').getContext('2d', { willReadFrequently: true }));
|
|
36
|
+
if (context) {
|
|
37
|
+
context.clearRect(0, 0, 1, 1);
|
|
38
|
+
context.fillStyle = value;
|
|
39
|
+
context.fillRect(0, 0, 1, 1);
|
|
40
|
+
color = Array.from(context.getImageData(0, 0, 1, 1).data, v => v / 255);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
cache.set(value, color);
|
|
44
|
+
return color;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function visible(e) {
|
|
48
|
+
if (!e.getClientRects().length && styleOf(e).display !== 'contents')
|
|
49
|
+
return false;
|
|
50
|
+
if (styleOf(e).visibility !== 'visible')
|
|
51
|
+
return false;
|
|
52
|
+
for (let p = e; p; p = paintedParent(p)) {
|
|
53
|
+
const s = styleOf(p);
|
|
54
|
+
if (s.display === 'none' || s.contentVisibility === 'hidden' || Number(s.opacity) === 0
|
|
55
|
+
|| p.matches(':disabled, [aria-disabled="true"], [data-ds-constraint-panel]'))
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
/** Text nodes are visited once in their composed position; hidden menus and inactive controls do not count. */
|
|
61
|
+
function textSamples(root) {
|
|
62
|
+
const samples = [];
|
|
63
|
+
const seen = new Set();
|
|
64
|
+
function visit(node) {
|
|
65
|
+
if (seen.has(node))
|
|
66
|
+
return;
|
|
67
|
+
seen.add(node);
|
|
68
|
+
if (node.nodeType === 3) {
|
|
69
|
+
const text = node.textContent?.trim();
|
|
70
|
+
const element = node.parentElement;
|
|
71
|
+
const paintElement = node.assignedSlot ?? element;
|
|
72
|
+
if (text && element && paintElement && visible(paintElement)) {
|
|
73
|
+
const range = element.ownerDocument.createRange();
|
|
74
|
+
range.selectNodeContents(node);
|
|
75
|
+
if (Array.from(range.getClientRects()).some(r => r.width > 0 && r.height > 0))
|
|
76
|
+
samples.push({ element, text, paintElement });
|
|
77
|
+
}
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (node.nodeType === 1) {
|
|
81
|
+
const e = node;
|
|
82
|
+
if (e.matches('script, style, template, noscript, option, [data-ds-constraint-panel]'))
|
|
83
|
+
return;
|
|
84
|
+
if (visible(e)) {
|
|
85
|
+
if (e.localName === 'input' || e.localName === 'textarea') {
|
|
86
|
+
const input = e;
|
|
87
|
+
if (!['hidden', 'checkbox', 'radio', 'range', 'color', 'file', 'image'].includes(input.type)) {
|
|
88
|
+
if (input.value)
|
|
89
|
+
samples.push({ element: e, text: input.type === 'password' ? 'Password value' : input.value });
|
|
90
|
+
else if (input.placeholder)
|
|
91
|
+
samples.push({ element: e, text: input.placeholder, pseudo: '::placeholder' });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else if (e.localName === 'select') {
|
|
95
|
+
const text = e.selectedOptions[0]?.textContent?.trim();
|
|
96
|
+
if (text)
|
|
97
|
+
samples.push({ element: e, text });
|
|
98
|
+
}
|
|
99
|
+
for (const pseudo of ['::before', '::after']) {
|
|
100
|
+
const s = styleOf(e, pseudo);
|
|
101
|
+
if (/^["'].*["']$/.test(s.content) && s.content.slice(1, -1).trim() && s.display !== 'none' && s.visibility === 'visible' && Number(s.opacity) !== 0) {
|
|
102
|
+
samples.push({ element: e, text: s.content.slice(1, -1), pseudo });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (e.localName === 'slot') {
|
|
107
|
+
const assigned = e.assignedNodes({ flatten: true });
|
|
108
|
+
(assigned.length ? assigned : Array.from(e.childNodes)).forEach(visit);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (e.shadowRoot) {
|
|
112
|
+
visit(e.shadowRoot);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
// Values/placeholder above represent these controls, not their fallback children.
|
|
116
|
+
if (e.matches('input, textarea, select'))
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
node.childNodes.forEach(visit);
|
|
120
|
+
}
|
|
121
|
+
visit(root);
|
|
122
|
+
return samples;
|
|
123
|
+
}
|
|
124
|
+
const rgbLabel = (c) => `rgb(${c.slice(0, 3).map(v => Math.round(v * 255)).join(', ')})`;
|
|
125
|
+
export function measureTextContrast(root) {
|
|
126
|
+
const document = root.ownerDocument ?? root;
|
|
127
|
+
const read = colorReader(document);
|
|
128
|
+
const styles = new Map();
|
|
129
|
+
const style = (e) => { if (!styles.has(e))
|
|
130
|
+
styles.set(e, styleOf(e)); return styles.get(e); };
|
|
131
|
+
return textSamples(root).map(({ element, text, pseudo, paintElement = element }) => {
|
|
132
|
+
const result = { element, text: text.replace(/\s+/g, ' ').slice(0, 60) };
|
|
133
|
+
const inkStyle = pseudo ? styleOf(element, pseudo) : style(paintElement);
|
|
134
|
+
let foreground = read(inkStyle.getPropertyValue('-webkit-text-fill-color') || inkStyle.color);
|
|
135
|
+
let background = [...clear];
|
|
136
|
+
if (!foreground)
|
|
137
|
+
return { ...result, reason: 'The rendered text colour could not be resolved.' };
|
|
138
|
+
const chain = [];
|
|
139
|
+
if (pseudo)
|
|
140
|
+
chain.push(inkStyle);
|
|
141
|
+
for (let p = paintElement; p; p = paintedParent(p))
|
|
142
|
+
chain.push(style(p));
|
|
143
|
+
for (const s of chain) {
|
|
144
|
+
if (s.mixBlendMode && s.mixBlendMode !== 'normal' || s.filter && s.filter !== 'none' || s.backdropFilter && s.backdropFilter !== 'none') {
|
|
145
|
+
return { ...result, reason: 'A blend or filter needs a visual contrast review.' };
|
|
146
|
+
}
|
|
147
|
+
if (background[3] < 1 && s.backgroundImage && s.backgroundImage !== 'none') {
|
|
148
|
+
return { ...result, reason: 'Text over an image or gradient needs a visual contrast review.' };
|
|
149
|
+
}
|
|
150
|
+
const fill = read(s.backgroundColor);
|
|
151
|
+
if (!fill)
|
|
152
|
+
return { ...result, reason: 'The rendered background colour could not be resolved.' };
|
|
153
|
+
foreground = composite(foreground, fill);
|
|
154
|
+
background = composite(background, fill);
|
|
155
|
+
const opacity = Number(s.opacity);
|
|
156
|
+
foreground[3] *= opacity;
|
|
157
|
+
background[3] *= opacity;
|
|
158
|
+
}
|
|
159
|
+
// With no declared page background, compare both possible user-agent canvases.
|
|
160
|
+
// Usually the opaque html/body surface makes these identical.
|
|
161
|
+
const candidates = [[1, 1, 1, 1], [0, 0, 0, 1]];
|
|
162
|
+
const pairs = candidates.map(canvas => ({ foreground: composite(foreground, canvas), background: composite(background, canvas) }));
|
|
163
|
+
const values = pairs.map(pair => ({ ...pair, ratio: contrastRatio(pair.foreground, pair.background) })).sort((a, b) => a.ratio - b.ratio);
|
|
164
|
+
const worst = values[0];
|
|
165
|
+
if (background[3] < 1 && worst.ratio < TEXT_CONTRAST_MINIMUM)
|
|
166
|
+
return { ...result, reason: 'Declare an opaque page background so text contrast can be verified.' };
|
|
167
|
+
return { ...result, ratio: worst.ratio, foreground: rgbLabel(worst.foreground), background: rgbLabel(worst.background) };
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
export function inspectTextContrast(root) {
|
|
171
|
+
return measureTextContrast(root).flatMap(result => {
|
|
172
|
+
const label = `“${result.text}”`;
|
|
173
|
+
// What cannot be measured is a review for a person, not a broken rule; a colour that could not be read is.
|
|
174
|
+
if (result.reason)
|
|
175
|
+
return [{ element: result.element, message: `${label}: ${result.reason}`, review: /visual contrast review/.test(result.reason) }];
|
|
176
|
+
return result.ratio < TEXT_CONTRAST_MINIMUM ? [{ element: result.element, message: `${label} has ${result.ratio.toFixed(2)}:1 text contrast (${result.foreground} on ${result.background}); at least ${TEXT_CONTRAST_MINIMUM}:1 is required.` }] : [];
|
|
177
|
+
});
|
|
178
|
+
}
|