@websublime/line-components 0.2.2 → 0.2.3
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/README.md +28 -0
- package/custom-elements.json +445 -0
- package/dist/separator/index.d.ts +3 -0
- package/dist/separator/index.d.ts.map +1 -0
- package/dist/separator/index.js +62 -0
- package/dist/separator/index.js.map +1 -0
- package/dist/separator/separator.d.ts +32 -0
- package/dist/separator/separator.d.ts.map +1 -0
- package/dist/separator/separator.types.d.ts +3 -0
- package/dist/separator/separator.types.d.ts.map +1 -0
- package/package.json +5 -1
- package/src/separator/index.ts +3 -0
- package/src/separator/separator.ts +93 -0
- package/src/separator/separator.types.ts +2 -0
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ that registers one tag, and the root entry registers nothing.
|
|
|
6
6
|
| Subpath | Registers |
|
|
7
7
|
|---------|-----------|
|
|
8
8
|
| `@websublime/line-components/button` | `<line-button>` |
|
|
9
|
+
| `@websublime/line-components/separator` | `<line-separator>` |
|
|
9
10
|
| `@websublime/line-components/stack` | `<line-stack>` |
|
|
10
11
|
|
|
11
12
|
```js
|
|
@@ -37,3 +38,30 @@ container, it adds no role, and it exposes no `::part()`; style it directly with
|
|
|
37
38
|
The gap reads `--line-stack-gap`, so load `@websublime/line-tokens/sizing` and `@websublime/line-tokens/layouts`
|
|
38
39
|
or set `--line-stack-gap` yourself; without them the gap is `0`. For a list, put `role="list"` on the host and
|
|
39
40
|
`role="listitem"` on each child.
|
|
41
|
+
|
|
42
|
+
## Separator
|
|
43
|
+
|
|
44
|
+
`<line-separator>` draws a thin line between sections of content. The host is the line, it renders nothing
|
|
45
|
+
inside, and it exposes no `::part()`; style it directly with `line-separator { … }`. It adds no margin, so the
|
|
46
|
+
surrounding layout, such as a `<line-stack>` `gap`, spaces it.
|
|
47
|
+
|
|
48
|
+
| Attribute | Values | Default |
|
|
49
|
+
|-----------|--------|---------|
|
|
50
|
+
| `orientation` | `horizontal`, `vertical` | `horizontal` |
|
|
51
|
+
| `decorative` | boolean | off |
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<line-separator></line-separator>
|
|
55
|
+
<line-stack orientation="horizontal" align="center">
|
|
56
|
+
<a href="/docs">Docs</a>
|
|
57
|
+
<line-separator orientation="vertical"></line-separator>
|
|
58
|
+
<a href="/blog">Blog</a>
|
|
59
|
+
</line-stack>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Assistive technology announces it as a separator, with the host `aria-label` as its name when one is set. The
|
|
63
|
+
role and orientation are `ElementInternals` defaults, so an author `role` or `aria-*` attribute wins. Set
|
|
64
|
+
`decorative` when the line only adds visual rhythm, so assistive technology skips it, and give a decorative
|
|
65
|
+
separator no `aria-label`. The line is a border side coloured by `--line-separator-color` (default
|
|
66
|
+
`var(--line-gray-6, currentColor)`) and as thick as `--line-separator-thickness` (default
|
|
67
|
+
`var(--line-border-1, 1px)`), so it stays visible without `line-themes`, `line-tokens` and in forced-colors mode.
|
package/custom-elements.json
CHANGED
|
@@ -1177,6 +1177,451 @@
|
|
|
1177
1177
|
}
|
|
1178
1178
|
]
|
|
1179
1179
|
},
|
|
1180
|
+
{
|
|
1181
|
+
"kind": "javascript-module",
|
|
1182
|
+
"path": "src/separator/index.ts",
|
|
1183
|
+
"declarations": [],
|
|
1184
|
+
"exports": [
|
|
1185
|
+
{
|
|
1186
|
+
"kind": "js",
|
|
1187
|
+
"name": "LineSeparator",
|
|
1188
|
+
"declaration": {
|
|
1189
|
+
"name": "LineSeparator",
|
|
1190
|
+
"module": "./separator.js"
|
|
1191
|
+
}
|
|
1192
|
+
},
|
|
1193
|
+
{
|
|
1194
|
+
"kind": "js",
|
|
1195
|
+
"name": "SeparatorOrientation",
|
|
1196
|
+
"declaration": {
|
|
1197
|
+
"name": "SeparatorOrientation",
|
|
1198
|
+
"module": "./separator.types.js"
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
]
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
"kind": "javascript-module",
|
|
1205
|
+
"path": "src/separator/separator.ts",
|
|
1206
|
+
"declarations": [
|
|
1207
|
+
{
|
|
1208
|
+
"kind": "class",
|
|
1209
|
+
"description": "`<line-separator>` draws a thin line between sections of content. The host\nis the line and the shadow root renders nothing. The host carries the\n`separator` role and its orientation as `ElementInternals` defaults, so an\nauthor `role` or `aria-*` attribute wins, and a host `aria-label` names it.\n`decorative` sets the role to `none`, so assistive technology skips the\nline; give a decorative separator no `aria-label`. It adds no spacing.",
|
|
1210
|
+
"name": "LineSeparator",
|
|
1211
|
+
"cssProperties": [
|
|
1212
|
+
{
|
|
1213
|
+
"description": "Colour of the line.",
|
|
1214
|
+
"name": "--line-separator-color",
|
|
1215
|
+
"default": "var(--line-gray-6, currentColor)"
|
|
1216
|
+
},
|
|
1217
|
+
{
|
|
1218
|
+
"description": "Thickness of the line.",
|
|
1219
|
+
"name": "--line-separator-thickness",
|
|
1220
|
+
"default": "var(--line-border-1, 1px)"
|
|
1221
|
+
}
|
|
1222
|
+
],
|
|
1223
|
+
"members": [
|
|
1224
|
+
{
|
|
1225
|
+
"kind": "field",
|
|
1226
|
+
"name": "orientation",
|
|
1227
|
+
"privacy": "public",
|
|
1228
|
+
"type": {
|
|
1229
|
+
"text": "SeparatorOrientation"
|
|
1230
|
+
},
|
|
1231
|
+
"description": "Direction of the line; an unknown value behaves as `horizontal`.",
|
|
1232
|
+
"default": "'horizontal'",
|
|
1233
|
+
"attribute": "orientation",
|
|
1234
|
+
"reflects": true
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
"kind": "field",
|
|
1238
|
+
"name": "decorative",
|
|
1239
|
+
"privacy": "public",
|
|
1240
|
+
"type": {
|
|
1241
|
+
"text": "boolean"
|
|
1242
|
+
},
|
|
1243
|
+
"description": "Removes the separator from the accessibility tree (role `none`); the line still draws.",
|
|
1244
|
+
"default": "false",
|
|
1245
|
+
"attribute": "decorative",
|
|
1246
|
+
"reflects": true
|
|
1247
|
+
},
|
|
1248
|
+
{
|
|
1249
|
+
"kind": "field",
|
|
1250
|
+
"name": "properties",
|
|
1251
|
+
"type": {
|
|
1252
|
+
"text": "PropertyDeclarations"
|
|
1253
|
+
},
|
|
1254
|
+
"static": true,
|
|
1255
|
+
"default": "{ direction: { attribute: false, noAccessor: true }, }",
|
|
1256
|
+
"description": "`direction` is reactive but owns its accessor and has no attribute.",
|
|
1257
|
+
"inheritedFrom": {
|
|
1258
|
+
"name": "DirectionMixin",
|
|
1259
|
+
"module": "../line-core/src/mixins/direction.ts"
|
|
1260
|
+
}
|
|
1261
|
+
},
|
|
1262
|
+
{
|
|
1263
|
+
"kind": "field",
|
|
1264
|
+
"name": "#direction",
|
|
1265
|
+
"privacy": "private",
|
|
1266
|
+
"type": {
|
|
1267
|
+
"text": "Direction"
|
|
1268
|
+
},
|
|
1269
|
+
"default": "'ltr'",
|
|
1270
|
+
"inheritedFrom": {
|
|
1271
|
+
"name": "DirectionMixin",
|
|
1272
|
+
"module": "../line-core/src/mixins/direction.ts"
|
|
1273
|
+
}
|
|
1274
|
+
},
|
|
1275
|
+
{
|
|
1276
|
+
"kind": "field",
|
|
1277
|
+
"name": "#recomputeDirection",
|
|
1278
|
+
"privacy": "private",
|
|
1279
|
+
"readonly": true,
|
|
1280
|
+
"inheritedFrom": {
|
|
1281
|
+
"name": "DirectionMixin",
|
|
1282
|
+
"module": "../line-core/src/mixins/direction.ts"
|
|
1283
|
+
}
|
|
1284
|
+
},
|
|
1285
|
+
{
|
|
1286
|
+
"kind": "field",
|
|
1287
|
+
"name": "direction",
|
|
1288
|
+
"privacy": "public",
|
|
1289
|
+
"type": {
|
|
1290
|
+
"text": "Direction"
|
|
1291
|
+
},
|
|
1292
|
+
"description": "Resolved text direction of the host.",
|
|
1293
|
+
"readonly": true,
|
|
1294
|
+
"inheritedFrom": {
|
|
1295
|
+
"name": "DirectionMixin",
|
|
1296
|
+
"module": "../line-core/src/mixins/direction.ts"
|
|
1297
|
+
}
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
"kind": "field",
|
|
1301
|
+
"name": "version",
|
|
1302
|
+
"type": {
|
|
1303
|
+
"text": "string"
|
|
1304
|
+
},
|
|
1305
|
+
"static": true,
|
|
1306
|
+
"default": "'0.0.0'",
|
|
1307
|
+
"description": "Component semver string. Surfaced by the Inspector as `data-line-version`.",
|
|
1308
|
+
"inheritedFrom": {
|
|
1309
|
+
"name": "LineElement",
|
|
1310
|
+
"module": "../line-core/src/line-element.ts"
|
|
1311
|
+
}
|
|
1312
|
+
},
|
|
1313
|
+
{
|
|
1314
|
+
"kind": "field",
|
|
1315
|
+
"name": "docs",
|
|
1316
|
+
"type": {
|
|
1317
|
+
"text": "string"
|
|
1318
|
+
},
|
|
1319
|
+
"static": true,
|
|
1320
|
+
"default": "''",
|
|
1321
|
+
"description": "Documentation URL. Surfaced by the Inspector as `data-line-docs` when set.",
|
|
1322
|
+
"inheritedFrom": {
|
|
1323
|
+
"name": "MetadataMixin",
|
|
1324
|
+
"module": "../line-core/src/mixins/metadata.ts"
|
|
1325
|
+
}
|
|
1326
|
+
},
|
|
1327
|
+
{
|
|
1328
|
+
"kind": "field",
|
|
1329
|
+
"name": "qa",
|
|
1330
|
+
"type": {
|
|
1331
|
+
"text": "string[]"
|
|
1332
|
+
},
|
|
1333
|
+
"static": true,
|
|
1334
|
+
"default": "[]",
|
|
1335
|
+
"description": "QA tags for the component.",
|
|
1336
|
+
"inheritedFrom": {
|
|
1337
|
+
"name": "MetadataMixin",
|
|
1338
|
+
"module": "../line-core/src/mixins/metadata.ts"
|
|
1339
|
+
}
|
|
1340
|
+
},
|
|
1341
|
+
{
|
|
1342
|
+
"kind": "field",
|
|
1343
|
+
"name": "scope",
|
|
1344
|
+
"type": {
|
|
1345
|
+
"text": "string"
|
|
1346
|
+
},
|
|
1347
|
+
"static": true,
|
|
1348
|
+
"default": "''",
|
|
1349
|
+
"description": "Component scope identifier.",
|
|
1350
|
+
"inheritedFrom": {
|
|
1351
|
+
"name": "MetadataMixin",
|
|
1352
|
+
"module": "../line-core/src/mixins/metadata.ts"
|
|
1353
|
+
}
|
|
1354
|
+
},
|
|
1355
|
+
{
|
|
1356
|
+
"kind": "field",
|
|
1357
|
+
"name": "#inspectorDialog",
|
|
1358
|
+
"privacy": "private",
|
|
1359
|
+
"type": {
|
|
1360
|
+
"text": "HTMLDialogElement | null"
|
|
1361
|
+
},
|
|
1362
|
+
"default": "null",
|
|
1363
|
+
"description": "Active dialog panel while the inspector is enabled, else `null`.",
|
|
1364
|
+
"inheritedFrom": {
|
|
1365
|
+
"name": "InspectorMixin",
|
|
1366
|
+
"module": "../line-core/src/mixins/inspector.ts"
|
|
1367
|
+
}
|
|
1368
|
+
},
|
|
1369
|
+
{
|
|
1370
|
+
"kind": "field",
|
|
1371
|
+
"name": "#onInspectorKeydown",
|
|
1372
|
+
"privacy": "private",
|
|
1373
|
+
"readonly": true,
|
|
1374
|
+
"description": "Bound keydown handler, retained so it can be removed on disconnect.",
|
|
1375
|
+
"inheritedFrom": {
|
|
1376
|
+
"name": "InspectorMixin",
|
|
1377
|
+
"module": "../line-core/src/mixins/inspector.ts"
|
|
1378
|
+
}
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
"kind": "method",
|
|
1382
|
+
"name": "#activateInspector",
|
|
1383
|
+
"privacy": "private",
|
|
1384
|
+
"return": {
|
|
1385
|
+
"type": {
|
|
1386
|
+
"text": "void"
|
|
1387
|
+
}
|
|
1388
|
+
},
|
|
1389
|
+
"description": "Wire activation marker, host metadata attributes, the hotkey, and the\ndev-only hover-outline stylesheet.",
|
|
1390
|
+
"inheritedFrom": {
|
|
1391
|
+
"name": "InspectorMixin",
|
|
1392
|
+
"module": "../line-core/src/mixins/inspector.ts"
|
|
1393
|
+
}
|
|
1394
|
+
},
|
|
1395
|
+
{
|
|
1396
|
+
"kind": "method",
|
|
1397
|
+
"name": "#deactivateInspector",
|
|
1398
|
+
"privacy": "private",
|
|
1399
|
+
"return": {
|
|
1400
|
+
"type": {
|
|
1401
|
+
"text": "void"
|
|
1402
|
+
}
|
|
1403
|
+
},
|
|
1404
|
+
"description": "Remove the hotkey, tear down the dialog, drop host attributes, and remove\nthe dev-only hover-outline sheet so the active path leaks nothing.",
|
|
1405
|
+
"inheritedFrom": {
|
|
1406
|
+
"name": "InspectorMixin",
|
|
1407
|
+
"module": "../line-core/src/mixins/inspector.ts"
|
|
1408
|
+
}
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
"kind": "method",
|
|
1412
|
+
"name": "#inspectorRoot",
|
|
1413
|
+
"privacy": "private",
|
|
1414
|
+
"return": {
|
|
1415
|
+
"type": {
|
|
1416
|
+
"text": "ShadowRoot | null"
|
|
1417
|
+
}
|
|
1418
|
+
},
|
|
1419
|
+
"description": "The shadow root that carries `adoptedStyleSheets`, or `null`.",
|
|
1420
|
+
"inheritedFrom": {
|
|
1421
|
+
"name": "InspectorMixin",
|
|
1422
|
+
"module": "../line-core/src/mixins/inspector.ts"
|
|
1423
|
+
}
|
|
1424
|
+
},
|
|
1425
|
+
{
|
|
1426
|
+
"kind": "method",
|
|
1427
|
+
"name": "#adoptInspectorOutline",
|
|
1428
|
+
"privacy": "private",
|
|
1429
|
+
"return": {
|
|
1430
|
+
"type": {
|
|
1431
|
+
"text": "void"
|
|
1432
|
+
}
|
|
1433
|
+
},
|
|
1434
|
+
"description": "Append the singleton hover-outline sheet to the shadow root's\n`adoptedStyleSheets` (idempotent — never duplicated, never replaces the\narray). No-op when the sheet or root is unavailable.",
|
|
1435
|
+
"inheritedFrom": {
|
|
1436
|
+
"name": "InspectorMixin",
|
|
1437
|
+
"module": "../line-core/src/mixins/inspector.ts"
|
|
1438
|
+
}
|
|
1439
|
+
},
|
|
1440
|
+
{
|
|
1441
|
+
"kind": "method",
|
|
1442
|
+
"name": "#releaseInspectorOutline",
|
|
1443
|
+
"privacy": "private",
|
|
1444
|
+
"return": {
|
|
1445
|
+
"type": {
|
|
1446
|
+
"text": "void"
|
|
1447
|
+
}
|
|
1448
|
+
},
|
|
1449
|
+
"description": "Remove the singleton hover-outline sheet from the shadow root's\n`adoptedStyleSheets`, preserving every other adopted sheet.",
|
|
1450
|
+
"inheritedFrom": {
|
|
1451
|
+
"name": "InspectorMixin",
|
|
1452
|
+
"module": "../line-core/src/mixins/inspector.ts"
|
|
1453
|
+
}
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
"kind": "method",
|
|
1457
|
+
"name": "#inspectorVersion",
|
|
1458
|
+
"privacy": "private",
|
|
1459
|
+
"return": {
|
|
1460
|
+
"type": {
|
|
1461
|
+
"text": "string"
|
|
1462
|
+
}
|
|
1463
|
+
},
|
|
1464
|
+
"description": "Read the host's static `version`, defaulting to `''` when absent.",
|
|
1465
|
+
"inheritedFrom": {
|
|
1466
|
+
"name": "InspectorMixin",
|
|
1467
|
+
"module": "../line-core/src/mixins/inspector.ts"
|
|
1468
|
+
}
|
|
1469
|
+
},
|
|
1470
|
+
{
|
|
1471
|
+
"kind": "method",
|
|
1472
|
+
"name": "#inspectorDocs",
|
|
1473
|
+
"privacy": "private",
|
|
1474
|
+
"return": {
|
|
1475
|
+
"type": {
|
|
1476
|
+
"text": "string"
|
|
1477
|
+
}
|
|
1478
|
+
},
|
|
1479
|
+
"description": "Read the host's static `docs` URL defensively (D3 may not provide one).",
|
|
1480
|
+
"inheritedFrom": {
|
|
1481
|
+
"name": "InspectorMixin",
|
|
1482
|
+
"module": "../line-core/src/mixins/inspector.ts"
|
|
1483
|
+
}
|
|
1484
|
+
},
|
|
1485
|
+
{
|
|
1486
|
+
"kind": "method",
|
|
1487
|
+
"name": "#toggleInspectorPanel",
|
|
1488
|
+
"privacy": "private",
|
|
1489
|
+
"return": {
|
|
1490
|
+
"type": {
|
|
1491
|
+
"text": "void"
|
|
1492
|
+
}
|
|
1493
|
+
},
|
|
1494
|
+
"description": "Open the panel if closed, close it if already open.",
|
|
1495
|
+
"inheritedFrom": {
|
|
1496
|
+
"name": "InspectorMixin",
|
|
1497
|
+
"module": "../line-core/src/mixins/inspector.ts"
|
|
1498
|
+
}
|
|
1499
|
+
},
|
|
1500
|
+
{
|
|
1501
|
+
"kind": "method",
|
|
1502
|
+
"name": "#openInspectorPanel",
|
|
1503
|
+
"privacy": "private",
|
|
1504
|
+
"return": {
|
|
1505
|
+
"type": {
|
|
1506
|
+
"text": "void"
|
|
1507
|
+
}
|
|
1508
|
+
},
|
|
1509
|
+
"description": "Build (once) and open the `<dialog>` metadata panel in the shadow root.",
|
|
1510
|
+
"inheritedFrom": {
|
|
1511
|
+
"name": "InspectorMixin",
|
|
1512
|
+
"module": "../line-core/src/mixins/inspector.ts"
|
|
1513
|
+
}
|
|
1514
|
+
},
|
|
1515
|
+
{
|
|
1516
|
+
"kind": "field",
|
|
1517
|
+
"name": "#internals",
|
|
1518
|
+
"privacy": "private",
|
|
1519
|
+
"type": {
|
|
1520
|
+
"text": "ElementInternals"
|
|
1521
|
+
},
|
|
1522
|
+
"inheritedFrom": {
|
|
1523
|
+
"name": "LineElement",
|
|
1524
|
+
"module": "../line-core/src/line-element.ts"
|
|
1525
|
+
}
|
|
1526
|
+
},
|
|
1527
|
+
{
|
|
1528
|
+
"kind": "field",
|
|
1529
|
+
"name": "[INTERNALS]",
|
|
1530
|
+
"type": {
|
|
1531
|
+
"text": "ElementInternals"
|
|
1532
|
+
},
|
|
1533
|
+
"privacy": "protected",
|
|
1534
|
+
"description": "The element's `ElementInternals`, attached once in the constructor (spec §6.C.2, SD19).",
|
|
1535
|
+
"readonly": true,
|
|
1536
|
+
"inheritedFrom": {
|
|
1537
|
+
"name": "LineElement",
|
|
1538
|
+
"module": "../line-core/src/line-element.ts"
|
|
1539
|
+
}
|
|
1540
|
+
},
|
|
1541
|
+
{
|
|
1542
|
+
"kind": "method",
|
|
1543
|
+
"name": "reflectState",
|
|
1544
|
+
"privacy": "protected",
|
|
1545
|
+
"return": {
|
|
1546
|
+
"type": {
|
|
1547
|
+
"text": "void"
|
|
1548
|
+
}
|
|
1549
|
+
},
|
|
1550
|
+
"parameters": [
|
|
1551
|
+
{
|
|
1552
|
+
"name": "name",
|
|
1553
|
+
"type": {
|
|
1554
|
+
"text": "string"
|
|
1555
|
+
}
|
|
1556
|
+
},
|
|
1557
|
+
{
|
|
1558
|
+
"name": "active",
|
|
1559
|
+
"type": {
|
|
1560
|
+
"text": "boolean"
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
],
|
|
1564
|
+
"description": "Reflects machine state `name` on the host as the attribute `data-<name>`\nand the custom state `:state(<name>)`, both verbatim, so a kebab-case name\nsuch as `focus-visible` keeps its spelling. The custom state is skipped\nwhere the internals have no `states`.",
|
|
1565
|
+
"inheritedFrom": {
|
|
1566
|
+
"name": "LineElement",
|
|
1567
|
+
"module": "../line-core/src/line-element.ts"
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
],
|
|
1571
|
+
"attributes": [
|
|
1572
|
+
{
|
|
1573
|
+
"name": "orientation",
|
|
1574
|
+
"type": {
|
|
1575
|
+
"text": "SeparatorOrientation"
|
|
1576
|
+
},
|
|
1577
|
+
"description": "Direction of the line; an unknown value behaves as `horizontal`.",
|
|
1578
|
+
"default": "'horizontal'",
|
|
1579
|
+
"fieldName": "orientation"
|
|
1580
|
+
},
|
|
1581
|
+
{
|
|
1582
|
+
"name": "decorative",
|
|
1583
|
+
"type": {
|
|
1584
|
+
"text": "boolean"
|
|
1585
|
+
},
|
|
1586
|
+
"description": "Removes the separator from the accessibility tree (role `none`); the line still draws.",
|
|
1587
|
+
"default": "false",
|
|
1588
|
+
"fieldName": "decorative"
|
|
1589
|
+
}
|
|
1590
|
+
],
|
|
1591
|
+
"superclass": {
|
|
1592
|
+
"name": "LineElement",
|
|
1593
|
+
"package": "@websublime/line-core"
|
|
1594
|
+
},
|
|
1595
|
+
"summary": "A thin horizontal or vertical line that separates sections of content.",
|
|
1596
|
+
"tagName": "line-separator",
|
|
1597
|
+
"customElement": true
|
|
1598
|
+
}
|
|
1599
|
+
],
|
|
1600
|
+
"exports": [
|
|
1601
|
+
{
|
|
1602
|
+
"kind": "js",
|
|
1603
|
+
"name": "LineSeparator",
|
|
1604
|
+
"declaration": {
|
|
1605
|
+
"name": "LineSeparator",
|
|
1606
|
+
"module": "src/separator/separator.ts"
|
|
1607
|
+
}
|
|
1608
|
+
},
|
|
1609
|
+
{
|
|
1610
|
+
"kind": "custom-element-definition",
|
|
1611
|
+
"name": "line-separator",
|
|
1612
|
+
"declaration": {
|
|
1613
|
+
"name": "LineSeparator",
|
|
1614
|
+
"module": "src/separator/separator.ts"
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
]
|
|
1618
|
+
},
|
|
1619
|
+
{
|
|
1620
|
+
"kind": "javascript-module",
|
|
1621
|
+
"path": "src/separator/separator.types.ts",
|
|
1622
|
+
"declarations": [],
|
|
1623
|
+
"exports": []
|
|
1624
|
+
},
|
|
1180
1625
|
{
|
|
1181
1626
|
"kind": "javascript-module",
|
|
1182
1627
|
"path": "src/shared/button-machine.ts",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/separator/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { INTERNALS as e, LineElement as t } from "@websublime/line-core";
|
|
2
|
+
import { commonReset as n } from "@websublime/line-core/styles";
|
|
3
|
+
import { css as r } from "lit";
|
|
4
|
+
//#region src/separator/separator.ts
|
|
5
|
+
var i = { fromAttribute: (e) => e === "vertical" ? "vertical" : "horizontal" }, a = class extends t {
|
|
6
|
+
static {
|
|
7
|
+
this.properties = {
|
|
8
|
+
orientation: {
|
|
9
|
+
reflect: !0,
|
|
10
|
+
useDefault: !0,
|
|
11
|
+
converter: i
|
|
12
|
+
},
|
|
13
|
+
decorative: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
reflect: !0,
|
|
16
|
+
useDefault: !0
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
static {
|
|
21
|
+
this.styles = [n, r`
|
|
22
|
+
:host {
|
|
23
|
+
--line-separator-color: var(--line-gray-6, currentColor);
|
|
24
|
+
--line-separator-thickness: var(--line-border-1, 1px);
|
|
25
|
+
|
|
26
|
+
display: block;
|
|
27
|
+
align-self: stretch;
|
|
28
|
+
flex-shrink: 0;
|
|
29
|
+
border-block-start-style: solid;
|
|
30
|
+
border-block-start-width: var(--line-separator-thickness);
|
|
31
|
+
border-block-start-color: var(--line-separator-color);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([hidden]) {
|
|
35
|
+
display: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host([orientation='vertical']) {
|
|
39
|
+
inline-size: 0;
|
|
40
|
+
min-block-size: 1em;
|
|
41
|
+
border-block-start-style: none;
|
|
42
|
+
border-block-start-width: 0;
|
|
43
|
+
border-inline-start-style: solid;
|
|
44
|
+
border-inline-start-width: var(--line-separator-thickness);
|
|
45
|
+
border-inline-start-color: var(--line-separator-color);
|
|
46
|
+
}
|
|
47
|
+
`];
|
|
48
|
+
}
|
|
49
|
+
constructor() {
|
|
50
|
+
super(), this.orientation = "horizontal", this.decorative = !1;
|
|
51
|
+
}
|
|
52
|
+
willUpdate(t) {
|
|
53
|
+
if (super.willUpdate(t), this.hasUpdated && !t.has("orientation") && !t.has("decorative")) return;
|
|
54
|
+
let n = this[e];
|
|
55
|
+
n.role = this.decorative ? "none" : "separator", n.ariaOrientation = !this.decorative && this.orientation === "vertical" ? "vertical" : null;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
customElements.define("line-separator", a);
|
|
59
|
+
//#endregion
|
|
60
|
+
export { a as LineSeparator };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["orientationConverter","value","LineSeparator","LineElement","commonReset","changed","internals","INTERNALS"],"sources":["../../src/separator/separator.ts"],"sourcesContent":["import { INTERNALS, LineElement } from '@websublime/line-core';\nimport { commonReset } from '@websublime/line-core/styles';\nimport { type ComplexAttributeConverter, css, type PropertyDeclarations } from 'lit';\nimport type { SeparatorOrientation } from './separator.types.js';\n\n/** An unknown `orientation` behaves as `horizontal`; the attribute keeps what the author wrote (C8). */\nconst orientationConverter: ComplexAttributeConverter<SeparatorOrientation> = {\n fromAttribute: (value) => (value === 'vertical' ? 'vertical' : 'horizontal'),\n};\n\n/**\n * `<line-separator>` draws a thin line between sections of content. The host\n * is the line and the shadow root renders nothing. The host carries the\n * `separator` role and its orientation as `ElementInternals` defaults, so an\n * author `role` or `aria-*` attribute wins, and a host `aria-label` names it.\n * `decorative` sets the role to `none`, so assistive technology skips the\n * line; give a decorative separator no `aria-label`. It adds no spacing.\n *\n * @summary A thin horizontal or vertical line that separates sections of content.\n *\n * @cssprop [--line-separator-color=var(--line-gray-6, currentColor)] - Colour of the line.\n * @cssprop [--line-separator-thickness=var(--line-border-1, 1px)] - Thickness of the line.\n */\nexport class LineSeparator extends LineElement {\n static override properties: PropertyDeclarations = {\n orientation: { reflect: true, useDefault: true, converter: orientationConverter },\n decorative: { type: Boolean, reflect: true, useDefault: true },\n };\n\n // The line is one border side set through longhands: forced-colors mode keeps a border colour visible,\n // and an invalid var() in a shorthand would reset border-style to none (spec 0011-separator.md Drawing).\n static override styles = [\n commonReset,\n css`\n :host {\n --line-separator-color: var(--line-gray-6, currentColor);\n --line-separator-thickness: var(--line-border-1, 1px);\n\n display: block;\n align-self: stretch;\n flex-shrink: 0;\n border-block-start-style: solid;\n border-block-start-width: var(--line-separator-thickness);\n border-block-start-color: var(--line-separator-color);\n }\n\n :host([hidden]) {\n display: none;\n }\n\n :host([orientation='vertical']) {\n inline-size: 0;\n min-block-size: 1em;\n border-block-start-style: none;\n border-block-start-width: 0;\n border-inline-start-style: solid;\n border-inline-start-width: var(--line-separator-thickness);\n border-inline-start-color: var(--line-separator-color);\n }\n `,\n ];\n\n /** Direction of the line; an unknown value behaves as `horizontal`. */\n declare orientation: SeparatorOrientation;\n /** Removes the separator from the accessibility tree (role `none`); the line still draws. */\n declare decorative: boolean;\n\n constructor() {\n super();\n // `useDefault` keeps these initial values out of the attributes, so an unknown author value stays (C8).\n this.orientation = 'horizontal';\n this.decorative = false;\n }\n\n protected override willUpdate(changed: Map<PropertyKey, unknown>): void {\n super.willUpdate(changed);\n // Lit leaves `useDefault` initial values out of the first `changed` map, so the first update always writes.\n if (this.hasUpdated && !changed.has('orientation') && !changed.has('decorative')) {\n return;\n }\n const internals = this[INTERNALS];\n internals.role = this.decorative ? 'none' : 'separator';\n internals.ariaOrientation = !this.decorative && this.orientation === 'vertical' ? 'vertical' : null;\n }\n}\n\ncustomElements.define('line-separator', LineSeparator);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'line-separator': LineSeparator;\n }\n}\n"],"mappings":";;;;AAMA,IAAMA,IAAwE,EAC5E,gBAAgB,MAAWC,MAAU,aAAa,aAAa,aACjE,GAeaC,IAAb,cAAmCC,EAAY;;EACM,KAAA,aAAA;GACjD,aAAa;IAAE,SAAS;IAAM,YAAY;IAAM,WAAWH;GAAqB;GAChF,YAAY;IAAE,MAAM;IAAS,SAAS;IAAM,YAAY;GAAK;EAC/D;;;EAIyB,KAAA,SAAA,CACvBI,GACA,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BL;;CAOA,cAAc;EAIZ,AAHA,MAAM,GAEN,KAAK,cAAc,cACnB,KAAK,aAAa;CACpB;CAEA,WAA8B,GAA0C;EAGtE,IAFA,MAAM,WAAWC,CAAO,GAEpB,KAAK,cAAc,CAACA,EAAQ,IAAI,aAAa,KAAK,CAACA,EAAQ,IAAI,YAAY,GAC7E;EAEF,IAAMC,IAAY,KAAKC;EAEvB,AADA,EAAU,OAAO,KAAK,aAAa,SAAS,aAC5C,EAAU,kBAAkB,CAAC,KAAK,cAAc,KAAK,gBAAgB,aAAa,aAAa;CACjG;AACF;AAEA,eAAe,OAAO,kBAAkBL,CAAa"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { LineElement } from '@websublime/line-core';
|
|
2
|
+
import { type PropertyDeclarations } from 'lit';
|
|
3
|
+
import type { SeparatorOrientation } from './separator.types.js';
|
|
4
|
+
/**
|
|
5
|
+
* `<line-separator>` draws a thin line between sections of content. The host
|
|
6
|
+
* is the line and the shadow root renders nothing. The host carries the
|
|
7
|
+
* `separator` role and its orientation as `ElementInternals` defaults, so an
|
|
8
|
+
* author `role` or `aria-*` attribute wins, and a host `aria-label` names it.
|
|
9
|
+
* `decorative` sets the role to `none`, so assistive technology skips the
|
|
10
|
+
* line; give a decorative separator no `aria-label`. It adds no spacing.
|
|
11
|
+
*
|
|
12
|
+
* @summary A thin horizontal or vertical line that separates sections of content.
|
|
13
|
+
*
|
|
14
|
+
* @cssprop [--line-separator-color=var(--line-gray-6, currentColor)] - Colour of the line.
|
|
15
|
+
* @cssprop [--line-separator-thickness=var(--line-border-1, 1px)] - Thickness of the line.
|
|
16
|
+
*/
|
|
17
|
+
export declare class LineSeparator extends LineElement {
|
|
18
|
+
static properties: PropertyDeclarations;
|
|
19
|
+
static styles: (import("lit").CSSResult | CSSStyleSheet)[];
|
|
20
|
+
/** Direction of the line; an unknown value behaves as `horizontal`. */
|
|
21
|
+
orientation: SeparatorOrientation;
|
|
22
|
+
/** Removes the separator from the accessibility tree (role `none`); the line still draws. */
|
|
23
|
+
decorative: boolean;
|
|
24
|
+
constructor();
|
|
25
|
+
protected willUpdate(changed: Map<PropertyKey, unknown>): void;
|
|
26
|
+
}
|
|
27
|
+
declare global {
|
|
28
|
+
interface HTMLElementTagNameMap {
|
|
29
|
+
'line-separator': LineSeparator;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=separator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"separator.d.ts","sourceRoot":"","sources":["../../src/separator/separator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAuC,KAAK,oBAAoB,EAAE,MAAM,KAAK,CAAC;AACrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAOjE;;;;;;;;;;;;GAYG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAC5C,OAAgB,UAAU,EAAE,oBAAoB,CAG9C;IAIF,OAAgB,MAAM,8CA6BpB;IAEF,uEAAuE;IAC/D,WAAW,EAAE,oBAAoB,CAAC;IAC1C,6FAA6F;IACrF,UAAU,EAAE,OAAO,CAAC;IAE5B,cAKC;IAED,UAAmB,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,IAAI,CAStE;CACF;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAC;KACjC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"separator.types.d.ts","sourceRoot":"","sources":["../../src/separator/separator.types.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@websublime/line-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"types": "./dist/button/index.d.ts",
|
|
28
28
|
"import": "./dist/button/index.js"
|
|
29
29
|
},
|
|
30
|
+
"./separator": {
|
|
31
|
+
"types": "./dist/separator/index.d.ts",
|
|
32
|
+
"import": "./dist/separator/index.js"
|
|
33
|
+
},
|
|
30
34
|
"./stack": {
|
|
31
35
|
"types": "./dist/stack/index.d.ts",
|
|
32
36
|
"import": "./dist/stack/index.js"
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// biome-ignore lint/performance/noBarrelFile: the `./separator` subpath entry registers `line-separator` and exposes its class and types (spec 0011-separator.md Bundle).
|
|
2
|
+
export { LineSeparator } from './separator.js';
|
|
3
|
+
export type { SeparatorOrientation } from './separator.types.js';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { INTERNALS, LineElement } from '@websublime/line-core';
|
|
2
|
+
import { commonReset } from '@websublime/line-core/styles';
|
|
3
|
+
import { type ComplexAttributeConverter, css, type PropertyDeclarations } from 'lit';
|
|
4
|
+
import type { SeparatorOrientation } from './separator.types.js';
|
|
5
|
+
|
|
6
|
+
/** An unknown `orientation` behaves as `horizontal`; the attribute keeps what the author wrote (C8). */
|
|
7
|
+
const orientationConverter: ComplexAttributeConverter<SeparatorOrientation> = {
|
|
8
|
+
fromAttribute: (value) => (value === 'vertical' ? 'vertical' : 'horizontal'),
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* `<line-separator>` draws a thin line between sections of content. The host
|
|
13
|
+
* is the line and the shadow root renders nothing. The host carries the
|
|
14
|
+
* `separator` role and its orientation as `ElementInternals` defaults, so an
|
|
15
|
+
* author `role` or `aria-*` attribute wins, and a host `aria-label` names it.
|
|
16
|
+
* `decorative` sets the role to `none`, so assistive technology skips the
|
|
17
|
+
* line; give a decorative separator no `aria-label`. It adds no spacing.
|
|
18
|
+
*
|
|
19
|
+
* @summary A thin horizontal or vertical line that separates sections of content.
|
|
20
|
+
*
|
|
21
|
+
* @cssprop [--line-separator-color=var(--line-gray-6, currentColor)] - Colour of the line.
|
|
22
|
+
* @cssprop [--line-separator-thickness=var(--line-border-1, 1px)] - Thickness of the line.
|
|
23
|
+
*/
|
|
24
|
+
export class LineSeparator extends LineElement {
|
|
25
|
+
static override properties: PropertyDeclarations = {
|
|
26
|
+
orientation: { reflect: true, useDefault: true, converter: orientationConverter },
|
|
27
|
+
decorative: { type: Boolean, reflect: true, useDefault: true },
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// The line is one border side set through longhands: forced-colors mode keeps a border colour visible,
|
|
31
|
+
// and an invalid var() in a shorthand would reset border-style to none (spec 0011-separator.md Drawing).
|
|
32
|
+
static override styles = [
|
|
33
|
+
commonReset,
|
|
34
|
+
css`
|
|
35
|
+
:host {
|
|
36
|
+
--line-separator-color: var(--line-gray-6, currentColor);
|
|
37
|
+
--line-separator-thickness: var(--line-border-1, 1px);
|
|
38
|
+
|
|
39
|
+
display: block;
|
|
40
|
+
align-self: stretch;
|
|
41
|
+
flex-shrink: 0;
|
|
42
|
+
border-block-start-style: solid;
|
|
43
|
+
border-block-start-width: var(--line-separator-thickness);
|
|
44
|
+
border-block-start-color: var(--line-separator-color);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:host([hidden]) {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([orientation='vertical']) {
|
|
52
|
+
inline-size: 0;
|
|
53
|
+
min-block-size: 1em;
|
|
54
|
+
border-block-start-style: none;
|
|
55
|
+
border-block-start-width: 0;
|
|
56
|
+
border-inline-start-style: solid;
|
|
57
|
+
border-inline-start-width: var(--line-separator-thickness);
|
|
58
|
+
border-inline-start-color: var(--line-separator-color);
|
|
59
|
+
}
|
|
60
|
+
`,
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
/** Direction of the line; an unknown value behaves as `horizontal`. */
|
|
64
|
+
declare orientation: SeparatorOrientation;
|
|
65
|
+
/** Removes the separator from the accessibility tree (role `none`); the line still draws. */
|
|
66
|
+
declare decorative: boolean;
|
|
67
|
+
|
|
68
|
+
constructor() {
|
|
69
|
+
super();
|
|
70
|
+
// `useDefault` keeps these initial values out of the attributes, so an unknown author value stays (C8).
|
|
71
|
+
this.orientation = 'horizontal';
|
|
72
|
+
this.decorative = false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
protected override willUpdate(changed: Map<PropertyKey, unknown>): void {
|
|
76
|
+
super.willUpdate(changed);
|
|
77
|
+
// Lit leaves `useDefault` initial values out of the first `changed` map, so the first update always writes.
|
|
78
|
+
if (this.hasUpdated && !changed.has('orientation') && !changed.has('decorative')) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const internals = this[INTERNALS];
|
|
82
|
+
internals.role = this.decorative ? 'none' : 'separator';
|
|
83
|
+
internals.ariaOrientation = !this.decorative && this.orientation === 'vertical' ? 'vertical' : null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
customElements.define('line-separator', LineSeparator);
|
|
88
|
+
|
|
89
|
+
declare global {
|
|
90
|
+
interface HTMLElementTagNameMap {
|
|
91
|
+
'line-separator': LineSeparator;
|
|
92
|
+
}
|
|
93
|
+
}
|