@threadlabs/looma 0.12.2 → 0.12.4

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.
@@ -5,7 +5,9 @@ export const icons = {
5
5
  "align-right": [["path",{"d":"M21 5H3"}],["path",{"d":"M21 12H9"}],["path",{"d":"M21 19H7"}]],
6
6
  "arrow-left": [["path",{"d":"m12 19-7-7 7-7"}],["path",{"d":"M19 12H5"}]],
7
7
  "bold": [["path",{"d":"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8"}]],
8
+ "book-user": [["path",{"d":"M15 13a3 3 0 1 0-6 0"}],["path",{"d":"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20"}],["circle",{"cx":"12","cy":"8","r":"2"}]],
8
9
  "braces": [["path",{"d":"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"}],["path",{"d":"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"}]],
10
+ "calculator": [["rect",{"width":"16","height":"20","x":"4","y":"2","rx":"2"}],["line",{"x1":"8","x2":"16","y1":"6","y2":"6"}],["line",{"x1":"16","x2":"16","y1":"14","y2":"18"}],["path",{"d":"M16 10h.01"}],["path",{"d":"M12 10h.01"}],["path",{"d":"M8 10h.01"}],["path",{"d":"M12 14h.01"}],["path",{"d":"M8 14h.01"}],["path",{"d":"M12 18h.01"}],["path",{"d":"M8 18h.01"}]],
9
11
  "chevron-down": [["path",{"d":"m6 9 6 6 6-6"}]],
10
12
  "chevron-left": [["path",{"d":"m15 18-6-6 6-6"}]],
11
13
  "chevron-right": [["path",{"d":"m9 18 6-6-6-6"}]],
@@ -13,6 +15,7 @@ export const icons = {
13
15
  "circle-x": [["circle",{"cx":"12","cy":"12","r":"10"}],["path",{"d":"m15 9-6 6"}],["path",{"d":"m9 9 6 6"}]],
14
16
  "code-xml": [["path",{"d":"m18 16 4-4-4-4"}],["path",{"d":"m6 8-4 4 4 4"}],["path",{"d":"m14.5 4-5 16"}]],
15
17
  "columns": [["rect",{"width":"18","height":"18","x":"3","y":"3","rx":"2"}],["path",{"d":"M9 3v18"}],["path",{"d":"M15 3v18"}]],
18
+ "credit-card": [["rect",{"width":"20","height":"14","x":"2","y":"5","rx":"2"}],["line",{"x1":"2","x2":"22","y1":"10","y2":"10"}]],
16
19
  "ellipsis": [["circle",{"cx":"12","cy":"12","r":"1"}],["circle",{"cx":"19","cy":"12","r":"1"}],["circle",{"cx":"5","cy":"12","r":"1"}]],
17
20
  "eraser": [["path",{"d":"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21"}],["path",{"d":"m5.082 11.09 8.828 8.828"}]],
18
21
  "file-text": [["path",{"d":"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{"d":"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{"d":"M10 9H8"}],["path",{"d":"M16 13H8"}],["path",{"d":"M16 17H8"}]],
@@ -26,6 +29,7 @@ export const icons = {
26
29
  "image": [["rect",{"width":"18","height":"18","x":"3","y":"3","rx":"2","ry":"2"}],["circle",{"cx":"9","cy":"9","r":"2"}],["path",{"d":"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}]],
27
30
  "info": [["circle",{"cx":"12","cy":"12","r":"10"}],["path",{"d":"M12 16v-4"}],["path",{"d":"M12 8h.01"}]],
28
31
  "italic": [["line",{"x1":"19","x2":"10","y1":"4","y2":"4"}],["line",{"x1":"14","x2":"5","y1":"20","y2":"20"}],["line",{"x1":"15","x2":"9","y1":"4","y2":"20"}]],
32
+ "layout-dashboard": [["rect",{"width":"7","height":"9","x":"3","y":"3","rx":"1"}],["rect",{"width":"7","height":"5","x":"14","y":"3","rx":"1"}],["rect",{"width":"7","height":"9","x":"14","y":"12","rx":"1"}],["rect",{"width":"7","height":"5","x":"3","y":"16","rx":"1"}]],
29
33
  "list": [["path",{"d":"M3 5h.01"}],["path",{"d":"M3 12h.01"}],["path",{"d":"M3 19h.01"}],["path",{"d":"M8 5h13"}],["path",{"d":"M8 12h13"}],["path",{"d":"M8 19h13"}]],
30
34
  "list-ordered": [["path",{"d":"M11 5h10"}],["path",{"d":"M11 12h10"}],["path",{"d":"M11 19h10"}],["path",{"d":"M4 4h1v5"}],["path",{"d":"M4 9h2"}],["path",{"d":"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02"}]],
31
35
  "list-todo": [["path",{"d":"M13 5h8"}],["path",{"d":"M13 12h8"}],["path",{"d":"M13 19h8"}],["path",{"d":"m3 17 2 2 4-4"}],["rect",{"x":"3","y":"4","width":"6","height":"6","rx":"1"}]],
@@ -41,13 +45,17 @@ export const icons = {
41
45
  "pilcrow": [["path",{"d":"M13 4v16"}],["path",{"d":"M17 4v16"}],["path",{"d":"M19 4H9.5a4.5 4.5 0 0 0 0 9H13"}]],
42
46
  "plus": [["path",{"d":"M5 12h14"}],["path",{"d":"M12 5v14"}]],
43
47
  "quote": [["path",{"d":"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"}],["path",{"d":"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"}]],
48
+ "receipt": [["path",{"d":"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z"}],["path",{"d":"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8"}],["path",{"d":"M12 17.5v-11"}]],
44
49
  "redo": [["path",{"d":"m15 14 5-5-5-5"}],["path",{"d":"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13"}]],
45
50
  "rows": [["rect",{"width":"18","height":"18","x":"3","y":"3","rx":"2"}],["path",{"d":"M21 9H3"}],["path",{"d":"M21 15H3"}]],
51
+ "settings": [["path",{"d":"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}],["circle",{"cx":"12","cy":"12","r":"3"}]],
46
52
  "split": [["path",{"d":"M16 3h5v5"}],["path",{"d":"M8 3H3v5"}],["path",{"d":"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3"}],["path",{"d":"m15 9 6-6"}]],
47
53
  "strikethrough": [["path",{"d":"M16 4H9a3 3 0 0 0-2.83 4"}],["path",{"d":"M14 12a4 4 0 0 1 0 8H6"}],["line",{"x1":"4","x2":"20","y1":"12","y2":"12"}]],
48
54
  "table": [["path",{"d":"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18"}]],
49
55
  "trash": [["path",{"d":"M10 11v6"}],["path",{"d":"M14 11v6"}],["path",{"d":"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{"d":"M3 6h18"}],["path",{"d":"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]],
50
56
  "triangle-alert": [["path",{"d":"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}],["path",{"d":"M12 9v4"}],["path",{"d":"M12 17h.01"}]],
57
+ "truck": [["path",{"d":"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2"}],["path",{"d":"M15 18H9"}],["path",{"d":"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14"}],["circle",{"cx":"17","cy":"18","r":"2"}],["circle",{"cx":"7","cy":"18","r":"2"}]],
51
58
  "underline": [["path",{"d":"M6 4v6a6 6 0 0 0 12 0V4"}],["line",{"x1":"4","x2":"20","y1":"20","y2":"20"}]],
52
59
  "undo": [["path",{"d":"M9 14 4 9l5-5"}],["path",{"d":"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11"}]],
60
+ "users": [["path",{"d":"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["path",{"d":"M16 3.128a4 4 0 0 1 0 7.744"}],["path",{"d":"M22 21v-2a4 4 0 0 0-3-3.87"}],["circle",{"cx":"9","cy":"7","r":"4"}]],
53
61
  };
@@ -14,7 +14,8 @@
14
14
  :host {
15
15
  --_badge-surface: var(--ui-surface-subtle);
16
16
  --_badge-text: var(--ui-text-secondary);
17
- --_badge-border: color-mix(in srgb, var(--ui-text-secondary) 30%, transparent);
17
+ /* Every tone's edge is its fill, so it is unseen until forced colors draw it. */
18
+ --_badge-border: var(--ui-surface-subtle);
18
19
 
19
20
  display: inline-flex;
20
21
  align-items: center;
@@ -32,12 +33,12 @@
32
33
  white-space: nowrap;
33
34
  }
34
35
 
35
- /* Centre the glyphs, not the line box: a label without descenders otherwise reads high. */
36
36
  /* Centre the glyphs, not the line box: a label without descenders otherwise reads high.
37
- * Trimming applies to block containers, so the box is a block with centred content. */
37
+ * Trimming applies to block containers; an inline-block is one and, like the inline-flex it
38
+ * replaces, still sizes to its label rather than filling its container. */
38
39
  @supports (text-box-trim: trim-both) {
39
40
  :host {
40
- display: block;
41
+ display: inline-block;
41
42
  min-block-size: var(--ui-badge-min-block-size, 1.5rem);
42
43
  text-align: center;
43
44
  align-content: center;
@@ -5,7 +5,7 @@
5
5
  assistive technology, so name the control it sits in.</prop>
6
6
  <state
7
7
  name="shapes"
8
- type="list(object({ tag: path | circle | rect, d?: string, cx?: string, cy?: string, r?: string, x?: string, y?: string, width?: string, height?: string, rx?: string }))"
8
+ type="list(object({ tag: path | circle | rect | line, d?: string, cx?: string, cy?: string, r?: string, x?: string, y?: string, width?: string, height?: string, rx?: string, x1?: string, x2?: string, y1?: string, y2?: string }))"
9
9
  :value="[]"
10
10
  ></state>
11
11
  </defs>
@@ -15,6 +15,7 @@
15
15
  <path $if="shape.tag = 'path'" :d="shape.d"></path>
16
16
  <circle $if="shape.tag = 'circle'" :cx="shape.cx" :cy="shape.cy" :r="shape.r"></circle>
17
17
  <rect $if="shape.tag = 'rect'" :x="shape.x" :y="shape.y" :width="shape.width" :height="shape.height" :rx="shape.rx"></rect>
18
+ <line $if="shape.tag = 'line'" :x1="shape.x1" :x2="shape.x2" :y1="shape.y1" :y2="shape.y2"></line>
18
19
  </g>
19
20
  </svg>
20
21
  </span>
@@ -0,0 +1,151 @@
1
+ <template component="ui-nav-item">
2
+ <defs>
3
+ <prop name="current" type="boolean | page | step | location" default="false"
4
+ >Marks the item as where you are: it takes the selected surface, a stronger label, and a bar on its start edge, and states aria-current, which assistive
5
+ technology announces. true means the current page (aria-current="page"); step marks the current step of a process, and location the current place in a
6
+ set, such as a section of a record. Set it on one item at a time.</prop>
7
+ <prop name="href" type="string"
8
+ >The link's destination. Pair it with as="a" so the item renders as a real link: a router, a modified click, and "open in new tab" all work. Without it the
9
+ item is a button, for switching views inside the app.</prop>
10
+ <prop name="target" type="string">Where a link opens, as on a native link. Only meaningful with as="a".</prop>
11
+ <prop name="rel" type="string">The link's relationship to its destination, as on a native link. Only meaningful with as="a".</prop>
12
+ <!-- One root, a button or a link (as="a"), as Button does. A button never submits a form; a link
13
+ carries no type. The language has no conditional expression, so a table keyed by a value's
14
+ text picks each attribute, and null leaves it off. -->
15
+ </defs>
16
+ <button
17
+ as="button|a"
18
+ :type="{ true: 'button', false: null }[format('%s', not href)]"
19
+ :href="href"
20
+ :target="target"
21
+ :rel="rel"
22
+ :aria-current="{ true: 'page', false: null, page: 'page', step: 'step', location: 'location' }[format('%s', current)]"
23
+ >
24
+ <span class="indicator" aria-hidden="true"></span>
25
+ <span class="leading"><slot name="leading"></slot></span>
26
+ <span class="content">
27
+ <span class="label"><slot></slot></span>
28
+ <span class="description"><slot name="description"></slot></span>
29
+ </span>
30
+ </button>
31
+ <style>
32
+ /* One destination in a side or rail navigation: an icon to find it by (leading), its name (the
33
+ default slot), and an optional line under it (description), such as the record a section
34
+ belongs to. Label and description are one line each and end in an ellipsis, so every item in a
35
+ navigation has the same height and the rail never grows sideways. */
36
+ :host {
37
+ --_indicator-width: var(--ui-nav-item-indicator-width, 3px);
38
+ --_indicator-color: var(--ui-nav-item-indicator-color, var(--ui-accent));
39
+ position: relative;
40
+ box-sizing: border-box;
41
+ display: flex;
42
+ align-items: center;
43
+ gap: var(--ui-space-3);
44
+ inline-size: 100%;
45
+ min-inline-size: 0;
46
+ min-block-size: var(--ui-control-size, 2.5rem);
47
+ margin: 0;
48
+ padding-block: var(--ui-space-2);
49
+ padding-inline: var(--ui-space-3);
50
+ border: 0;
51
+ border-radius: var(--ui-radius-md);
52
+ background: transparent;
53
+ color: var(--ui-text-secondary);
54
+ font: inherit;
55
+ font-weight: var(--ui-font-medium);
56
+ text-align: start;
57
+ text-decoration: none;
58
+ cursor: pointer;
59
+ appearance: none;
60
+ transition: background-color var(--ui-motion-fast) var(--ui-motion-ease), color var(--ui-motion-fast) var(--ui-motion-ease);
61
+ }
62
+
63
+ :host:hover:not([aria-current]) {
64
+ background: var(--ui-surface-hover);
65
+ color: var(--ui-text-primary);
66
+ }
67
+
68
+ /* The ring is an outline, drawn inside the item: forced colors keep an outline where they drop a
69
+ box shadow, and a scrolling rail cannot clip a ring that stays within the item. */
70
+ :host:focus-visible {
71
+ outline: 2px solid var(--ui-focus-ring);
72
+ outline-offset: -2px;
73
+ }
74
+
75
+ :host[aria-current] {
76
+ background: var(--ui-nav-item-current-surface, var(--ui-accent-soft));
77
+ color: var(--ui-accent-subtle-text, var(--ui-text-primary));
78
+ font-weight: var(--ui-font-semibold);
79
+ }
80
+
81
+ /* The bar on the start edge is a border, not a fill: forced colors replace backgrounds but keep a
82
+ border, so the current item stays marked in high contrast. Logical edges mirror it in a
83
+ right-to-left page. */
84
+ .indicator {
85
+ position: absolute;
86
+ inset-block: var(--ui-space-2);
87
+ inset-inline-start: 0;
88
+ display: none;
89
+ border-inline-start: var(--_indicator-width) solid var(--_indicator-color);
90
+ border-radius: var(--ui-radius-round);
91
+ }
92
+
93
+ :host[aria-current] .indicator {
94
+ display: block;
95
+ }
96
+
97
+ @media (forced-colors: active) {
98
+ .indicator {
99
+ border-inline-start-color: Highlight;
100
+ }
101
+ }
102
+
103
+ .leading {
104
+ display: inline-flex;
105
+ flex: none;
106
+ align-items: center;
107
+ color: inherit;
108
+ font-size: var(--ui-font-size-lg);
109
+ }
110
+
111
+ .content {
112
+ display: flex;
113
+ flex: 1;
114
+ flex-direction: column;
115
+ gap: var(--ui-space-0-5, 2px);
116
+ min-inline-size: 0;
117
+ }
118
+
119
+ .label,
120
+ .description {
121
+ display: block;
122
+ min-inline-size: 0;
123
+ overflow: hidden;
124
+ text-overflow: ellipsis;
125
+ white-space: nowrap;
126
+ }
127
+
128
+ .label {
129
+ font-size: var(--ui-font-size-md);
130
+ line-height: var(--ui-line-height-tight);
131
+ }
132
+
133
+ .description {
134
+ color: var(--ui-text-muted);
135
+ font-size: var(--ui-font-size-sm);
136
+ font-weight: var(--ui-font-normal);
137
+ line-height: var(--ui-line-height-tight);
138
+ }
139
+
140
+ /* An unused region takes no space. */
141
+ .leading:empty,
142
+ .description:empty {
143
+ display: none;
144
+ }
145
+
146
+ /* A component that sets its display still honours the hidden attribute on its root. */
147
+ :host[hidden] {
148
+ display: none;
149
+ }
150
+ </style>
151
+ </template>