loseta 0.4.0 → 0.6.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.
Files changed (84) hide show
  1. package/README.md +13 -5
  2. package/dist/add-policy.d.ts +15 -0
  3. package/dist/add-policy.js +53 -0
  4. package/dist/add-policy.js.map +1 -0
  5. package/dist/commands/add.d.ts +4 -0
  6. package/dist/commands/add.js +24 -20
  7. package/dist/commands/add.js.map +1 -1
  8. package/dist/commands/list.d.ts +6 -1
  9. package/dist/commands/list.js +23 -5
  10. package/dist/commands/list.js.map +1 -1
  11. package/dist/registry.d.ts +2 -0
  12. package/dist/registry.js +6 -0
  13. package/dist/registry.js.map +1 -1
  14. package/dist/style-switch.js +11 -0
  15. package/dist/style-switch.js.map +1 -1
  16. package/package.json +1 -1
  17. package/registry/components/accordion.css +65 -0
  18. package/registry/components/aspect-ratio.css +25 -0
  19. package/registry/components/avatar.css +54 -0
  20. package/registry/components/breadcrumb.css +57 -0
  21. package/registry/components/context-menu.css +29 -0
  22. package/registry/components/drawer.css +26 -0
  23. package/registry/components/dropdown-menu.css +1 -84
  24. package/registry/components/hover-card.css +18 -0
  25. package/registry/components/menubar.css +52 -0
  26. package/registry/components/navigation-menu.css +35 -0
  27. package/registry/components/pagination.css +49 -0
  28. package/registry/components/progress.css +13 -0
  29. package/registry/components/separator.css +12 -0
  30. package/registry/components/sheet.css +21 -0
  31. package/registry/components/spinner.css +8 -0
  32. package/registry/components/toggle-group.css +17 -0
  33. package/registry/components/toggle.css +31 -0
  34. package/registry/examples/accordion.html +56 -0
  35. package/registry/examples/aspect-ratio.html +9 -0
  36. package/registry/examples/avatar.html +21 -0
  37. package/registry/examples/breadcrumb.html +23 -0
  38. package/registry/examples/context-menu.html +10 -0
  39. package/registry/examples/drawer.html +46 -0
  40. package/registry/examples/hover-card.html +13 -0
  41. package/registry/examples/menubar.html +43 -0
  42. package/registry/examples/navigation-menu.html +58 -0
  43. package/registry/examples/pagination.html +39 -0
  44. package/registry/examples/progress.html +5 -0
  45. package/registry/examples/separator.html +15 -0
  46. package/registry/examples/sheet.html +42 -0
  47. package/registry/examples/spinner.html +12 -0
  48. package/registry/examples/toggle-group.html +13 -0
  49. package/registry/examples/toggle.html +13 -0
  50. package/registry/primitives/dialog-shell.css +54 -1
  51. package/registry/primitives/menu.css +87 -0
  52. package/registry/registry.json +573 -2
  53. package/registry/styles/luma/dropdown-menu.css +0 -96
  54. package/registry/styles/luma/primitives/menu.css +104 -0
  55. package/registry/styles/lyra/dropdown-menu.css +0 -96
  56. package/registry/styles/lyra/primitives/menu.css +104 -0
  57. package/registry/styles/maia/dropdown-menu.css +0 -96
  58. package/registry/styles/maia/primitives/menu.css +104 -0
  59. package/registry/styles/mira/dropdown-menu.css +0 -97
  60. package/registry/styles/mira/primitives/menu.css +105 -0
  61. package/registry/styles/nova/accordion.css +59 -0
  62. package/registry/styles/nova/aspect-ratio.css +6 -0
  63. package/registry/styles/nova/avatar.css +89 -0
  64. package/registry/styles/nova/breadcrumb.css +61 -0
  65. package/registry/styles/nova/context-menu.css +19 -0
  66. package/registry/styles/nova/drawer.css +60 -0
  67. package/registry/styles/nova/dropdown-menu.css +0 -96
  68. package/registry/styles/nova/hover-card.css +22 -0
  69. package/registry/styles/nova/menubar.css +48 -0
  70. package/registry/styles/nova/navigation-menu.css +79 -0
  71. package/registry/styles/nova/pagination.css +46 -0
  72. package/registry/styles/nova/primitives/menu.css +104 -0
  73. package/registry/styles/nova/progress.css +67 -0
  74. package/registry/styles/nova/separator.css +14 -0
  75. package/registry/styles/nova/sheet.css +54 -0
  76. package/registry/styles/nova/spinner.css +35 -0
  77. package/registry/styles/nova/toggle-group.css +48 -0
  78. package/registry/styles/nova/toggle.css +110 -0
  79. package/registry/styles/rhea/dropdown-menu.css +0 -97
  80. package/registry/styles/rhea/primitives/menu.css +105 -0
  81. package/registry/styles/sera/dropdown-menu.css +0 -96
  82. package/registry/styles/sera/primitives/menu.css +104 -0
  83. package/registry/styles/vega/dropdown-menu.css +0 -96
  84. package/registry/styles/vega/primitives/menu.css +104 -0
@@ -0,0 +1,58 @@
1
+ <!-- Default -->
2
+ <div style="display: flex; justify-content: center; min-height: 18rem; padding-top: 1rem">
3
+ <nav class="navigation-menu" aria-label="Main">
4
+ <ul>
5
+ <li>
6
+ <button type="button" aria-expanded="false" aria-controls="nav-products">
7
+ Products
8
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
9
+ </button>
10
+ <div data-popover data-side="bottom" aria-hidden="true" id="nav-products">
11
+ <ul>
12
+ <li>
13
+ <a href="#">
14
+ <span data-slot="title">Components</span>
15
+ <span data-slot="description">Copy-paste CSS components.</span>
16
+ </a>
17
+ </li>
18
+ <li>
19
+ <a href="#">
20
+ <span data-slot="title">Styles</span>
21
+ <span data-slot="description">Eight visual interpretations.</span>
22
+ </a>
23
+ </li>
24
+ <li>
25
+ <a href="#">
26
+ <span data-slot="title">CLI</span>
27
+ <span data-slot="description">Install only what you use.</span>
28
+ </a>
29
+ </li>
30
+ </ul>
31
+ </div>
32
+ </li>
33
+ <li>
34
+ <button type="button" aria-expanded="false" aria-controls="nav-resources">
35
+ Resources
36
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
37
+ </button>
38
+ <div data-popover data-side="bottom" aria-hidden="true" id="nav-resources">
39
+ <ul>
40
+ <li>
41
+ <a href="#">
42
+ <span data-slot="title">Docs</span>
43
+ <span data-slot="description">Installation and component contracts.</span>
44
+ </a>
45
+ </li>
46
+ <li>
47
+ <a href="#">
48
+ <span data-slot="title">GitHub</span>
49
+ <span data-slot="description">Source and issue tracker.</span>
50
+ </a>
51
+ </li>
52
+ </ul>
53
+ </div>
54
+ </li>
55
+ <li><a href="#">Docs</a></li>
56
+ </ul>
57
+ </nav>
58
+ </div>
@@ -0,0 +1,39 @@
1
+ <!-- Default -->
2
+ <nav class="pagination" aria-label="pagination">
3
+ <ul>
4
+ <li>
5
+ <a class="btn" data-variant="ghost" data-size="icon" href="#" aria-label="Go to previous page"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg></a>
6
+ </li>
7
+ <li><a class="btn" data-variant="ghost" href="#" aria-current="page">1</a></li>
8
+ <li><a class="btn" data-variant="ghost" href="#">2</a></li>
9
+ <li><a class="btn" data-variant="ghost" href="#">3</a></li>
10
+ <li>
11
+ <a class="btn" data-variant="ghost" data-size="icon" href="#" aria-label="Go to next page"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></a>
12
+ </li>
13
+ </ul>
14
+ </nav>
15
+
16
+ <!-- With ellipsis -->
17
+ <nav class="pagination" aria-label="pagination">
18
+ <ul>
19
+ <li>
20
+ <a class="btn" data-variant="ghost" href="#" aria-label="Go to previous page">
21
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg>
22
+ <span data-slot="label" aria-hidden="true">Previous</span>
23
+ </a>
24
+ </li>
25
+ <li><a class="btn" data-variant="ghost" href="#">1</a></li>
26
+ <li><a class="btn" data-variant="ghost" href="#">2</a></li>
27
+ <li><a class="btn" data-variant="ghost" href="#">3</a></li>
28
+ <li><span data-slot="ellipsis" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/></svg></span></li>
29
+ <li><a class="btn" data-variant="ghost" href="#">8</a></li>
30
+ <li><a class="btn" data-variant="ghost" href="#">9</a></li>
31
+ <li><a class="btn" data-variant="ghost" href="#" aria-current="page">10</a></li>
32
+ <li>
33
+ <a class="btn" data-variant="ghost" href="#" aria-label="Go to next page">
34
+ <span data-slot="label" aria-hidden="true">Next</span>
35
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>
36
+ </a>
37
+ </li>
38
+ </ul>
39
+ </nav>
@@ -0,0 +1,5 @@
1
+ <!-- Determinate -->
2
+ <progress class="progress" value="60" max="100" aria-label="Upload progress">60%</progress>
3
+
4
+ <!-- Indeterminate -->
5
+ <progress class="progress" max="100" aria-label="Loading">Loading…</progress>
@@ -0,0 +1,15 @@
1
+ <!-- Horizontal -->
2
+ <div style="display: grid; gap: 0.75rem">
3
+ <p>loseta components</p>
4
+ <hr class="separator" />
5
+ <p>Native CSS with copy-paste distribution.</p>
6
+ </div>
7
+
8
+ <!-- Vertical -->
9
+ <div style="display: flex; align-items: center; gap: 1rem; height: 1.5rem">
10
+ <span>Blog</span>
11
+ <div class="separator" role="separator" aria-orientation="vertical" data-orientation="vertical"></div>
12
+ <span>Docs</span>
13
+ <div class="separator" role="separator" aria-orientation="vertical" data-orientation="vertical"></div>
14
+ <span>Source</span>
15
+ </div>
@@ -0,0 +1,42 @@
1
+ <!-- Right -->
2
+ <button type="button" class="btn" data-variant="outline">
3
+ Open sheet
4
+ </button>
5
+
6
+ <dialog class="sheet" id="demo-sheet" data-side="inline-end" aria-labelledby="sheet-title" aria-describedby="sheet-description">
7
+ <div>
8
+ <header>
9
+ <h2 data-slot="title" id="sheet-title">Edit profile</h2>
10
+ <p data-slot="description" id="sheet-description">Make changes to your profile here.</p>
11
+ </header>
12
+ <section>
13
+ <div class="field">
14
+ <label class="label" for="sheet-name">Name</label>
15
+ <input class="input" id="sheet-name" value="Ada Lovelace">
16
+ </div>
17
+ </section>
18
+ <footer>
19
+ <button type="button" class="btn" data-variant="outline">Cancel</button>
20
+ <button type="button" class="btn">Save changes</button>
21
+ </footer>
22
+ </div>
23
+ </dialog>
24
+
25
+ <!-- Left, small -->
26
+ <button type="button" class="btn" data-variant="outline">
27
+ Open left sheet
28
+ </button>
29
+
30
+ <dialog class="sheet" id="demo-sheet-left" data-side="inline-start" data-size="sm" aria-labelledby="sheet-left-title">
31
+ <div>
32
+ <header>
33
+ <h2 data-slot="title" id="sheet-left-title">Navigation</h2>
34
+ </header>
35
+ <section>
36
+ <p>Use the left sheet for navigation or secondary controls.</p>
37
+ </section>
38
+ <footer>
39
+ <button type="button" class="btn" data-variant="outline">Close</button>
40
+ </footer>
41
+ </div>
42
+ </dialog>
@@ -0,0 +1,12 @@
1
+ <!-- Sizes -->
2
+ <div style="display: flex; align-items: center; gap: 1rem">
3
+ <span class="spinner" data-size="sm" role="status"><span class="sr-only">Loading</span></span>
4
+ <span class="spinner" role="status"><span class="sr-only">Loading</span></span>
5
+ <span class="spinner" data-size="lg" role="status"><span class="sr-only">Loading</span></span>
6
+ </div>
7
+
8
+ <!-- With a label -->
9
+ <div style="display: flex; align-items: center; gap: 0.5rem">
10
+ <span class="spinner" data-size="sm" aria-hidden="true"></span>
11
+ <span>Loading results…</span>
12
+ </div>
@@ -0,0 +1,13 @@
1
+ <!-- Joined -->
2
+ <div class="toggle-group" role="group" aria-label="Text alignment" data-spacing="joined">
3
+ <button type="button" class="toggle" aria-pressed="true" aria-label="Align left"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="21" x2="3" y1="6" y2="6"/><line x1="15" x2="3" y1="12" y2="12"/><line x1="17" x2="3" y1="18" y2="18"/></svg></button>
4
+ <button type="button" class="toggle" aria-pressed="false" aria-label="Align center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="21" x2="3" y1="6" y2="6"/><line x1="17" x2="7" y1="12" y2="12"/><line x1="19" x2="5" y1="18" y2="18"/></svg></button>
5
+ <button type="button" class="toggle" aria-pressed="false" aria-label="Align right"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="21" x2="3" y1="6" y2="6"/><line x1="21" x2="9" y1="12" y2="12"/><line x1="21" x2="7" y1="18" y2="18"/></svg></button>
6
+ </div>
7
+
8
+ <!-- Vertical outline -->
9
+ <div class="toggle-group" role="group" aria-label="View density" data-orientation="vertical" data-variant="outline" data-size="sm">
10
+ <button type="button" class="toggle" aria-pressed="true">Compact</button>
11
+ <button type="button" class="toggle" aria-pressed="false">Default</button>
12
+ <button type="button" class="toggle" aria-pressed="false">Comfortable</button>
13
+ </div>
@@ -0,0 +1,13 @@
1
+ <!-- Variants -->
2
+ <div style="display: flex; flex-wrap: wrap; gap: 0.5rem">
3
+ <button type="button" class="toggle" aria-pressed="false">Bold</button>
4
+ <button type="button" class="toggle" data-variant="outline" aria-pressed="true">Italic</button>
5
+ <button type="button" class="toggle" data-variant="outline" aria-pressed="false" disabled>Underline</button>
6
+ </div>
7
+
8
+ <!-- Sizes -->
9
+ <div style="display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem">
10
+ <button type="button" class="toggle" data-size="sm" aria-pressed="false">Small</button>
11
+ <button type="button" class="toggle" aria-pressed="false">Default</button>
12
+ <button type="button" class="toggle" data-size="lg" aria-pressed="false">Large</button>
13
+ </div>
@@ -1,7 +1,9 @@
1
1
  /* Dialog shell */
2
2
  @layer loseta.components {
3
3
  .dialog,
4
- .alert-dialog {
4
+ .alert-dialog,
5
+ .sheet,
6
+ .drawer {
5
7
  background-color: transparent;
6
8
  padding: 0;
7
9
  color: inherit;
@@ -67,5 +69,56 @@
67
69
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
68
70
  transition-duration: 150ms;
69
71
  }
72
+
73
+ &[data-side='inline-start'],
74
+ &[data-side='inline-end'] {
75
+ > * {
76
+ top: 0;
77
+ bottom: 0;
78
+ left: auto;
79
+ right: auto;
80
+ height: 100%;
81
+ max-height: none;
82
+ width: var(--sheet-width, 24rem);
83
+ max-width: 100%;
84
+ translate: 0 0;
85
+ }
86
+ }
87
+
88
+ &[data-side='inline-start'] > * {
89
+ inset-inline-start: 0;
90
+ inset-inline-end: auto;
91
+ }
92
+
93
+ &[data-side='inline-end'] > * {
94
+ inset-inline-end: 0;
95
+ inset-inline-start: auto;
96
+ }
97
+
98
+ &[data-side='block-start'],
99
+ &[data-side='block-end'] {
100
+ > * {
101
+ left: 0;
102
+ right: 0;
103
+ top: 0;
104
+ bottom: 0;
105
+ width: 100%;
106
+ max-width: none;
107
+ height: auto;
108
+ translate: 0 0;
109
+ }
110
+ }
111
+
112
+ &[data-side='block-start'] > * {
113
+ inset-block-start: 0;
114
+ inset-block-end: auto;
115
+ max-height: var(--drawer-height, 80vh);
116
+ }
117
+
118
+ &[data-side='block-end'] > * {
119
+ inset-block-end: 0;
120
+ inset-block-start: auto;
121
+ max-height: var(--drawer-height, 80vh);
122
+ }
70
123
  }
71
124
  }
@@ -0,0 +1,87 @@
1
+ /* Menu primitive */
2
+ @layer loseta.components {
3
+ [role='menu'] {
4
+ display: flex;
5
+ flex-direction: column;
6
+ outline-style: none;
7
+
8
+ @media (forced-colors: active) {
9
+ outline: 2px solid transparent;
10
+ outline-offset: 2px;
11
+ }
12
+ }
13
+
14
+ [role='menu'] :is([role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio']) {
15
+ position: relative;
16
+ display: flex;
17
+ width: 100%;
18
+ cursor: default;
19
+ align-items: center;
20
+ white-space: normal;
21
+ outline-style: none;
22
+ -webkit-user-select: none;
23
+ user-select: none;
24
+
25
+ @media (forced-colors: active) {
26
+ outline: 2px solid transparent;
27
+ outline-offset: 2px;
28
+ }
29
+
30
+ &:disabled {
31
+ pointer-events: none;
32
+ opacity: 50%;
33
+ }
34
+
35
+ &[aria-disabled='true'] {
36
+ pointer-events: none;
37
+ opacity: 50%;
38
+ }
39
+
40
+ &[aria-hidden='true'] {
41
+ display: none;
42
+ }
43
+
44
+ & svg {
45
+ pointer-events: none;
46
+ flex-shrink: 0;
47
+ }
48
+ }
49
+
50
+ [role='menu'] [role='heading'] {
51
+ display: flex;
52
+ }
53
+
54
+ [role='menu'] [role='separator'] {
55
+ border-style: solid;
56
+ border-width: 0;
57
+ }
58
+
59
+ [role='menu'] :is([data-slot='shortcut'], kbd:last-child, .kbd:last-child) {
60
+ margin-inline-start: auto;
61
+ flex-shrink: 0;
62
+ text-align: end;
63
+ }
64
+
65
+ [role='menu'] [data-slot='shortcut'] {
66
+ padding-inline-start: 2rem;
67
+ }
68
+
69
+ [role='menu'] :is(kbd:last-child, .kbd:last-child):not([data-slot='shortcut']) {
70
+ padding-inline-start: 2rem;
71
+ }
72
+
73
+ [role='menu'] [data-slot='indicator'] {
74
+ pointer-events: none;
75
+ visibility: hidden;
76
+ }
77
+
78
+ [role='menu'] :is([role='menuitemcheckbox'], [role='menuitemradio'])[aria-checked='true'] [data-slot='indicator'] {
79
+ visibility: visible;
80
+ }
81
+
82
+ [role='menu'] [data-rtl-flip] {
83
+ &:where(:dir(rtl), [dir='rtl'], [dir='rtl'] *) {
84
+ rotate: 180deg;
85
+ }
86
+ }
87
+ }