@dumiflex/wp-kit 0.3.0 → 0.4.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 (128) hide show
  1. package/CHANGELOG.md +77 -51
  2. package/LICENSE +674 -674
  3. package/README.md +73 -76
  4. package/package.json +78 -77
  5. package/src/Avatar.vue +83 -83
  6. package/src/Badge.vue +97 -97
  7. package/src/Banner.vue +118 -118
  8. package/src/BookmarkButton.vue +27 -27
  9. package/src/BundleMeta.vue +51 -51
  10. package/src/Button.vue +103 -103
  11. package/src/Card.vue +68 -68
  12. package/src/Checkbox.vue +109 -107
  13. package/src/Chip.vue +163 -97
  14. package/src/ChoiceCards.vue +133 -133
  15. package/src/CloseButton.vue +69 -69
  16. package/src/CodeBlock.vue +119 -119
  17. package/src/ColorField.vue +188 -206
  18. package/src/ColorPicker.vue +201 -201
  19. package/src/Combobox.vue +331 -334
  20. package/src/ConfirmDialog.vue +165 -163
  21. package/src/ConfirmModal.vue +147 -147
  22. package/src/ConstraintMatrixPreview.vue +708 -708
  23. package/src/ContextMenu.vue +386 -379
  24. package/src/CopyButton.vue +156 -156
  25. package/src/DataTable.vue +292 -292
  26. package/src/DatePicker.vue +234 -234
  27. package/src/DescriptionList.vue +73 -73
  28. package/src/DiffView.vue +68 -68
  29. package/src/Disclosure.vue +166 -166
  30. package/src/DragHandle.vue +49 -49
  31. package/src/Drawer.vue +131 -131
  32. package/src/DropZone.vue +196 -196
  33. package/src/DropdownMenu.vue +72 -72
  34. package/src/EmptyState.vue +111 -111
  35. package/src/Field.vue +28 -28
  36. package/src/HsvPicker.vue +208 -208
  37. package/src/Icon.vue +39 -39
  38. package/src/IconPicker.vue +209 -209
  39. package/src/ImageGrid.vue +125 -125
  40. package/src/InlineEdit.vue +183 -183
  41. package/src/Input.vue +99 -99
  42. package/src/Kbd.vue +56 -56
  43. package/src/Lightbox.vue +173 -173
  44. package/src/ListFilter.vue +85 -85
  45. package/src/ListRow.vue +204 -204
  46. package/src/LoadingMark.vue +175 -161
  47. package/src/Logo.vue +60 -60
  48. package/src/Modal.vue +78 -76
  49. package/src/ModalShell.vue +109 -107
  50. package/src/Pagination.vue +106 -106
  51. package/src/Popover.vue +180 -171
  52. package/src/PostCard.vue +210 -211
  53. package/src/ProgressBar.vue +90 -90
  54. package/src/RadioGroup.vue +177 -177
  55. package/src/RangeSlider.vue +183 -183
  56. package/src/RelativeDate.vue +35 -35
  57. package/src/ResizeHandle.vue +143 -143
  58. package/src/SearchInput.vue +192 -199
  59. package/src/Select.vue +644 -641
  60. package/src/Separator.vue +54 -54
  61. package/src/Skeleton.vue +82 -82
  62. package/src/Slider.vue +198 -198
  63. package/src/SortableList.vue +260 -260
  64. package/src/SplitPane.vue +68 -68
  65. package/src/StarButton.vue +40 -40
  66. package/src/Stepper.vue +141 -141
  67. package/src/SupportLinks.vue +93 -93
  68. package/src/TagInput.vue +297 -300
  69. package/src/Textarea.vue +57 -57
  70. package/src/Timeline.vue +92 -92
  71. package/src/ToastCard.vue +119 -119
  72. package/src/ToastHost.vue +40 -40
  73. package/src/Toggle.vue +36 -36
  74. package/src/TokenizedValue.vue +310 -310
  75. package/src/Toolbar.vue +110 -110
  76. package/src/VirtualList.vue +87 -87
  77. package/src/VisuallyHidden.vue +29 -29
  78. package/src/WpButton.vue +75 -75
  79. package/src/WpCheck.vue +104 -102
  80. package/src/WpIconButton.vue +107 -107
  81. package/src/WpImageZoom.vue +544 -544
  82. package/src/WpNumber.vue +178 -183
  83. package/src/WpSegmented.vue +175 -175
  84. package/src/WpSelect.vue +93 -89
  85. package/src/WpSwitch.vue +163 -163
  86. package/src/WpTabs.vue +188 -188
  87. package/src/_modal-motion.css +33 -33
  88. package/src/_skeleton.css +50 -50
  89. package/src/axis-color.ts +42 -42
  90. package/src/button.css +169 -169
  91. package/src/calendar.ts +59 -59
  92. package/src/clipboard.ts +50 -50
  93. package/src/colour-presets.ts +12 -12
  94. package/src/diff.ts +51 -51
  95. package/src/drop-zone.ts +41 -41
  96. package/src/field.css +50 -0
  97. package/src/flip.ts +237 -237
  98. package/src/floating-layer.ts +48 -0
  99. package/src/floating.ts +99 -99
  100. package/src/hsv.ts +100 -100
  101. package/src/icon-catalog.ts +52 -52
  102. package/src/image-zoom.ts +93 -93
  103. package/src/kind-colour.ts +28 -0
  104. package/src/logo-paths.ts +21 -21
  105. package/src/matrix-axis.ts +91 -91
  106. package/src/pagination.ts +27 -27
  107. package/src/platform-keys.ts +29 -29
  108. package/src/rich-tokenize.ts +357 -357
  109. package/src/select-types.ts +32 -32
  110. package/src/slider-math.ts +45 -45
  111. package/src/sortable.ts +22 -22
  112. package/src/theme/fonts/OFL-Fraunces.txt +93 -93
  113. package/src/theme/fonts/OFL-JetBrainsMono.txt +93 -93
  114. package/src/theme/fonts/OFL-Manrope.txt +93 -93
  115. package/src/theme/looks.css +428 -428
  116. package/src/theme/palettes.css +254 -254
  117. package/src/theme/tokens.css +2896 -2894
  118. package/src/tokens.ts +56 -56
  119. package/src/tooltip.css +43 -43
  120. package/src/tooltip.ts +146 -146
  121. package/src/useDialogFocus.ts +73 -73
  122. package/src/useGrowableField.ts +357 -357
  123. package/src/useModalKeyShield.ts +116 -116
  124. package/src/useToast.ts +48 -48
  125. package/src/wp-logo.svg +14 -14
  126. package/src/ChipToggle.vue +0 -92
  127. package/src/KindChip.vue +0 -53
  128. package/src/RatingBadge.vue +0 -42
package/src/Separator.vue CHANGED
@@ -1,54 +1,54 @@
1
- <script setup lang="ts">
2
- /**
3
- * Separator: a thin line between groups, across or upright, with optional
4
- * text in the middle ("or"). Works on the canvas and in the manager.
5
- *
6
- * <Separator />
7
- * <Separator label="or" />
8
- * <Separator orientation="vertical" /> (inside a Toolbar or a row)
9
- *
10
- * It is decorative by default (screen readers skip it). Set
11
- * `decorative=false` when it really divides two parts of the content.
12
- */
13
- withDefaults(defineProps<{
14
- orientation?: "horizontal" | "vertical" | undefined;
15
- /** Text in the middle of a horizontal line. */
16
- label?: string | undefined;
17
- decorative?: boolean | undefined;
18
- /** Room around the line. */
19
- spacing?: "none" | "sm" | "md" | "lg" | undefined;
20
- }>(), { orientation: "horizontal", label: undefined, decorative: true, spacing: "sm" });
21
- </script>
22
-
23
- <template>
24
- <div
25
- class="wp-separator"
26
- :data-orientation="orientation"
27
- :data-spacing="spacing"
28
- :data-labelled="label ? 'true' : undefined"
29
- :role="decorative ? 'none' : 'separator'"
30
- :aria-orientation="!decorative && orientation === 'vertical' ? 'vertical' : undefined"
31
- >
32
- <span v-if="label && orientation === 'horizontal'" class="wp-separator__label">{{ label }}</span>
33
- </div>
34
- </template>
35
-
36
- <style scoped>
37
- .wp-separator { flex: none; align-self: stretch; }
38
- .wp-separator[data-orientation="horizontal"] { height: 1px; width: 100%; background: var(--wp-border); }
39
- .wp-separator[data-orientation="vertical"] { width: 1px; min-height: 1em; background: var(--wp-border); }
40
- .wp-separator[data-orientation="horizontal"][data-spacing="sm"] { margin: var(--wp-space-3) 0; }
41
- .wp-separator[data-orientation="horizontal"][data-spacing="md"] { margin: var(--wp-space-5) 0; }
42
- .wp-separator[data-orientation="horizontal"][data-spacing="lg"] { margin: var(--wp-space-7) 0; }
43
- .wp-separator[data-orientation="vertical"][data-spacing="sm"] { margin: 0 var(--wp-space-2); }
44
- .wp-separator[data-orientation="vertical"][data-spacing="md"] { margin: 0 var(--wp-space-4); }
45
- .wp-separator[data-orientation="vertical"][data-spacing="lg"] { margin: 0 var(--wp-space-6); }
46
- .wp-separator[data-labelled] {
47
- display: flex; align-items: center; gap: var(--wp-space-4); height: auto; background: none;
48
- color: var(--wp-text-dim); font: 600 var(--wp-text-xs)/1 var(--wp-font-sans);
49
- text-transform: uppercase; letter-spacing: 0.06em;
50
- }
51
- .wp-separator[data-labelled]::before, .wp-separator[data-labelled]::after {
52
- content: ""; flex: 1; height: 1px; background: var(--wp-border);
53
- }
54
- </style>
1
+ <script setup lang="ts">
2
+ /**
3
+ * Separator: a thin line between groups, across or upright, with optional
4
+ * text in the middle ("or"). Works on the canvas and in the manager.
5
+ *
6
+ * <Separator />
7
+ * <Separator label="or" />
8
+ * <Separator orientation="vertical" /> (inside a Toolbar or a row)
9
+ *
10
+ * It is decorative by default (screen readers skip it). Set
11
+ * `decorative=false` when it really divides two parts of the content.
12
+ */
13
+ withDefaults(defineProps<{
14
+ orientation?: "horizontal" | "vertical" | undefined;
15
+ /** Text in the middle of a horizontal line. */
16
+ label?: string | undefined;
17
+ decorative?: boolean | undefined;
18
+ /** Room around the line. */
19
+ spacing?: "none" | "sm" | "md" | "lg" | undefined;
20
+ }>(), { orientation: "horizontal", label: undefined, decorative: true, spacing: "sm" });
21
+ </script>
22
+
23
+ <template>
24
+ <div
25
+ class="wp-separator"
26
+ :data-orientation="orientation"
27
+ :data-spacing="spacing"
28
+ :data-labelled="label ? 'true' : undefined"
29
+ :role="decorative ? 'none' : 'separator'"
30
+ :aria-orientation="!decorative && orientation === 'vertical' ? 'vertical' : undefined"
31
+ >
32
+ <span v-if="label && orientation === 'horizontal'" class="wp-separator__label">{{ label }}</span>
33
+ </div>
34
+ </template>
35
+
36
+ <style scoped>
37
+ .wp-separator { flex: none; align-self: stretch; }
38
+ .wp-separator[data-orientation="horizontal"] { height: 1px; width: 100%; background: var(--wp-border); }
39
+ .wp-separator[data-orientation="vertical"] { width: 1px; min-height: 1em; background: var(--wp-border); }
40
+ .wp-separator[data-orientation="horizontal"][data-spacing="sm"] { margin: var(--wp-space-3) 0; }
41
+ .wp-separator[data-orientation="horizontal"][data-spacing="md"] { margin: var(--wp-space-5) 0; }
42
+ .wp-separator[data-orientation="horizontal"][data-spacing="lg"] { margin: var(--wp-space-7) 0; }
43
+ .wp-separator[data-orientation="vertical"][data-spacing="sm"] { margin: 0 var(--wp-space-2); }
44
+ .wp-separator[data-orientation="vertical"][data-spacing="md"] { margin: 0 var(--wp-space-4); }
45
+ .wp-separator[data-orientation="vertical"][data-spacing="lg"] { margin: 0 var(--wp-space-6); }
46
+ .wp-separator[data-labelled] {
47
+ display: flex; align-items: center; gap: var(--wp-space-4); height: auto; background: none;
48
+ color: var(--wp-text-dim); font: 600 var(--wp-text-xs)/1 var(--wp-font-sans);
49
+ text-transform: uppercase; letter-spacing: 0.06em;
50
+ }
51
+ .wp-separator[data-labelled]::before, .wp-separator[data-labelled]::after {
52
+ content: ""; flex: 1; height: 1px; background: var(--wp-border);
53
+ }
54
+ </style>
package/src/Skeleton.vue CHANGED
@@ -1,82 +1,82 @@
1
- <script setup lang="ts">
2
- /**
3
- * Skeleton: the grey shape of content that is still loading, so the layout
4
- * doesn't jump when it lands. Use it where the shape is known (a list of
5
- * rows, a card, a line of text); a whole page or panel that is loading uses
6
- * `LoadingMark block` instead. Works on the canvas and in the manager.
7
- *
8
- * <Skeleton shape="row" :lines="4" label="Loading modules" />
9
- * <Skeleton shape="line" :lines="3" />
10
- * <Skeleton shape="block" height="120px" />
11
- *
12
- * The shapes are hidden from screen readers; `label` adds one polite
13
- * "Loading…" line for them instead. The sweep stops under reduced motion.
14
- */
15
- import { computed } from "vue";
16
-
17
- const props = withDefaults(defineProps<{
18
- /** line: text lines (the last one shorter). block: a box. circle: an avatar or icon. row: an icon, a title and a hint line, like a list row. */
19
- shape?: "line" | "block" | "circle" | "row" | undefined;
20
- /** How many lines or rows. */
21
- lines?: number | undefined;
22
- /** CSS width of a line, block or circle. */
23
- width?: string | undefined;
24
- /** CSS height of a block or circle. */
25
- height?: string | undefined;
26
- /** Say "Loading…" to screen readers with this text. */
27
- label?: string | undefined;
28
- }>(), { shape: "line", lines: 1, width: undefined, height: undefined, label: undefined });
29
-
30
- const count = computed(() => Math.max(1, Math.floor(props.lines)));
31
- /** The last of several lines is shorter, like the end of a paragraph. */
32
- const lineWidth = (i: number): string | undefined =>
33
- props.width ?? (count.value > 1 && i === count.value - 1 ? "60%" : undefined);
34
- </script>
35
-
36
- <template>
37
- <div class="wp-skeleton" :data-shape="shape" :role="label ? 'status' : undefined">
38
- <span v-if="label" class="wp-skeleton__sr">{{ label }}…</span>
39
- <template v-if="shape === 'line'">
40
- <span v-for="i in count" :key="i" class="wp-skeleton__bone wp-skeleton__line" :style="{ width: lineWidth(i - 1) }" aria-hidden="true" />
41
- </template>
42
- <span v-else-if="shape === 'block'" class="wp-skeleton__bone wp-skeleton__block" :style="{ width, height }" aria-hidden="true" />
43
- <span v-else-if="shape === 'circle'" class="wp-skeleton__bone wp-skeleton__circle" :style="{ width: width ?? height, height: height ?? width }" aria-hidden="true" />
44
- <template v-else>
45
- <span v-for="i in count" :key="i" class="wp-skeleton__row" aria-hidden="true">
46
- <span class="wp-skeleton__bone wp-skeleton__circle" />
47
- <span class="wp-skeleton__row-text">
48
- <span class="wp-skeleton__bone wp-skeleton__line" :style="{ width: i % 2 ? '55%' : '42%' }" />
49
- <span class="wp-skeleton__bone wp-skeleton__line wp-skeleton__line--hint" :style="{ width: i % 2 ? '80%' : '68%' }" />
50
- </span>
51
- </span>
52
- </template>
53
- </div>
54
- </template>
55
-
56
- <style scoped>
57
- .wp-skeleton { display: flex; flex-direction: column; gap: var(--wp-space-3); min-width: 0; width: 100%; }
58
- .wp-skeleton[data-shape="circle"], .wp-skeleton[data-shape="block"] { width: auto; }
59
- .wp-skeleton__bone {
60
- position: relative; display: block; overflow: hidden;
61
- border-radius: var(--wp-radius-sm); background: var(--wp-bg-3);
62
- }
63
- .wp-skeleton__bone::after {
64
- content: ""; position: absolute; inset: 0; transform: translateX(-100%);
65
- background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--wp-text) 8%, transparent), transparent);
66
- animation: wp-skeleton-sweep var(--wp-motion-shimmer) ease-in-out infinite;
67
- }
68
- .wp-skeleton__line { width: 100%; height: 0.75em; }
69
- .wp-skeleton__line--hint { height: 0.6em; opacity: 0.7; }
70
- .wp-skeleton__block { width: 100%; height: 64px; border-radius: var(--wp-radius); }
71
- .wp-skeleton__circle { flex: none; width: 28px; height: 28px; border-radius: 50%; /* round: stands in for an avatar */ }
72
- .wp-skeleton__row { display: flex; align-items: center; gap: var(--wp-space-4); padding: var(--wp-space-2) 0; }
73
- .wp-skeleton__row-text { display: flex; flex-direction: column; gap: var(--wp-space-2); flex: 1; min-width: 0; }
74
- .wp-skeleton__sr {
75
- position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
76
- clip: rect(0 0 0 0); white-space: nowrap; border: 0;
77
- }
78
- @keyframes wp-skeleton-sweep { to { transform: translateX(100%); } }
79
- @media (prefers-reduced-motion: reduce) {
80
- .wp-skeleton__bone::after { animation: none; display: none; }
81
- }
82
- </style>
1
+ <script setup lang="ts">
2
+ /**
3
+ * Skeleton: the grey shape of content that is still loading, so the layout
4
+ * doesn't jump when it lands. Use it where the shape is known (a list of
5
+ * rows, a card, a line of text); a whole page or panel that is loading uses
6
+ * `LoadingMark block` instead. Works on the canvas and in the manager.
7
+ *
8
+ * <Skeleton shape="row" :lines="4" label="Loading modules" />
9
+ * <Skeleton shape="line" :lines="3" />
10
+ * <Skeleton shape="block" height="120px" />
11
+ *
12
+ * The shapes are hidden from screen readers; `label` adds one polite
13
+ * "Loading…" line for them instead. The sweep stops under reduced motion.
14
+ */
15
+ import { computed } from "vue";
16
+
17
+ const props = withDefaults(defineProps<{
18
+ /** line: text lines (the last one shorter). block: a box. circle: an avatar or icon. row: an icon, a title and a hint line, like a list row. */
19
+ shape?: "line" | "block" | "circle" | "row" | undefined;
20
+ /** How many lines or rows. */
21
+ lines?: number | undefined;
22
+ /** CSS width of a line, block or circle. */
23
+ width?: string | undefined;
24
+ /** CSS height of a block or circle. */
25
+ height?: string | undefined;
26
+ /** Say "Loading…" to screen readers with this text. */
27
+ label?: string | undefined;
28
+ }>(), { shape: "line", lines: 1, width: undefined, height: undefined, label: undefined });
29
+
30
+ const count = computed(() => Math.max(1, Math.floor(props.lines)));
31
+ /** The last of several lines is shorter, like the end of a paragraph. */
32
+ const lineWidth = (i: number): string | undefined =>
33
+ props.width ?? (count.value > 1 && i === count.value - 1 ? "60%" : undefined);
34
+ </script>
35
+
36
+ <template>
37
+ <div class="wp-skeleton" :data-shape="shape" :role="label ? 'status' : undefined">
38
+ <span v-if="label" class="wp-skeleton__sr">{{ label }}…</span>
39
+ <template v-if="shape === 'line'">
40
+ <span v-for="i in count" :key="i" class="wp-skeleton__bone wp-skeleton__line" :style="{ width: lineWidth(i - 1) }" aria-hidden="true" />
41
+ </template>
42
+ <span v-else-if="shape === 'block'" class="wp-skeleton__bone wp-skeleton__block" :style="{ width, height }" aria-hidden="true" />
43
+ <span v-else-if="shape === 'circle'" class="wp-skeleton__bone wp-skeleton__circle" :style="{ width: width ?? height, height: height ?? width }" aria-hidden="true" />
44
+ <template v-else>
45
+ <span v-for="i in count" :key="i" class="wp-skeleton__row" aria-hidden="true">
46
+ <span class="wp-skeleton__bone wp-skeleton__circle" />
47
+ <span class="wp-skeleton__row-text">
48
+ <span class="wp-skeleton__bone wp-skeleton__line" :style="{ width: i % 2 ? '55%' : '42%' }" />
49
+ <span class="wp-skeleton__bone wp-skeleton__line wp-skeleton__line--hint" :style="{ width: i % 2 ? '80%' : '68%' }" />
50
+ </span>
51
+ </span>
52
+ </template>
53
+ </div>
54
+ </template>
55
+
56
+ <style scoped>
57
+ .wp-skeleton { display: flex; flex-direction: column; gap: var(--wp-space-3); min-width: 0; width: 100%; }
58
+ .wp-skeleton[data-shape="circle"], .wp-skeleton[data-shape="block"] { width: auto; }
59
+ .wp-skeleton__bone {
60
+ position: relative; display: block; overflow: hidden;
61
+ border-radius: var(--wp-radius-sm); background: var(--wp-bg-3);
62
+ }
63
+ .wp-skeleton__bone::after {
64
+ content: ""; position: absolute; inset: 0; transform: translateX(-100%);
65
+ background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--wp-text) 8%, transparent), transparent);
66
+ animation: wp-skeleton-sweep var(--wp-motion-shimmer) ease-in-out infinite;
67
+ }
68
+ .wp-skeleton__line { width: 100%; height: 0.75em; }
69
+ .wp-skeleton__line--hint { height: 0.6em; opacity: 0.7; }
70
+ .wp-skeleton__block { width: 100%; height: 64px; border-radius: var(--wp-radius); }
71
+ .wp-skeleton__circle { flex: none; width: 28px; height: 28px; border-radius: 50%; /* round: stands in for an avatar */ }
72
+ .wp-skeleton__row { display: flex; align-items: center; gap: var(--wp-space-4); padding: var(--wp-space-2) 0; }
73
+ .wp-skeleton__row-text { display: flex; flex-direction: column; gap: var(--wp-space-2); flex: 1; min-width: 0; }
74
+ .wp-skeleton__sr {
75
+ position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
76
+ clip: rect(0 0 0 0); white-space: nowrap; border: 0;
77
+ }
78
+ @keyframes wp-skeleton-sweep { to { transform: translateX(100%); } }
79
+ @media (prefers-reduced-motion: reduce) {
80
+ .wp-skeleton__bone::after { animation: none; display: none; }
81
+ }
82
+ </style>