@threadlabs/looma 0.23.6 → 0.23.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/components/ui-badge/ui-badge.html +34 -3
- package/components/ui-disclosure/ui-disclosure.html +71 -19
- package/components/ui-disclosure/ui-disclosure.js +50 -4
- package/components/ui-nav-item/ui-nav-item.html +16 -11
- package/components/ui-sidebar/ui-sidebar.html +36 -7
- package/components/ui-sidebar/ui-sidebar.js +6 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/styles/ui-badge.css +31 -0
- package/styles/ui-disclosure.css +65 -17
- package/styles/ui-nav-item.css +14 -11
- package/styles/ui-sidebar.css +34 -6
- package/tokens.css +15 -0
- package/vanilla/UiBadge.d.ts +1 -1
- package/vanilla/UiBadge.js +1 -1
- package/vanilla/UiDisclosure.d.ts +2 -0
- package/vanilla/UiDisclosure.js +33 -18
- package/vanilla/UiNavItem.js +42 -18
- package/vanilla/UiSidebar.js +19 -16
- package/vue/UiBadge.d.ts +3 -3
- package/vue/UiBadge.vue +38 -6
- package/vue/UiDisclosure.d.ts +24 -4
- package/vue/UiDisclosure.vue +130 -22
- package/vue/UiNavItem.d.ts +8 -4
- package/vue/UiNavItem.vue +17 -12
- package/vue/UiSection.d.ts +1 -1
- package/vue/UiSidebar.vue +42 -8
- package/vue/chunks/UiBadge.js +5 -4
- package/vue/chunks/UiDisclosure.js +70 -14
- package/vue/chunks/UiNavItem.js +14 -10
- package/vue/chunks/UiSidebar.js +12 -7
- package/vue/components.css +235 -123
package/vanilla/UiNavItem.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { componentRootIndex, manageComponentLifecycle } from "@nextwebwg/html-next/runtime";
|
|
3
3
|
import "../styles/ui-nav-item.css";
|
|
4
4
|
|
|
5
|
-
const definition = {...{"contract":{"tag":"ui-nav-item","props":{"as":{"type":{"kind":"terminal","name":"keyword"},"values":["button","a"],"required":false,"target":{"attribute":"as"},"default":"button"},"current":{"type":{"kind":"terminal","name":"keyword"},"values":["true","false","page","step","location"],"required":false,"target":{"attribute":"current"},"default":"false"},"density":{"type":{"kind":"terminal","name":"keyword"},"values":["comfortable","compact"],"required":false,"target":{"attribute":"density"},"default":"comfortable"},"href":{"type":"string","required":false,"target":{"attribute":"href"}},"rel":{"type":"string","required":false,"target":{"attribute":"rel"}},"target":{"type":"string","required":false,"target":{"attribute":"target"}},"variant":{"type":{"kind":"terminal","name":"keyword"},"values":["surface","line"],"required":false,"target":{"attribute":"variant"},"default":"surface"}}},"template":{"kind":"element","name":"template","attributes":[],"children":[{"kind":"element","name":"a","attributes":[{"kind":"attribute","name":"href","expression":"href","expressionPlan":{"source":"href","ast":{"kind":"id","name":"href"},"dependencies":["href"]}},{"kind":"attribute","name":"target","expression":"target","expressionPlan":{"source":"target","ast":{"kind":"id","name":"target"},"dependencies":["target"]}},{"kind":"attribute","name":"rel","expression":"rel","expressionPlan":{"source":"rel","ast":{"kind":"id","name":"rel"},"dependencies":["rel"]}},{"kind":"attribute","name":"aria-current","expression":"{ true: 'page', false: null, page: 'page', step: 'step', location: 'location' }[format('%s', current)]","expressionPlan":{"source":"{ true: 'page', false: null, page: 'page', step: 'step', location: 'location' }[format('%s', current)]","ast":{"kind":"index","object":{"kind":"object","pairs":[{"key":"true","value":{"kind":"literal","value":"page"}},{"key":"false","value":{"kind":"literal","value":null}},{"key":"page","value":{"kind":"literal","value":"page"}},{"key":"step","value":{"kind":"literal","value":"step"}},{"key":"location","value":{"kind":"literal","value":"location"}}]},"index":{"kind":"call","fn":"format","args":[{"kind":"literal","value":"%s"},{"kind":"id","name":"current"}]}},"dependencies":["current"]}}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"indicator"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"leading"}],"children":[{"kind":"slot","fallback":[],"name":"leading"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"content"}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"label"}],"children":[{"kind":"slot"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"description"}],"children":[{"kind":"slot","fallback":[],"name":"description"}]}]}],"flow":{"kind":"when","test":"as = 'a'","testPlan":{"source":"as = 'a'","ast":{"kind":"binary","op":"=","left":{"kind":"id","name":"as"},"right":{"kind":"literal","value":"a"}},"dependencies":["as"]}}},{"kind":"element","name":"button","attributes":[{"kind":"literal","name":"type","value":"button"},{"kind":"attribute","name":"aria-current","expression":"{ true: 'page', false: null, page: 'page', step: 'step', location: 'location' }[format('%s', current)]","expressionPlan":{"source":"{ true: 'page', false: null, page: 'page', step: 'step', location: 'location' }[format('%s', current)]","ast":{"kind":"index","object":{"kind":"object","pairs":[{"key":"true","value":{"kind":"literal","value":"page"}},{"key":"false","value":{"kind":"literal","value":null}},{"key":"page","value":{"kind":"literal","value":"page"}},{"key":"step","value":{"kind":"literal","value":"step"}},{"key":"location","value":{"kind":"literal","value":"location"}}]},"index":{"kind":"call","fn":"format","args":[{"kind":"literal","value":"%s"},{"kind":"id","name":"current"}]}},"dependencies":["current"]}}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"indicator"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"leading"}],"children":[{"kind":"slot","fallback":[],"name":"leading"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"content"}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"label"}],"children":[{"kind":"slot"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"description"}],"children":[{"kind":"slot","fallback":[],"name":"description"}]}]}],"flow":{"kind":"else"}}],"flow":{"kind":"match"}},"declarations":[],"root":{"kind":"native","element":"button","choices":["a","button"]}},source:{file:import.meta.url},css:""};
|
|
5
|
+
const definition = {...{"contract":{"tag":"ui-nav-item","props":{"as":{"type":{"kind":"terminal","name":"keyword"},"values":["button","a"],"required":false,"target":{"attribute":"as"},"default":"button"},"current":{"type":{"kind":"terminal","name":"keyword"},"values":["true","false","page","step","location"],"required":false,"target":{"attribute":"current"},"default":"false"},"density":{"type":{"kind":"terminal","name":"keyword"},"values":["comfortable","compact"],"required":false,"target":{"attribute":"density"},"default":"comfortable"},"href":{"type":"string","required":false,"target":{"attribute":"href"}},"rel":{"type":"string","required":false,"target":{"attribute":"rel"}},"target":{"type":"string","required":false,"target":{"attribute":"target"}},"variant":{"type":{"kind":"terminal","name":"keyword"},"values":["surface","line"],"required":false,"target":{"attribute":"variant"},"default":"surface"}}},"template":{"kind":"element","name":"template","attributes":[],"children":[{"kind":"element","name":"a","attributes":[{"kind":"attribute","name":"href","expression":"href","expressionPlan":{"source":"href","ast":{"kind":"id","name":"href"},"dependencies":["href"]}},{"kind":"attribute","name":"target","expression":"target","expressionPlan":{"source":"target","ast":{"kind":"id","name":"target"},"dependencies":["target"]}},{"kind":"attribute","name":"rel","expression":"rel","expressionPlan":{"source":"rel","ast":{"kind":"id","name":"rel"},"dependencies":["rel"]}},{"kind":"attribute","name":"aria-current","expression":"{ true: 'page', false: null, page: 'page', step: 'step', location: 'location' }[format('%s', current)]","expressionPlan":{"source":"{ true: 'page', false: null, page: 'page', step: 'step', location: 'location' }[format('%s', current)]","ast":{"kind":"index","object":{"kind":"object","pairs":[{"key":"true","value":{"kind":"literal","value":"page"}},{"key":"false","value":{"kind":"literal","value":null}},{"key":"page","value":{"kind":"literal","value":"page"}},{"key":"step","value":{"kind":"literal","value":"step"}},{"key":"location","value":{"kind":"literal","value":"location"}}]},"index":{"kind":"call","fn":"format","args":[{"kind":"literal","value":"%s"},{"kind":"id","name":"current"}]}},"dependencies":["current"]}}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"indicator"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"leading"}],"children":[{"kind":"slot","fallback":[],"name":"leading"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"content"}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"label"}],"children":[{"kind":"slot"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"description"}],"children":[{"kind":"slot","fallback":[],"name":"description"}]}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"trailing"}],"children":[{"kind":"slot","fallback":[],"name":"trailing"}]}],"flow":{"kind":"when","test":"as = 'a'","testPlan":{"source":"as = 'a'","ast":{"kind":"binary","op":"=","left":{"kind":"id","name":"as"},"right":{"kind":"literal","value":"a"}},"dependencies":["as"]}}},{"kind":"element","name":"button","attributes":[{"kind":"literal","name":"type","value":"button"},{"kind":"attribute","name":"aria-current","expression":"{ true: 'page', false: null, page: 'page', step: 'step', location: 'location' }[format('%s', current)]","expressionPlan":{"source":"{ true: 'page', false: null, page: 'page', step: 'step', location: 'location' }[format('%s', current)]","ast":{"kind":"index","object":{"kind":"object","pairs":[{"key":"true","value":{"kind":"literal","value":"page"}},{"key":"false","value":{"kind":"literal","value":null}},{"key":"page","value":{"kind":"literal","value":"page"}},{"key":"step","value":{"kind":"literal","value":"step"}},{"key":"location","value":{"kind":"literal","value":"location"}}]},"index":{"kind":"call","fn":"format","args":[{"kind":"literal","value":"%s"},{"kind":"id","name":"current"}]}},"dependencies":["current"]}}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"indicator"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"leading"}],"children":[{"kind":"slot","fallback":[],"name":"leading"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"content"}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"label"}],"children":[{"kind":"slot"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"description"}],"children":[{"kind":"slot","fallback":[],"name":"description"}]}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"trailing"}],"children":[{"kind":"slot","fallback":[],"name":"trailing"}]}],"flow":{"kind":"else"}}],"flow":{"kind":"match"}},"declarations":[],"root":{"kind":"native","element":"button","choices":["a","button"]}},source:{file:import.meta.url},css:""};
|
|
6
6
|
|
|
7
7
|
export function createUiNavItem(options = {}) {
|
|
8
8
|
const { attributes = {}, children = [], slots = {}, ...componentProps } = options;
|
|
@@ -68,6 +68,18 @@ export function createUiNavItem(options = {}) {
|
|
|
68
68
|
}
|
|
69
69
|
element2.append(element4);
|
|
70
70
|
element.append(element2);
|
|
71
|
+
const element5 = document.createElement("span");
|
|
72
|
+
element5.setAttribute("class", "trailing");
|
|
73
|
+
if (slots["trailing"] ?? [].length > 0) {
|
|
74
|
+
for (const child of slots["trailing"] ?? []) {
|
|
75
|
+
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
76
|
+
if (node.nodeType === 1) node.setAttribute("data-slotted", "");
|
|
77
|
+
projected.push([node, "trailing"]);
|
|
78
|
+
element5.append(node);
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
}
|
|
82
|
+
element.append(element5);
|
|
71
83
|
} else {
|
|
72
84
|
element = document.createElement("button");
|
|
73
85
|
for (const [name, value] of Object.entries(attributes)) {
|
|
@@ -76,49 +88,61 @@ export function createUiNavItem(options = {}) {
|
|
|
76
88
|
}
|
|
77
89
|
if (!element.hasAttribute("type")) element.setAttribute("type", "button");
|
|
78
90
|
element.setAttribute("data-component", "ui-nav-item");
|
|
79
|
-
const element5 = document.createElement("span");
|
|
80
|
-
element5.setAttribute("class", "indicator");
|
|
81
|
-
element5.setAttribute("aria-hidden", "true");
|
|
82
|
-
element.append(element5);
|
|
83
91
|
const element6 = document.createElement("span");
|
|
84
|
-
element6.setAttribute("class", "
|
|
92
|
+
element6.setAttribute("class", "indicator");
|
|
93
|
+
element6.setAttribute("aria-hidden", "true");
|
|
94
|
+
element.append(element6);
|
|
95
|
+
const element7 = document.createElement("span");
|
|
96
|
+
element7.setAttribute("class", "leading");
|
|
85
97
|
if (slots["leading"] ?? [].length > 0) {
|
|
86
98
|
for (const child of slots["leading"] ?? []) {
|
|
87
99
|
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
88
100
|
if (node.nodeType === 1) node.setAttribute("data-slotted", "");
|
|
89
101
|
projected.push([node, "leading"]);
|
|
90
|
-
|
|
102
|
+
element7.append(node);
|
|
91
103
|
}
|
|
92
104
|
} else {
|
|
93
105
|
}
|
|
94
|
-
element.append(
|
|
95
|
-
const element7 = document.createElement("span");
|
|
96
|
-
element7.setAttribute("class", "content");
|
|
106
|
+
element.append(element7);
|
|
97
107
|
const element8 = document.createElement("span");
|
|
98
|
-
element8.setAttribute("class", "
|
|
108
|
+
element8.setAttribute("class", "content");
|
|
109
|
+
const element9 = document.createElement("span");
|
|
110
|
+
element9.setAttribute("class", "label");
|
|
99
111
|
if (children.length > 0) {
|
|
100
112
|
for (const child of children) {
|
|
101
113
|
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
102
114
|
if (node.nodeType === 1) node.setAttribute("data-slotted", "");
|
|
103
115
|
projected.push([node, ""]);
|
|
104
|
-
|
|
116
|
+
element9.append(node);
|
|
105
117
|
}
|
|
106
118
|
} else {
|
|
107
119
|
}
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
120
|
+
element8.append(element9);
|
|
121
|
+
const element10 = document.createElement("span");
|
|
122
|
+
element10.setAttribute("class", "description");
|
|
111
123
|
if (slots["description"] ?? [].length > 0) {
|
|
112
124
|
for (const child of slots["description"] ?? []) {
|
|
113
125
|
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
114
126
|
if (node.nodeType === 1) node.setAttribute("data-slotted", "");
|
|
115
127
|
projected.push([node, "description"]);
|
|
116
|
-
|
|
128
|
+
element10.append(node);
|
|
117
129
|
}
|
|
118
130
|
} else {
|
|
119
131
|
}
|
|
120
|
-
|
|
121
|
-
element.append(
|
|
132
|
+
element8.append(element10);
|
|
133
|
+
element.append(element8);
|
|
134
|
+
const element11 = document.createElement("span");
|
|
135
|
+
element11.setAttribute("class", "trailing");
|
|
136
|
+
if (slots["trailing"] ?? [].length > 0) {
|
|
137
|
+
for (const child of slots["trailing"] ?? []) {
|
|
138
|
+
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
139
|
+
if (node.nodeType === 1) node.setAttribute("data-slotted", "");
|
|
140
|
+
projected.push([node, "trailing"]);
|
|
141
|
+
element11.append(node);
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
}
|
|
145
|
+
element.append(element11);
|
|
122
146
|
}
|
|
123
147
|
manageComponentLifecycle(element, definition, { props: componentProps, projected,
|
|
124
148
|
});
|
package/vanilla/UiSidebar.js
CHANGED
|
@@ -3,7 +3,7 @@ import { manageComponentLifecycle } from "@nextwebwg/html-next/runtime";
|
|
|
3
3
|
import * as controller from "../components/ui-sidebar/ui-sidebar.js";
|
|
4
4
|
import "../styles/ui-sidebar.css";
|
|
5
5
|
|
|
6
|
-
const definition = {...{"contract":{"tag":"ui-sidebar","props":{"breakpoint":{"type":{"kind":"terminal","name":"keyword"},"values":["sm","md","lg"],"required":false,"target":{"attribute":"breakpoint"},"default":"md"},"collapsed":{"type":"boolean","required":false,"target":{"attribute":"collapsed"},"default":false},"maxWidth":{"type":"number","required":false,"target":{"attribute":"maxwidth"},"default":480},"minWidth":{"type":"number","required":false,"target":{"attribute":"minwidth"},"default":200},"resizable":{"type":"boolean","required":false,"target":{"attribute":"resizable"},"default":false},"resizeLabel":{"type":"string","required":false,"target":{"attribute":"aria-label"},"default":"Resize sidebar"},"resizeStep":{"type":"number","required":false,"target":{"attribute":"resizestep"},"default":16},"side":{"type":{"kind":"terminal","name":"keyword"},"values":["start","end"],"required":false,"target":{"attribute":"side"},"default":"start"},"width":{"type":"number","required":false,"target":{"attribute":"width"},"default":0}}},"template":{"kind":"element","name":"aside","attributes":[],"children":[{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"content"}],"children":[{"kind":"slot"}]},{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"resizer"},{"kind":"literal","name":"role","value":"separator"},{"kind":"literal","name":"aria-orientation","value":"vertical"},{"kind":"literal","name":"tabindex","value":"0"},{"kind":"literal","name":"data-ui-affordance","value":"resize"},{"kind":"attribute","name":"aria-label","expression":"resizeLabel","expressionPlan":{"source":"resizeLabel","ast":{"kind":"id","name":"resizeLabel"},"dependencies":["resizeLabel"]}},{"kind":"attribute","name":"hidden","expression":"not resizable or drawer or internalCollapsed","expressionPlan":{"source":"not resizable or drawer or internalCollapsed","ast":{"kind":"binary","op":"or","left":{"kind":"binary","op":"or","left":{"kind":"unary","op":"not","operand":{"kind":"id","name":"resizable"}},"right":{"kind":"id","name":"drawer"}},"right":{"kind":"id","name":"internalCollapsed"}},"dependencies":["drawer","internalCollapsed","resizable"]}}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"guide"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]}],"ref":"resizer"}]},"declarations":[{"kind":"state","name":"internalCollapsed","type":"boolean","value":"false","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"drawer","type":"boolean","value":"false","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"event","name":"resize","type":"object","shape":{"kind":"object","fields":[{"name":"width","type":{"kind":"terminal","name":"number"},"optional":false},{"name":"trigger","type":{"kind":"constrained","base":{"kind":"terminal","name":"keyword"},"values":["keyboard","pointer","programmatic"]},"optional":false}],"open":false},"bubbles":true,"composed":true,"cancelable":false},{"kind":"event","name":"toggle","type":"object","shape":{"kind":"object","fields":[{"name":"open","type":{"kind":"terminal","name":"boolean"},"optional":false},{"name":"mode","type":{"kind":"constrained","base":{"kind":"terminal","name":"keyword"},"values":["docked","drawer"]},"optional":false},{"name":"trigger","type":{"kind":"constrained","base":{"kind":"terminal","name":"keyword"},"values":["keyboard","pointer","programmatic"]},"optional":false}],"open":false},"bubbles":true,"composed":true,"cancelable":false}],"root":{"kind":"native","element":"aside","choices":["aside"]}},source:{file:import.meta.url},css:""};
|
|
6
|
+
const definition = {...{"contract":{"tag":"ui-sidebar","props":{"breakpoint":{"type":{"kind":"terminal","name":"keyword"},"values":["sm","md","lg"],"required":false,"target":{"attribute":"breakpoint"},"default":"md"},"collapsed":{"type":"boolean","required":false,"target":{"attribute":"collapsed"},"default":false},"maxWidth":{"type":"number","required":false,"target":{"attribute":"maxwidth"},"default":480},"minWidth":{"type":"number","required":false,"target":{"attribute":"minwidth"},"default":200},"resizable":{"type":"boolean","required":false,"target":{"attribute":"resizable"},"default":false},"resizeLabel":{"type":"string","required":false,"target":{"attribute":"aria-label"},"default":"Resize sidebar"},"resizeStep":{"type":"number","required":false,"target":{"attribute":"resizestep"},"default":16},"side":{"type":{"kind":"terminal","name":"keyword"},"values":["start","end"],"required":false,"target":{"attribute":"side"},"default":"start"},"width":{"type":"number","required":false,"target":{"attribute":"width"},"default":0}}},"template":{"kind":"element","name":"aside","attributes":[],"children":[{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"viewport"}],"children":[{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"content"}],"children":[{"kind":"slot"}]}]},{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"resizer"},{"kind":"literal","name":"role","value":"separator"},{"kind":"literal","name":"aria-orientation","value":"vertical"},{"kind":"literal","name":"tabindex","value":"0"},{"kind":"literal","name":"data-ui-affordance","value":"resize"},{"kind":"attribute","name":"aria-label","expression":"resizeLabel","expressionPlan":{"source":"resizeLabel","ast":{"kind":"id","name":"resizeLabel"},"dependencies":["resizeLabel"]}},{"kind":"attribute","name":"hidden","expression":"not resizable or drawer or internalCollapsed","expressionPlan":{"source":"not resizable or drawer or internalCollapsed","ast":{"kind":"binary","op":"or","left":{"kind":"binary","op":"or","left":{"kind":"unary","op":"not","operand":{"kind":"id","name":"resizable"}},"right":{"kind":"id","name":"drawer"}},"right":{"kind":"id","name":"internalCollapsed"}},"dependencies":["drawer","internalCollapsed","resizable"]}}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"guide"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]}],"ref":"resizer"}]},"declarations":[{"kind":"state","name":"internalCollapsed","type":"boolean","value":"false","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"drawer","type":"boolean","value":"false","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"resizing","type":"boolean","value":"false","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"event","name":"resize","type":"object","shape":{"kind":"object","fields":[{"name":"width","type":{"kind":"terminal","name":"number"},"optional":false},{"name":"trigger","type":{"kind":"constrained","base":{"kind":"terminal","name":"keyword"},"values":["keyboard","pointer","programmatic"]},"optional":false}],"open":false},"bubbles":true,"composed":true,"cancelable":false},{"kind":"event","name":"toggle","type":"object","shape":{"kind":"object","fields":[{"name":"open","type":{"kind":"terminal","name":"boolean"},"optional":false},{"name":"mode","type":{"kind":"constrained","base":{"kind":"terminal","name":"keyword"},"values":["docked","drawer"]},"optional":false},{"name":"trigger","type":{"kind":"constrained","base":{"kind":"terminal","name":"keyword"},"values":["keyboard","pointer","programmatic"]},"optional":false}],"open":false},"bubbles":true,"composed":true,"cancelable":false}],"root":{"kind":"native","element":"aside","choices":["aside"]}},source:{file:import.meta.url},css:""};
|
|
7
7
|
|
|
8
8
|
export function createUiSidebar(options = {}) {
|
|
9
9
|
const { attributes = {}, children = [], slots = {}, ...componentProps } = options;
|
|
@@ -15,31 +15,34 @@ export function createUiSidebar(options = {}) {
|
|
|
15
15
|
}
|
|
16
16
|
element.setAttribute("data-component", "ui-sidebar");
|
|
17
17
|
const element0 = document.createElement("div");
|
|
18
|
-
element0.setAttribute("class", "
|
|
18
|
+
element0.setAttribute("class", "viewport");
|
|
19
|
+
const element1 = document.createElement("div");
|
|
20
|
+
element1.setAttribute("class", "content");
|
|
19
21
|
if (children.length > 0) {
|
|
20
22
|
for (const child of children) {
|
|
21
23
|
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
22
24
|
if (node.nodeType === 1) node.setAttribute("data-slotted", "");
|
|
23
25
|
projected.push([node, ""]);
|
|
24
|
-
|
|
26
|
+
element1.append(node);
|
|
25
27
|
}
|
|
26
28
|
} else {
|
|
27
29
|
}
|
|
30
|
+
element0.append(element1);
|
|
28
31
|
element.append(element0);
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const element2 = document.createElement("div");
|
|
33
|
+
element2.setAttribute("class", "resizer");
|
|
34
|
+
element2.setAttribute("role", "separator");
|
|
35
|
+
element2.setAttribute("aria-orientation", "vertical");
|
|
36
|
+
element2.setAttribute("tabindex", "0");
|
|
37
|
+
element2.setAttribute("data-ui-affordance", "resize");
|
|
35
38
|
const value0 = componentProps["resizeLabel"] === undefined ? "Resize sidebar" : componentProps["resizeLabel"];
|
|
36
|
-
if (value0 === null || value0 === undefined)
|
|
37
|
-
else
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
element.append(
|
|
39
|
+
if (value0 === null || value0 === undefined) element2.removeAttribute("aria-label");
|
|
40
|
+
else element2.setAttribute("aria-label", String(value0));
|
|
41
|
+
const element3 = document.createElement("span");
|
|
42
|
+
element3.setAttribute("class", "guide");
|
|
43
|
+
element3.setAttribute("aria-hidden", "true");
|
|
44
|
+
element2.append(element3);
|
|
45
|
+
element.append(element2);
|
|
43
46
|
manageComponentLifecycle(element, definition, { props: componentProps, projected,
|
|
44
47
|
controller,
|
|
45
48
|
});
|
package/vue/UiBadge.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ type __VLS_Slots = {} & {
|
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
7
7
|
shape: {
|
|
8
|
-
type: PropType<"pill" | "tag" | "dot" | null>;
|
|
8
|
+
type: PropType<"pill" | "tag" | "dot" | "square" | null>;
|
|
9
9
|
default: string;
|
|
10
10
|
};
|
|
11
11
|
size: {
|
|
@@ -22,7 +22,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
22
22
|
};
|
|
23
23
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
24
|
shape: {
|
|
25
|
-
type: PropType<"pill" | "tag" | "dot" | null>;
|
|
25
|
+
type: PropType<"pill" | "tag" | "dot" | "square" | null>;
|
|
26
26
|
default: string;
|
|
27
27
|
};
|
|
28
28
|
size: {
|
|
@@ -38,7 +38,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
38
38
|
default: string;
|
|
39
39
|
};
|
|
40
40
|
}>> & Readonly<{}>, {
|
|
41
|
-
shape: "dot" | "tag" | "pill" | null;
|
|
41
|
+
shape: "dot" | "tag" | "square" | "pill" | null;
|
|
42
42
|
size: "xs" | "md" | null;
|
|
43
43
|
tone: "info" | "neutral" | "accent" | "success" | "warning" | "danger" | null;
|
|
44
44
|
variant: "solid" | "subtle" | "outline" | null;
|
package/vue/UiBadge.vue
CHANGED
|
@@ -13,8 +13,8 @@ const propValidityContract = {
|
|
|
13
13
|
required: false,
|
|
14
14
|
target: { attribute: 'shape' },
|
|
15
15
|
description:
|
|
16
|
-
'Silhouette. pill is rounded at both ends; tag is a pointed label. dot is a compact circular signal with visually hidden text: include a state label, or set\n aria-hidden when the surrounding control already names that state.',
|
|
17
|
-
values: ['pill', 'tag', 'dot'],
|
|
16
|
+
'Silhouette. pill is rounded at both ends; tag is a pointed label. dot is a compact circular signal with visually hidden text: include a state label, or set\n aria-hidden when the surrounding control already names that state. square is a fixed rounded square for an icon or single glyph beside a heading; hide a\n decorative icon when adjacent words name it.',
|
|
17
|
+
values: ['pill', 'tag', 'dot', 'square'],
|
|
18
18
|
default: 'pill',
|
|
19
19
|
},
|
|
20
20
|
size: {
|
|
@@ -22,7 +22,7 @@ const propValidityContract = {
|
|
|
22
22
|
required: false,
|
|
23
23
|
target: { attribute: 'size' },
|
|
24
24
|
description:
|
|
25
|
-
'Scale. xs is a compact count beside small controls; md is the usual text badge.',
|
|
25
|
+
'Scale. xs is a compact count beside small controls; md is the usual text badge. A square is 24px at xs and 32px at md with default spacing.',
|
|
26
26
|
values: ['xs', 'md'],
|
|
27
27
|
default: 'md',
|
|
28
28
|
},
|
|
@@ -47,7 +47,10 @@ const propValidityContract = {
|
|
|
47
47
|
},
|
|
48
48
|
} as const
|
|
49
49
|
const props = defineProps({
|
|
50
|
-
shape: {
|
|
50
|
+
shape: {
|
|
51
|
+
type: null as unknown as PropType<'pill' | 'tag' | 'dot' | 'square' | null>,
|
|
52
|
+
default: 'pill',
|
|
53
|
+
},
|
|
51
54
|
size: { type: null as unknown as PropType<'xs' | 'md' | null>, default: 'md' },
|
|
52
55
|
tone: {
|
|
53
56
|
type: null as unknown as PropType<
|
|
@@ -67,13 +70,13 @@ const acceptedProps: Record<string, unknown> = {
|
|
|
67
70
|
variant: 'subtle',
|
|
68
71
|
}
|
|
69
72
|
const checkedProps = computed(() => ({
|
|
70
|
-
shape: checkedProp<'pill' | 'tag' | 'dot'>(
|
|
73
|
+
shape: checkedProp<'pill' | 'tag' | 'dot' | 'square'>(
|
|
71
74
|
props['shape'],
|
|
72
75
|
{ kind: 'terminal', name: 'keyword' },
|
|
73
76
|
false,
|
|
74
77
|
'shape',
|
|
75
78
|
acceptedProps,
|
|
76
|
-
) as 'pill' | 'tag' | 'dot',
|
|
79
|
+
) as 'pill' | 'tag' | 'dot' | 'square',
|
|
77
80
|
size: checkedProp<'xs' | 'md'>(
|
|
78
81
|
props['size'],
|
|
79
82
|
{ kind: 'terminal', name: 'keyword' },
|
|
@@ -183,6 +186,10 @@ const hostState = computed(() =>
|
|
|
183
186
|
syntax: "*";
|
|
184
187
|
inherits: false;
|
|
185
188
|
}
|
|
189
|
+
@property --ui-badge-square-size {
|
|
190
|
+
syntax: "*";
|
|
191
|
+
inherits: false;
|
|
192
|
+
}
|
|
186
193
|
@property --ui-badge-dot-size {
|
|
187
194
|
syntax: "*";
|
|
188
195
|
inherits: false;
|
|
@@ -394,6 +401,31 @@ const hostState = computed(() =>
|
|
|
394
401
|
--_badge-text: var(--ui-info-subtle-text, var(--ui-info-solid));
|
|
395
402
|
}
|
|
396
403
|
|
|
404
|
+
/* An icon mark keeps the existing tone recipe and follows the global spacing and radius. */
|
|
405
|
+
[data-component~="ui-badge"][data-ui-badge-state~="shape=square"] {
|
|
406
|
+
--_badge-square-size: var(--ui-badge-square-size, calc(var(--ui-space-4) * 2));
|
|
407
|
+
display: inline-flex;
|
|
408
|
+
box-sizing: border-box;
|
|
409
|
+
flex: none;
|
|
410
|
+
inline-size: var(--_badge-square-size);
|
|
411
|
+
block-size: var(--_badge-square-size);
|
|
412
|
+
min-inline-size: var(--_badge-square-size);
|
|
413
|
+
min-block-size: var(--_badge-square-size);
|
|
414
|
+
padding: 0;
|
|
415
|
+
border-radius: var(--ui-radius-md);
|
|
416
|
+
text-box-trim: none;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
[data-component~="ui-badge"][data-ui-badge-state~="shape=square"][data-ui-badge-state~="size=xs"] {
|
|
420
|
+
--_badge-square-size: var(--ui-badge-square-size, calc(var(--ui-space-3) * 2));
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
[data-component~="ui-badge"][data-ui-badge-state~="shape=square"] .label {
|
|
424
|
+
display: inline-flex;
|
|
425
|
+
align-items: center;
|
|
426
|
+
justify-content: center;
|
|
427
|
+
}
|
|
428
|
+
|
|
397
429
|
/* A dot uses the badge's tone recipe; only its silhouette and visible label change. */
|
|
398
430
|
[data-component~="ui-badge"][data-ui-badge-state~="shape=dot"] {
|
|
399
431
|
position: relative;
|
package/vue/UiDisclosure.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
-
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {};
|
|
2
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {};
|
|
3
3
|
type __VLS_Slots = {} & {
|
|
4
|
-
|
|
4
|
+
leading?: (props: typeof __VLS_1) => any;
|
|
5
5
|
} & {
|
|
6
|
-
|
|
6
|
+
summary?: (props: typeof __VLS_3) => any;
|
|
7
7
|
} & {
|
|
8
|
-
|
|
8
|
+
indicator?: (props: typeof __VLS_5) => any;
|
|
9
|
+
} & {
|
|
10
|
+
default?: (props: typeof __VLS_7) => any;
|
|
9
11
|
};
|
|
10
12
|
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
11
13
|
density: {
|
|
@@ -32,10 +34,18 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
32
34
|
type: PropType<boolean | null>;
|
|
33
35
|
default: boolean;
|
|
34
36
|
};
|
|
37
|
+
requiredOpen: {
|
|
38
|
+
type: PropType<boolean | null>;
|
|
39
|
+
default: boolean;
|
|
40
|
+
};
|
|
35
41
|
summary: {
|
|
36
42
|
type: PropType<string | null>;
|
|
37
43
|
default: string;
|
|
38
44
|
};
|
|
45
|
+
variant: {
|
|
46
|
+
type: PropType<"plain" | "navigation" | null>;
|
|
47
|
+
default: string;
|
|
48
|
+
};
|
|
39
49
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
40
50
|
open: (event: CustomEvent<{
|
|
41
51
|
readonly open: boolean;
|
|
@@ -73,10 +83,18 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
73
83
|
type: PropType<boolean | null>;
|
|
74
84
|
default: boolean;
|
|
75
85
|
};
|
|
86
|
+
requiredOpen: {
|
|
87
|
+
type: PropType<boolean | null>;
|
|
88
|
+
default: boolean;
|
|
89
|
+
};
|
|
76
90
|
summary: {
|
|
77
91
|
type: PropType<string | null>;
|
|
78
92
|
default: string;
|
|
79
93
|
};
|
|
94
|
+
variant: {
|
|
95
|
+
type: PropType<"plain" | "navigation" | null>;
|
|
96
|
+
default: string;
|
|
97
|
+
};
|
|
80
98
|
}>> & Readonly<{
|
|
81
99
|
onOpen?: ((event: CustomEvent<{
|
|
82
100
|
readonly open: boolean;
|
|
@@ -94,9 +112,11 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
94
112
|
summary: string | null;
|
|
95
113
|
name: string | null;
|
|
96
114
|
open: boolean | null;
|
|
115
|
+
variant: "plain" | "navigation" | null;
|
|
97
116
|
disabled: boolean | null;
|
|
98
117
|
density: "comfortable" | "compact" | null;
|
|
99
118
|
headingLevel: number | null;
|
|
119
|
+
requiredOpen: boolean | null;
|
|
100
120
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
101
121
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
102
122
|
declare const _default: typeof __VLS_export;
|