loseta 0.3.0 → 0.5.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 (153) hide show
  1. package/README.md +15 -6
  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 +26 -26
  7. package/dist/commands/add.js.map +1 -1
  8. package/dist/commands/init.js +17 -7
  9. package/dist/commands/init.js.map +1 -1
  10. package/dist/commands/list.d.ts +6 -1
  11. package/dist/commands/list.js +23 -5
  12. package/dist/commands/list.js.map +1 -1
  13. package/dist/commands/style.js +14 -37
  14. package/dist/commands/style.js.map +1 -1
  15. package/dist/registry.d.ts +2 -0
  16. package/dist/registry.js +6 -0
  17. package/dist/registry.js.map +1 -1
  18. package/dist/style-selection.d.ts +32 -0
  19. package/dist/style-selection.js +52 -0
  20. package/dist/style-selection.js.map +1 -0
  21. package/dist/style-switch.d.ts +37 -0
  22. package/dist/style-switch.js +81 -0
  23. package/dist/style-switch.js.map +1 -0
  24. package/package.json +2 -1
  25. package/registry/components/accordion.css +65 -0
  26. package/registry/components/aspect-ratio.css +25 -0
  27. package/registry/components/avatar.css +54 -0
  28. package/registry/components/breadcrumb.css +57 -0
  29. package/registry/components/pagination.css +49 -0
  30. package/registry/components/progress.css +13 -0
  31. package/registry/components/separator.css +12 -0
  32. package/registry/components/spinner.css +8 -0
  33. package/registry/components/toggle-group.css +17 -0
  34. package/registry/components/toggle.css +31 -0
  35. package/registry/examples/accordion.html +56 -0
  36. package/registry/examples/aspect-ratio.html +9 -0
  37. package/registry/examples/avatar.html +21 -0
  38. package/registry/examples/breadcrumb.html +23 -0
  39. package/registry/examples/pagination.html +39 -0
  40. package/registry/examples/progress.html +5 -0
  41. package/registry/examples/separator.html +15 -0
  42. package/registry/examples/spinner.html +12 -0
  43. package/registry/examples/toggle-group.html +13 -0
  44. package/registry/examples/toggle.html +13 -0
  45. package/registry/registry.json +308 -1
  46. package/registry/reset.css +332 -80
  47. package/registry/styles/luma/badge.css +8 -10
  48. package/registry/styles/luma/button.css +37 -43
  49. package/registry/styles/luma/checkbox.css +12 -19
  50. package/registry/styles/luma/code-block.css +25 -30
  51. package/registry/styles/luma/dropdown-menu.css +4 -5
  52. package/registry/styles/luma/input.css +16 -17
  53. package/registry/styles/luma/label.css +8 -9
  54. package/registry/styles/luma/native-select.css +19 -15
  55. package/registry/styles/luma/radio.css +12 -19
  56. package/registry/styles/luma/switch.css +15 -21
  57. package/registry/styles/luma/tabs.css +9 -22
  58. package/registry/styles/luma/textarea.css +16 -17
  59. package/registry/styles/lyra/badge.css +8 -10
  60. package/registry/styles/lyra/button.css +37 -43
  61. package/registry/styles/lyra/checkbox.css +12 -19
  62. package/registry/styles/lyra/code-block.css +25 -30
  63. package/registry/styles/lyra/dropdown-menu.css +4 -5
  64. package/registry/styles/lyra/input.css +16 -16
  65. package/registry/styles/lyra/label.css +8 -9
  66. package/registry/styles/lyra/native-select.css +19 -15
  67. package/registry/styles/lyra/radio.css +12 -19
  68. package/registry/styles/lyra/switch.css +15 -21
  69. package/registry/styles/lyra/tabs.css +9 -22
  70. package/registry/styles/lyra/textarea.css +16 -16
  71. package/registry/styles/maia/badge.css +8 -10
  72. package/registry/styles/maia/button.css +37 -43
  73. package/registry/styles/maia/checkbox.css +12 -19
  74. package/registry/styles/maia/code-block.css +25 -30
  75. package/registry/styles/maia/dropdown-menu.css +4 -5
  76. package/registry/styles/maia/input.css +16 -17
  77. package/registry/styles/maia/label.css +8 -9
  78. package/registry/styles/maia/native-select.css +19 -15
  79. package/registry/styles/maia/radio.css +12 -19
  80. package/registry/styles/maia/switch.css +15 -21
  81. package/registry/styles/maia/tabs.css +9 -22
  82. package/registry/styles/maia/textarea.css +16 -17
  83. package/registry/styles/mira/badge.css +8 -10
  84. package/registry/styles/mira/button.css +37 -43
  85. package/registry/styles/mira/checkbox.css +12 -19
  86. package/registry/styles/mira/code-block.css +25 -30
  87. package/registry/styles/mira/dropdown-menu.css +4 -5
  88. package/registry/styles/mira/input.css +16 -16
  89. package/registry/styles/mira/label.css +8 -9
  90. package/registry/styles/mira/native-select.css +19 -15
  91. package/registry/styles/mira/radio.css +12 -19
  92. package/registry/styles/mira/switch.css +15 -21
  93. package/registry/styles/mira/tabs.css +9 -22
  94. package/registry/styles/mira/textarea.css +16 -16
  95. package/registry/styles/nova/accordion.css +59 -0
  96. package/registry/styles/nova/aspect-ratio.css +6 -0
  97. package/registry/styles/nova/avatar.css +89 -0
  98. package/registry/styles/nova/badge.css +8 -10
  99. package/registry/styles/nova/breadcrumb.css +61 -0
  100. package/registry/styles/nova/button.css +37 -43
  101. package/registry/styles/nova/checkbox.css +12 -19
  102. package/registry/styles/nova/code-block.css +25 -30
  103. package/registry/styles/nova/dropdown-menu.css +4 -5
  104. package/registry/styles/nova/input.css +16 -17
  105. package/registry/styles/nova/label.css +8 -9
  106. package/registry/styles/nova/native-select.css +19 -15
  107. package/registry/styles/nova/pagination.css +46 -0
  108. package/registry/styles/nova/progress.css +67 -0
  109. package/registry/styles/nova/radio.css +12 -19
  110. package/registry/styles/nova/separator.css +14 -0
  111. package/registry/styles/nova/spinner.css +35 -0
  112. package/registry/styles/nova/switch.css +15 -21
  113. package/registry/styles/nova/tabs.css +9 -22
  114. package/registry/styles/nova/textarea.css +16 -17
  115. package/registry/styles/nova/toggle-group.css +48 -0
  116. package/registry/styles/nova/toggle.css +110 -0
  117. package/registry/styles/rhea/badge.css +8 -10
  118. package/registry/styles/rhea/button.css +37 -43
  119. package/registry/styles/rhea/checkbox.css +12 -19
  120. package/registry/styles/rhea/code-block.css +25 -30
  121. package/registry/styles/rhea/dropdown-menu.css +4 -5
  122. package/registry/styles/rhea/input.css +16 -17
  123. package/registry/styles/rhea/label.css +8 -9
  124. package/registry/styles/rhea/native-select.css +19 -15
  125. package/registry/styles/rhea/radio.css +12 -19
  126. package/registry/styles/rhea/switch.css +15 -21
  127. package/registry/styles/rhea/tabs.css +9 -22
  128. package/registry/styles/rhea/textarea.css +16 -17
  129. package/registry/styles/sera/badge.css +8 -10
  130. package/registry/styles/sera/button.css +37 -43
  131. package/registry/styles/sera/checkbox.css +12 -19
  132. package/registry/styles/sera/code-block.css +25 -30
  133. package/registry/styles/sera/dropdown-menu.css +4 -5
  134. package/registry/styles/sera/input.css +16 -17
  135. package/registry/styles/sera/label.css +8 -9
  136. package/registry/styles/sera/native-select.css +19 -15
  137. package/registry/styles/sera/radio.css +12 -19
  138. package/registry/styles/sera/switch.css +15 -21
  139. package/registry/styles/sera/tabs.css +9 -22
  140. package/registry/styles/sera/textarea.css +16 -17
  141. package/registry/styles/vega/badge.css +8 -10
  142. package/registry/styles/vega/button.css +37 -43
  143. package/registry/styles/vega/checkbox.css +12 -19
  144. package/registry/styles/vega/code-block.css +25 -30
  145. package/registry/styles/vega/dropdown-menu.css +4 -5
  146. package/registry/styles/vega/input.css +16 -17
  147. package/registry/styles/vega/label.css +8 -9
  148. package/registry/styles/vega/native-select.css +19 -15
  149. package/registry/styles/vega/radio.css +12 -19
  150. package/registry/styles/vega/switch.css +15 -21
  151. package/registry/styles/vega/tabs.css +9 -22
  152. package/registry/styles/vega/textarea.css +16 -17
  153. package/registry/tokens.css +116 -130
@@ -0,0 +1,52 @@
1
+ import { DEFAULT_STYLE } from "./config.js";
2
+ import { availableStyles, isStyleName } from "./registry.js";
3
+ /** Select options for the styles declared by the registry. */
4
+ export function styleOptions(registry) {
5
+ return registry.styles.map((style) => ({
6
+ value: style.name,
7
+ label: style.title,
8
+ hint: style.description
9
+ }));
10
+ }
11
+ /**
12
+ * Resolves the style for `init` before any prompt.
13
+ *
14
+ * An explicit `--style` is authoritative: an unknown value is an error, never a
15
+ * fallback. An unknown stored style falls back to the default with a warning.
16
+ */
17
+ export function resolveInitStyle(registry, argsStyle, configStyle) {
18
+ if (argsStyle !== undefined) {
19
+ if (!isStyleName(registry, argsStyle)) {
20
+ return {
21
+ error: `Unknown style: ${argsStyle}. Available styles: ${availableStyles(registry).join(", ")}.`
22
+ };
23
+ }
24
+ return { style: argsStyle };
25
+ }
26
+ if (configStyle !== undefined && !isStyleName(registry, configStyle)) {
27
+ return {
28
+ style: DEFAULT_STYLE,
29
+ warning: `Unknown style in loseta.json: ${configStyle}. Using ${DEFAULT_STYLE}.`
30
+ };
31
+ }
32
+ return { style: configStyle ?? DEFAULT_STYLE };
33
+ }
34
+ /**
35
+ * Resolves the style for `add`. An explicit `--style` must match the project
36
+ * style; switching is `loseta style <name>`'s job.
37
+ */
38
+ export function resolveAddStyle(registry, config, argsStyle) {
39
+ const style = argsStyle ?? config.style;
40
+ if (!isStyleName(registry, style)) {
41
+ return {
42
+ error: `Unknown style: ${style}. Available styles: ${availableStyles(registry).join(", ")}.`
43
+ };
44
+ }
45
+ if (argsStyle !== undefined && argsStyle !== config.style) {
46
+ return {
47
+ error: `This project uses the "${config.style}" style. Run \`loseta style ${argsStyle}\` to switch styles.`
48
+ };
49
+ }
50
+ return { style };
51
+ }
52
+ //# sourceMappingURL=style-selection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-selection.js","sourceRoot":"","sources":["../src/style-selection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAU7D,8DAA8D;AAC9D,MAAM,UAAU,YAAY,CAAC,QAAkB;IAC7C,OAAO,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACrC,KAAK,EAAE,KAAK,CAAC,IAAI;QACjB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,CAAC,WAAW;KACxB,CAAC,CAAC,CAAC;AACN,CAAC;AAMD;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAkB,EAClB,SAA6B,EA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manifest, Registry, RegistryItem } from "./types.js";
3
+ export interface StyleSwitchPlan {
4
+ previous: string;
5
+ nextConfig: LosetaConfig;
6
+ items: RegistryItem[];
7
+ }
8
+ export type StyleSwitchResolution = {
9
+ status: "error";
10
+ message: string;
11
+ } | {
12
+ status: "noop";
13
+ message: string;
14
+ } | {
15
+ status: "switch";
16
+ plan: StyleSwitchPlan;
17
+ };
18
+ /**
19
+ * Decides whether `loseta style <name>` can run. Pure: no filesystem access,
20
+ * so the command policy is testable without a project.
21
+ */
22
+ export declare function resolveStyleSwitch(registry: Registry, manifest: Manifest, config: LosetaConfig, name: string | undefined): StyleSwitchResolution;
23
+ export interface StyleSwitchResult {
24
+ result: InstallResult;
25
+ kept: string[];
26
+ }
27
+ /**
28
+ * Applies a resolved style switch: writes the new style files, keeps modified
29
+ * base files, and records the new style in loseta.json.
30
+ */
31
+ export declare function applyStyleSwitch(input: {
32
+ projectRoot: string;
33
+ registry: Registry;
34
+ sourceRoot: string;
35
+ manifest: Manifest;
36
+ plan: StyleSwitchPlan;
37
+ }): Promise<StyleSwitchResult>;
@@ -0,0 +1,81 @@
1
+ import { writeConfig } from "./config.js";
2
+ import { installItems } from "./install.js";
3
+ import { installedNames } from "./manifest.js";
4
+ import { availableStyles, isStyleName } from "./registry.js";
5
+ /**
6
+ * Decides whether `loseta style <name>` can run. Pure: no filesystem access,
7
+ * so the command policy is testable without a project.
8
+ */
9
+ export function resolveStyleSwitch(registry, manifest, config, name) {
10
+ const available = availableStyles(registry);
11
+ if (!name) {
12
+ return {
13
+ status: "error",
14
+ message: `Usage: loseta style <name>. Available styles: ${available.join(", ")}.`
15
+ };
16
+ }
17
+ if (!isStyleName(registry, name)) {
18
+ return {
19
+ status: "error",
20
+ message: `Unknown style: ${name}. Available styles: ${available.join(", ")}.`
21
+ };
22
+ }
23
+ if (name === config.style) {
24
+ return {
25
+ status: "noop",
26
+ message: `This project already uses the "${name}" style.`
27
+ };
28
+ }
29
+ const installed = installedNames(manifest);
30
+ const items = registry.items.filter((item) => installed.has(item.name) &&
31
+ (item.type === "component" || item.type === "primitive"));
32
+ if (items.length === 0) {
33
+ return {
34
+ status: "error",
35
+ message: "No components are installed yet. Run `loseta add <component>` first."
36
+ };
37
+ }
38
+ if (name !== "nova") {
39
+ const experimental = items
40
+ .filter((item) => item.status === "experimental")
41
+ .map((item) => item.name);
42
+ if (experimental.length > 0) {
43
+ return {
44
+ status: "error",
45
+ message: `Experimental components are Nova-only: ${experimental.join(", ")}. Delete their files and manifest entries before switching styles, or stay on Nova.`
46
+ };
47
+ }
48
+ }
49
+ return {
50
+ status: "switch",
51
+ plan: {
52
+ previous: config.style,
53
+ nextConfig: { ...config, style: name },
54
+ items
55
+ }
56
+ };
57
+ }
58
+ /**
59
+ * Applies a resolved style switch: writes the new style files, keeps modified
60
+ * base files, and records the new style in loseta.json.
61
+ */
62
+ export async function applyStyleSwitch(input) {
63
+ const kept = [];
64
+ const result = await installItems({
65
+ projectRoot: input.projectRoot,
66
+ config: input.plan.nextConfig,
67
+ registry: input.registry,
68
+ sourceRoot: input.sourceRoot,
69
+ manifest: input.manifest,
70
+ items: input.plan.items,
71
+ onConflict: (file) => {
72
+ if (file.role === "style")
73
+ return "overwrite";
74
+ kept.push(file.target);
75
+ return "keep";
76
+ }
77
+ });
78
+ writeConfig(input.projectRoot, input.plan.nextConfig);
79
+ return { result, kept };
80
+ }
81
+ //# sourceMappingURL=style-switch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-switch.js","sourceRoot":"","sources":["../src/style-switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAc7D;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAkB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 @@
1
1
  {
2
2
  "name": "loseta",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Native CSS component scaffolds with the shadcn feel.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,6 +38,7 @@
38
38
  "scripts": {
39
39
  "build": "tsc -p tsconfig.json",
40
40
  "dev": "tsx src/cli.ts",
41
+ "smoke": "bash scripts/smoke-init.sh",
41
42
  "validate": "node scripts/validate-registry.mjs",
42
43
  "examples": "tsx scripts/generate-examples.ts",
43
44
  "check": "pnpm build && pnpm validate",
@@ -0,0 +1,65 @@
1
+ /* Accordion */
2
+ @layer loseta.components {
3
+ .accordion {
4
+ display: flex;
5
+ width: 100%;
6
+ flex-direction: column;
7
+ interpolate-size: allow-keywords;
8
+
9
+ > details {
10
+ > summary {
11
+ position: relative;
12
+ display: flex;
13
+ width: 100%;
14
+ cursor: pointer;
15
+ list-style-type: none;
16
+ align-items: flex-start;
17
+ justify-content: space-between;
18
+ outline-style: none;
19
+ -webkit-user-select: none;
20
+ user-select: none;
21
+
22
+ @media (forced-colors: active) {
23
+ outline: 2px solid transparent;
24
+ outline-offset: 2px;
25
+ }
26
+
27
+ &::-webkit-details-marker {
28
+ display: none;
29
+ }
30
+
31
+ > svg:last-child {
32
+ pointer-events: none;
33
+ flex-shrink: 0;
34
+ transition-property: rotate;
35
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
36
+ transition-duration: 150ms;
37
+ }
38
+ }
39
+
40
+ &[open] > summary > svg:last-child {
41
+ rotate: 180deg;
42
+ }
43
+
44
+ &[inert] > summary {
45
+ pointer-events: none;
46
+ opacity: 50%;
47
+ }
48
+
49
+ > :not(summary) {
50
+ overflow: hidden;
51
+ }
52
+
53
+ &::details-content {
54
+ block-size: 0;
55
+ display: block;
56
+ overflow: hidden;
57
+ }
58
+
59
+ &[open]::details-content {
60
+ block-size: auto;
61
+ block-size: calc-size(auto, size);
62
+ }
63
+ }
64
+ }
65
+ }
@@ -0,0 +1,25 @@
1
+ /* Aspect Ratio */
2
+ @layer loseta.components {
3
+ .aspect-ratio {
4
+ position: relative;
5
+ display: block;
6
+ inline-size: 100%;
7
+ aspect-ratio: var(--ratio, 16 / 9);
8
+ overflow: hidden;
9
+
10
+ &[data-fit='cover'] {
11
+ --fit: cover;
12
+ }
13
+
14
+ &[data-fit='contain'] {
15
+ --fit: contain;
16
+ }
17
+
18
+ > :is(img, video, iframe, canvas, svg) {
19
+ display: block;
20
+ inline-size: 100%;
21
+ block-size: 100%;
22
+ object-fit: var(--fit, cover);
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,54 @@
1
+ /* Avatar */
2
+ @layer loseta.components {
3
+ .avatar {
4
+ position: relative;
5
+ display: inline-flex;
6
+ flex-shrink: 0;
7
+ overflow: hidden;
8
+ vertical-align: middle;
9
+ -webkit-user-select: none;
10
+ user-select: none;
11
+
12
+ > img {
13
+ position: absolute;
14
+ inset: 0;
15
+ aspect-ratio: 1 / 1;
16
+ width: 100%;
17
+ height: 100%;
18
+ object-fit: cover;
19
+
20
+ &[hidden] {
21
+ display: none;
22
+ }
23
+ }
24
+
25
+ > [data-slot='fallback'] {
26
+ display: flex;
27
+ width: 100%;
28
+ height: 100%;
29
+ align-items: center;
30
+ justify-content: center;
31
+ }
32
+
33
+ > [data-slot='badge'] {
34
+ position: absolute;
35
+ inset-inline-end: 0;
36
+ inset-block-end: 0;
37
+ z-index: 1;
38
+ display: inline-flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ -webkit-user-select: none;
42
+ user-select: none;
43
+ }
44
+ }
45
+
46
+ .avatar-group {
47
+ display: flex;
48
+ align-items: center;
49
+
50
+ > .avatar:not(:last-child) {
51
+ margin-inline-end: -0.375rem;
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,57 @@
1
+ /* Breadcrumb */
2
+ @layer loseta.components {
3
+ .breadcrumb {
4
+ > ol {
5
+ margin: 0;
6
+ display: flex;
7
+ list-style-type: none;
8
+ flex-wrap: wrap;
9
+ align-items: center;
10
+ padding: 0;
11
+ overflow-wrap: break-word;
12
+ }
13
+
14
+ li {
15
+ display: inline-flex;
16
+ align-items: center;
17
+
18
+ &[aria-hidden='true'] {
19
+ -webkit-user-select: none;
20
+ user-select: none;
21
+ }
22
+
23
+ > span[aria-hidden='true'] {
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ }
28
+ }
29
+
30
+ :is(a, button) {
31
+ outline-style: none;
32
+
33
+ @media (forced-colors: active) {
34
+ outline: 2px solid transparent;
35
+ outline-offset: 2px;
36
+ }
37
+ }
38
+
39
+ [aria-current='page'] {
40
+ cursor: default;
41
+ }
42
+
43
+ [data-slot='ellipsis'] {
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ -webkit-user-select: none;
48
+ user-select: none;
49
+ }
50
+
51
+ [data-rtl-flip] {
52
+ &:where(:dir(rtl), [dir='rtl'], [dir='rtl'] *) {
53
+ rotate: 180deg;
54
+ }
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,49 @@
1
+ /* Pagination */
2
+ @layer loseta.components {
3
+ .pagination {
4
+ display: flex;
5
+ width: 100%;
6
+ justify-content: center;
7
+
8
+ > ul {
9
+ margin: 0;
10
+ display: flex;
11
+ flex-direction: row;
12
+ align-items: center;
13
+ list-style-type: none;
14
+ padding: 0;
15
+ }
16
+
17
+ > ul > li {
18
+ display: flex;
19
+ }
20
+
21
+ > ul > li > :is(a, button) {
22
+ outline-style: none;
23
+
24
+ @media (forced-colors: active) {
25
+ outline: 2px solid transparent;
26
+ outline-offset: 2px;
27
+ }
28
+ }
29
+
30
+ [data-slot='ellipsis'] {
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: center;
34
+ -webkit-user-select: none;
35
+ user-select: none;
36
+ }
37
+
38
+ svg {
39
+ pointer-events: none;
40
+ flex-shrink: 0;
41
+ }
42
+
43
+ [data-rtl-flip] {
44
+ &:where(:dir(rtl), [dir='rtl'], [dir='rtl'] *) {
45
+ rotate: 180deg;
46
+ }
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,13 @@
1
+ /* Progress */
2
+ @layer loseta.components {
3
+ .progress {
4
+ display: block;
5
+ width: 100%;
6
+ appearance: none;
7
+ overflow: hidden;
8
+
9
+ &::-webkit-progress-bar {
10
+ appearance: none;
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,12 @@
1
+ /* Separator */
2
+ @layer loseta.components {
3
+ .separator {
4
+ flex-shrink: 0;
5
+ border-style: solid;
6
+ border-width: 0;
7
+
8
+ &:is([data-orientation='vertical'], [aria-orientation='vertical']) {
9
+ align-self: stretch;
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,8 @@
1
+ /* Spinner */
2
+ @layer loseta.components {
3
+ .spinner {
4
+ display: inline-block;
5
+ flex-shrink: 0;
6
+ vertical-align: middle;
7
+ }
8
+ }
@@ -0,0 +1,17 @@
1
+ /* Toggle Group */
2
+ @layer loseta.components {
3
+ .toggle-group {
4
+ display: flex;
5
+ width: fit-content;
6
+ align-items: center;
7
+
8
+ &[data-orientation='vertical'] {
9
+ flex-direction: column;
10
+ align-items: stretch;
11
+ }
12
+
13
+ > .toggle {
14
+ flex-shrink: 0;
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,31 @@
1
+ /* Toggle */
2
+ @layer loseta.components {
3
+ .toggle {
4
+ display: inline-flex;
5
+ flex-shrink: 0;
6
+ align-items: center;
7
+ justify-content: center;
8
+ white-space: nowrap;
9
+ outline-style: none;
10
+ -webkit-user-select: none;
11
+ user-select: none;
12
+ transition-property: all;
13
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
14
+ transition-duration: 150ms;
15
+
16
+ @media (forced-colors: active) {
17
+ outline: 2px solid transparent;
18
+ outline-offset: 2px;
19
+ }
20
+
21
+ &:disabled {
22
+ pointer-events: none;
23
+ opacity: 50%;
24
+ }
25
+
26
+ > svg {
27
+ pointer-events: none;
28
+ flex-shrink: 0;
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,56 @@
1
+ <!-- Default -->
2
+ <div class="accordion">
3
+ <details open>
4
+ <summary>
5
+ Is it accessible?
6
+ <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>
7
+ </summary>
8
+ <div>
9
+ <p>Yes. It uses native details and summary elements.</p>
10
+ </div>
11
+ </details>
12
+ <details>
13
+ <summary>
14
+ Can I style it?
15
+ <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>
16
+ </summary>
17
+ <div>
18
+ <p>Yes. The base file owns the anatomy and the Nova style owns the surface.</p>
19
+ </div>
20
+ </details>
21
+ </div>
22
+
23
+ <!-- Exclusive -->
24
+ <div class="accordion">
25
+ <details name="demo-accordion" open>
26
+ <summary>
27
+ Shipping
28
+ <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>
29
+ </summary>
30
+ <div>
31
+ <p>Orders placed before 14:00 ship the same day.</p>
32
+ </div>
33
+ </details>
34
+ <details name="demo-accordion">
35
+ <summary>
36
+ Returns
37
+ <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>
38
+ </summary>
39
+ <div>
40
+ <p>Returns are accepted within 30 days of delivery.</p>
41
+ </div>
42
+ </details>
43
+ </div>
44
+
45
+ <!-- Disabled -->
46
+ <div class="accordion">
47
+ <details inert>
48
+ <summary>
49
+ Archived section
50
+ <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>
51
+ </summary>
52
+ <div>
53
+ <p>This section cannot be opened.</p>
54
+ </div>
55
+ </details>
56
+ </div>
@@ -0,0 +1,9 @@
1
+ <!-- 16 / 9 -->
2
+ <div class="aspect-ratio" style="--ratio: 16 / 9">
3
+ <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 90'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%2394a3b8'/%3E%3Cstop offset='1' stop-color='%23e2e8f0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='160' height='90' fill='url(%23g)'/%3E%3Ctext x='80' y='49' text-anchor='middle' font-family='sans-serif' font-size='12' fill='%23334155'%3E16:9%3C/text%3E%3C/svg%3E" alt="A 16 by 9 media placeholder" />
4
+ </div>
5
+
6
+ <!-- Square, contain -->
7
+ <div class="aspect-ratio" style="--ratio: 1 / 1; max-width: 16rem" data-fit="contain">
8
+ <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 90'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%2394a3b8'/%3E%3Cstop offset='1' stop-color='%23e2e8f0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='160' height='90' fill='url(%23g)'/%3E%3Ctext x='80' y='49' text-anchor='middle' font-family='sans-serif' font-size='12' fill='%23334155'%3E16:9%3C/text%3E%3C/svg%3E" alt="A wide media placeholder inside a square frame" />
9
+ </div>
@@ -0,0 +1,21 @@
1
+ <!-- Sizes -->
2
+ <div style="display: flex; align-items: center; gap: 0.75rem">
3
+ <span class="avatar" data-size="sm"><span data-slot="fallback">SM</span></span>
4
+ <span class="avatar"><span data-slot="fallback">AV</span></span>
5
+ <span class="avatar" data-size="lg"><span data-slot="fallback">LG</span></span>
6
+ </div>
7
+
8
+ <!-- Image and badge -->
9
+ <span class="avatar" data-size="lg">
10
+ <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' fill='%23cbd5e1'/%3E%3Ccircle cx='32' cy='24' r='11' fill='%23475569'/%3E%3Cpath d='M10 64c0-12 10-22 22-22s22 10 22 22z' fill='%23475569'/%3E%3C/svg%3E" alt="Ada Lovelace" />
11
+ <span data-slot="fallback" aria-hidden="true">AL</span>
12
+ <span data-slot="badge" aria-hidden="true"></span>
13
+ </span>
14
+
15
+ <!-- Group -->
16
+ <div class="avatar-group">
17
+ <span class="avatar"><span data-slot="fallback">AL</span></span>
18
+ <span class="avatar"><span data-slot="fallback">GR</span></span>
19
+ <span class="avatar"><span data-slot="fallback">TS</span></span>
20
+ <span class="avatar"><span data-slot="fallback">+3</span></span>
21
+ </div>
@@ -0,0 +1,23 @@
1
+ <!-- Default -->
2
+ <nav class="breadcrumb" aria-label="breadcrumb">
3
+ <ol>
4
+ <li><a href="#">Home</a></li>
5
+ <li role="presentation" 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"><path d="m9 18 6-6-6-6"/></svg></li>
6
+ <li><a href="#">Components</a></li>
7
+ <li role="presentation" 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"><path d="m9 18 6-6-6-6"/></svg></li>
8
+ <li><span aria-current="page">Breadcrumb</span></li>
9
+ </ol>
10
+ </nav>
11
+
12
+ <!-- Collapsed -->
13
+ <nav class="breadcrumb" aria-label="breadcrumb">
14
+ <ol>
15
+ <li><a href="#">Home</a></li>
16
+ <li role="presentation" 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"><path d="m9 18 6-6-6-6"/></svg></li>
17
+ <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>
18
+ <li role="presentation" 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"><path d="m9 18 6-6-6-6"/></svg></li>
19
+ <li><a href="#">Components</a></li>
20
+ <li role="presentation" 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"><path d="m9 18 6-6-6-6"/></svg></li>
21
+ <li><span aria-current="page">Breadcrumb</span></li>
22
+ </ol>
23
+ </nav>