zdp-design-system 0.43.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +449 -0
  2. package/LICENSE +21 -0
  3. package/README.md +568 -0
  4. package/THIRD_PARTY_NOTICES.md +34 -0
  5. package/dist/code.ts +2 -0
  6. package/dist/combobox.ts +9 -0
  7. package/dist/command.ts +1 -0
  8. package/dist/components/Accordion.svelte +97 -0
  9. package/dist/components/Avatar.svelte +90 -0
  10. package/dist/components/Badge.svelte +61 -0
  11. package/dist/components/Breadcrumb.svelte +97 -0
  12. package/dist/components/Button.svelte +163 -0
  13. package/dist/components/Callout.svelte +81 -0
  14. package/dist/components/Card.svelte +151 -0
  15. package/dist/components/CardHeader.svelte +58 -0
  16. package/dist/components/Checkbox.svelte +135 -0
  17. package/dist/components/CodeBlock.svelte +247 -0
  18. package/dist/components/Combobox.svelte +552 -0
  19. package/dist/components/CommandField.svelte +230 -0
  20. package/dist/components/ConfirmAction.svelte +307 -0
  21. package/dist/components/Container.svelte +63 -0
  22. package/dist/components/Dialog.svelte +303 -0
  23. package/dist/components/Disclosure.svelte +176 -0
  24. package/dist/components/Divider.svelte +41 -0
  25. package/dist/components/EmptyState.svelte +79 -0
  26. package/dist/components/ErrorText.svelte +18 -0
  27. package/dist/components/Field.svelte +38 -0
  28. package/dist/components/Grid.svelte +76 -0
  29. package/dist/components/HelpText.svelte +17 -0
  30. package/dist/components/Icon.svelte +45 -0
  31. package/dist/components/IconButton.svelte +162 -0
  32. package/dist/components/IdentityChip.svelte +130 -0
  33. package/dist/components/Inline.svelte +85 -0
  34. package/dist/components/InlineCode.svelte +27 -0
  35. package/dist/components/Input.svelte +109 -0
  36. package/dist/components/Kbd.svelte +63 -0
  37. package/dist/components/KeyValue.svelte +73 -0
  38. package/dist/components/Label.svelte +43 -0
  39. package/dist/components/Link.svelte +70 -0
  40. package/dist/components/LocaleSwitcher.svelte +209 -0
  41. package/dist/components/Menu.svelte +491 -0
  42. package/dist/components/Page.svelte +36 -0
  43. package/dist/components/PageHeader.svelte +93 -0
  44. package/dist/components/Pagination.svelte +297 -0
  45. package/dist/components/Popover.svelte +208 -0
  46. package/dist/components/Progress.svelte +111 -0
  47. package/dist/components/Radio.svelte +132 -0
  48. package/dist/components/Section.svelte +52 -0
  49. package/dist/components/SegmentedControl.svelte +190 -0
  50. package/dist/components/Select.svelte +88 -0
  51. package/dist/components/ShareDock.svelte +304 -0
  52. package/dist/components/Sheet.svelte +332 -0
  53. package/dist/components/ShortcutHint.svelte +52 -0
  54. package/dist/components/Skeleton.svelte +82 -0
  55. package/dist/components/SkipLink.svelte +40 -0
  56. package/dist/components/SortHeader.svelte +138 -0
  57. package/dist/components/Spinner.svelte +82 -0
  58. package/dist/components/Stack.svelte +62 -0
  59. package/dist/components/StatusToast.svelte +133 -0
  60. package/dist/components/Surface.svelte +53 -0
  61. package/dist/components/Switch.svelte +152 -0
  62. package/dist/components/Table.svelte +94 -0
  63. package/dist/components/TableToolbar.svelte +195 -0
  64. package/dist/components/Tabs.svelte +205 -0
  65. package/dist/components/TermSheet.svelte +392 -0
  66. package/dist/components/TermTrigger.svelte +70 -0
  67. package/dist/components/TextScaleControl.svelte +219 -0
  68. package/dist/components/Textarea.svelte +106 -0
  69. package/dist/components/ThemeToggle.svelte +148 -0
  70. package/dist/components/Toast.svelte +180 -0
  71. package/dist/components/Toolbar.svelte +83 -0
  72. package/dist/components/Tooltip.svelte +199 -0
  73. package/dist/components/VisuallyHidden.svelte +18 -0
  74. package/dist/disclosure.ts +11 -0
  75. package/dist/focusable.ts +36 -0
  76. package/dist/identity.ts +5 -0
  77. package/dist/index.d.ts +106 -0
  78. package/dist/index.js +76 -0
  79. package/dist/index.ts +106 -0
  80. package/dist/menu.ts +12 -0
  81. package/dist/modal-layer.ts +108 -0
  82. package/dist/pagination.ts +10 -0
  83. package/dist/preferences.js +14 -0
  84. package/dist/preferences.ts +36 -0
  85. package/dist/progress.ts +4 -0
  86. package/dist/schemas/design-tokens.schema.json +119 -0
  87. package/dist/segmented.ts +8 -0
  88. package/dist/share.d.ts +48 -0
  89. package/dist/share.js +115 -0
  90. package/dist/share.ts +99 -0
  91. package/dist/sheet.ts +3 -0
  92. package/dist/shortcuts.js +125 -0
  93. package/dist/shortcuts.ts +153 -0
  94. package/dist/styles/brand-fonts.css +10 -0
  95. package/dist/styles/components.css +4686 -0
  96. package/dist/styles/expressive-fonts.css +2 -0
  97. package/dist/styles/index.css +2 -0
  98. package/dist/styles/locale-fonts.css +4 -0
  99. package/dist/styles/tokens.css +413 -0
  100. package/dist/table-tools.ts +10 -0
  101. package/dist/term.ts +16 -0
  102. package/dist/theme.ts +2 -0
  103. package/dist/toast.ts +14 -0
  104. package/dist/tokens/zdp.tokens.json +241 -0
  105. package/dist/tokens.js +122 -0
  106. package/dist/tokens.ts +123 -0
  107. package/docs/CONSUMER_CONTRACT.md +482 -0
  108. package/docs/EXTERNAL_UI_ADOPTION.md +141 -0
  109. package/docs/INTERACTIVE_PRIMITIVE_AUDIT.md +127 -0
  110. package/package.json +78 -0
@@ -0,0 +1,119 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "design-tokens.schema.json",
4
+ "title": "ZDP design token document",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "$schema",
9
+ "name",
10
+ "version",
11
+ "color",
12
+ "space",
13
+ "radius",
14
+ "font",
15
+ "type",
16
+ "breakpoint",
17
+ "control",
18
+ "i18n",
19
+ "shadow",
20
+ "motion"
21
+ ],
22
+ "properties": {
23
+ "$schema": {
24
+ "const": "../schemas/design-tokens.schema.json"
25
+ },
26
+ "name": {
27
+ "type": "string",
28
+ "minLength": 1
29
+ },
30
+ "version": {
31
+ "type": "string",
32
+ "minLength": 1
33
+ },
34
+ "color": {
35
+ "type": "object",
36
+ "additionalProperties": {
37
+ "type": "object",
38
+ "additionalProperties": {
39
+ "$ref": "#/$defs/colorToken"
40
+ }
41
+ }
42
+ },
43
+ "space": {
44
+ "$ref": "#/$defs/stringMap"
45
+ },
46
+ "radius": {
47
+ "$ref": "#/$defs/stringMap"
48
+ },
49
+ "font": {
50
+ "type": "object",
51
+ "additionalProperties": false,
52
+ "required": [
53
+ "family",
54
+ "size",
55
+ "weight",
56
+ "lineHeight"
57
+ ],
58
+ "properties": {
59
+ "family": {
60
+ "$ref": "#/$defs/stringMap"
61
+ },
62
+ "size": {
63
+ "$ref": "#/$defs/stringMap"
64
+ },
65
+ "weight": {
66
+ "$ref": "#/$defs/stringMap"
67
+ },
68
+ "lineHeight": {
69
+ "$ref": "#/$defs/stringMap"
70
+ }
71
+ }
72
+ },
73
+ "type": {
74
+ "$ref": "#/$defs/stringMap"
75
+ },
76
+ "breakpoint": {
77
+ "$ref": "#/$defs/stringMap"
78
+ },
79
+ "control": {
80
+ "$ref": "#/$defs/stringMap"
81
+ },
82
+ "i18n": {
83
+ "$ref": "#/$defs/stringMap"
84
+ },
85
+ "shadow": {
86
+ "$ref": "#/$defs/stringMap"
87
+ },
88
+ "motion": {
89
+ "$ref": "#/$defs/stringMap"
90
+ }
91
+ },
92
+ "$defs": {
93
+ "colorToken": {
94
+ "type": "object",
95
+ "additionalProperties": false,
96
+ "required": [
97
+ "hex",
98
+ "oklch"
99
+ ],
100
+ "properties": {
101
+ "hex": {
102
+ "type": "string",
103
+ "pattern": "^#[0-9a-fA-F]{6}$"
104
+ },
105
+ "oklch": {
106
+ "type": "string",
107
+ "pattern": "^oklch\\([^)]+\\)$"
108
+ }
109
+ }
110
+ },
111
+ "stringMap": {
112
+ "type": "object",
113
+ "additionalProperties": {
114
+ "type": "string",
115
+ "minLength": 1
116
+ }
117
+ }
118
+ }
119
+ }
@@ -0,0 +1,8 @@
1
+ export type ZdpSegmentedControlSize = 'sm' | 'md';
2
+
3
+ export interface ZdpSegmentedControlItem {
4
+ readonly id: string;
5
+ readonly label: string;
6
+ readonly ariaLabel?: string;
7
+ readonly disabled?: boolean;
8
+ }
@@ -0,0 +1,48 @@
1
+ export type ZdpShareIconName = 'copy' | 'device' | 'telegram' | 'line' | 'whatsapp' | 'x' | 'reddit';
2
+
3
+ export interface ZdpShareIconPath {
4
+ readonly d: string;
5
+ readonly fill?: boolean;
6
+ readonly stroke?: boolean;
7
+ readonly strokeLinecap?: 'round';
8
+ readonly strokeLinejoin?: 'round';
9
+ readonly strokeWidth?: string;
10
+ }
11
+
12
+ export interface ZdpShareIconCircle {
13
+ readonly cx: string;
14
+ readonly cy: string;
15
+ readonly r: string;
16
+ readonly fill?: boolean;
17
+ readonly stroke?: boolean;
18
+ readonly strokeWidth?: string;
19
+ }
20
+
21
+ export interface ZdpShareIconLine {
22
+ readonly x1: string;
23
+ readonly y1: string;
24
+ readonly x2: string;
25
+ readonly y2: string;
26
+ readonly strokeWidth?: string;
27
+ }
28
+
29
+ export interface ZdpShareIconShape {
30
+ readonly viewBox: string;
31
+ readonly paths?: readonly ZdpShareIconPath[];
32
+ readonly circles?: readonly ZdpShareIconCircle[];
33
+ readonly lines?: readonly ZdpShareIconLine[];
34
+ }
35
+
36
+ export interface ZdpShareDockItem {
37
+ readonly id: string;
38
+ readonly label: string;
39
+ readonly icon: ZdpShareIconName;
40
+ readonly href?: string;
41
+ readonly target?: '_blank' | '_self' | '_parent' | '_top';
42
+ readonly rel?: string;
43
+ readonly disabled?: boolean;
44
+ readonly ariaLabel?: string;
45
+ readonly onclick?: (event: MouseEvent, item: ZdpShareDockItem) => void;
46
+ }
47
+
48
+ export declare const zdpShareIcons: Record<ZdpShareIconName, ZdpShareIconShape>;
package/dist/share.js ADDED
@@ -0,0 +1,115 @@
1
+ export const zdpShareIcons = {
2
+ "copy": {
3
+ "viewBox": "0 0 24 24",
4
+ "paths": [
5
+ {
6
+ "d": "M9.5 13.5 14.5 8.5",
7
+ "fill": false,
8
+ "stroke": true,
9
+ "strokeLinecap": "round",
10
+ "strokeWidth": "2"
11
+ },
12
+ {
13
+ "d": "m8.2 9.8-1.4 1.4a4 4 0 0 0 5.7 5.7l1.2-1.2",
14
+ "fill": false,
15
+ "stroke": true,
16
+ "strokeLinecap": "round",
17
+ "strokeLinejoin": "round",
18
+ "strokeWidth": "2"
19
+ },
20
+ {
21
+ "d": "m10.3 8.3 1.2-1.2a4 4 0 0 1 5.7 5.7l-1.4 1.4",
22
+ "fill": false,
23
+ "stroke": true,
24
+ "strokeLinecap": "round",
25
+ "strokeLinejoin": "round",
26
+ "strokeWidth": "2"
27
+ }
28
+ ]
29
+ },
30
+ "device": {
31
+ "viewBox": "0 0 24 24",
32
+ "lines": [
33
+ {
34
+ "x1": "9",
35
+ "y1": "12",
36
+ "x2": "15",
37
+ "y2": "7",
38
+ "strokeWidth": "2"
39
+ },
40
+ {
41
+ "x1": "9",
42
+ "y1": "12",
43
+ "x2": "15",
44
+ "y2": "17",
45
+ "strokeWidth": "2"
46
+ }
47
+ ],
48
+ "circles": [
49
+ {
50
+ "cx": "7",
51
+ "cy": "12",
52
+ "r": "2.6",
53
+ "fill": false,
54
+ "stroke": true,
55
+ "strokeWidth": "2"
56
+ },
57
+ {
58
+ "cx": "17",
59
+ "cy": "6",
60
+ "r": "2.6",
61
+ "fill": false,
62
+ "stroke": true,
63
+ "strokeWidth": "2"
64
+ },
65
+ {
66
+ "cx": "17",
67
+ "cy": "18",
68
+ "r": "2.6",
69
+ "fill": false,
70
+ "stroke": true,
71
+ "strokeWidth": "2"
72
+ }
73
+ ]
74
+ },
75
+ "telegram": {
76
+ "viewBox": "0 0 24 24",
77
+ "paths": [
78
+ {
79
+ "d": "M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"
80
+ }
81
+ ]
82
+ },
83
+ "line": {
84
+ "viewBox": "0 0 24 24",
85
+ "paths": [
86
+ {
87
+ "d": "M19.365 9.863c.349 0 .63.285.63.631 0 .345-.281.63-.63.63H17.61v1.125h1.755c.349 0 .63.283.63.63 0 .344-.281.629-.63.629h-2.386c-.345 0-.627-.285-.627-.629V8.108c0-.345.282-.63.63-.63h2.386c.346 0 .627.285.627.63 0 .349-.281.63-.63.63H17.61v1.125h1.755zm-3.855 3.016c0 .27-.174.51-.432.596-.064.021-.133.031-.199.031-.211 0-.391-.09-.51-.25l-2.443-3.317v2.94c0 .344-.279.629-.631.629-.346 0-.626-.285-.626-.629V8.108c0-.27.173-.51.43-.595.06-.023.136-.033.194-.033.195 0 .375.104.495.254l2.462 3.33V8.108c0-.345.282-.63.63-.63.345 0 .63.285.63.63v4.771zm-5.741 0c0 .344-.282.629-.631.629-.345 0-.627-.285-.627-.629V8.108c0-.345.282-.63.63-.63.346 0 .628.285.628.63v4.771zm-2.466.629H4.917c-.345 0-.63-.285-.63-.629V8.108c0-.345.285-.63.63-.63.348 0 .63.285.63.63v4.141h1.756c.348 0 .629.283.629.63 0 .344-.282.629-.629.629M24 10.314C24 4.943 18.615.572 12 .572S0 4.943 0 10.314c0 4.811 4.27 8.842 10.035 9.608.391.082.923.258 1.058.59.12.301.079.766.038 1.08l-.164 1.02c-.045.301-.24 1.186 1.049.645 1.291-.539 6.916-4.078 9.436-6.975C23.176 14.393 24 12.458 24 10.314"
88
+ }
89
+ ]
90
+ },
91
+ "whatsapp": {
92
+ "viewBox": "0 0 24 24",
93
+ "paths": [
94
+ {
95
+ "d": "M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"
96
+ }
97
+ ]
98
+ },
99
+ "x": {
100
+ "viewBox": "0 0 24 24",
101
+ "paths": [
102
+ {
103
+ "d": "M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z"
104
+ }
105
+ ]
106
+ },
107
+ "reddit": {
108
+ "viewBox": "0 0 24 24",
109
+ "paths": [
110
+ {
111
+ "d": "M12 0C5.373 0 0 5.373 0 12c0 3.314 1.343 6.314 3.515 8.485l-2.286 2.286C.775 23.225 1.097 24 1.738 24H12c6.627 0 12-5.373 12-12S18.627 0 12 0Zm4.388 3.199c1.104 0 1.999.895 1.999 1.999 0 1.105-.895 2-1.999 2-.946 0-1.739-.657-1.947-1.539v.002c-1.147.162-2.032 1.15-2.032 2.341v.007c1.776.067 3.4.567 4.686 1.363.473-.363 1.064-.58 1.707-.58 1.547 0 2.802 1.254 2.802 2.802 0 1.117-.655 2.081-1.601 2.531-.088 3.256-3.637 5.876-7.997 5.876-4.361 0-7.905-2.617-7.998-5.87-.954-.447-1.614-1.415-1.614-2.538 0-1.548 1.255-2.802 2.803-2.802.645 0 1.239.218 1.712.585 1.275-.79 2.881-1.291 4.64-1.365v-.01c0-1.663 1.263-3.034 2.88-3.207.188-.911.993-1.595 1.959-1.595Zm-8.085 8.376c-.784 0-1.459.78-1.506 1.797-.047 1.016.64 1.429 1.426 1.429.786 0 1.371-.369 1.418-1.385.047-1.017-.553-1.841-1.338-1.841Zm7.406 0c-.786 0-1.385.824-1.338 1.841.047 1.017.634 1.385 1.418 1.385.785 0 1.473-.413 1.426-1.429-.046-1.017-.721-1.797-1.506-1.797Zm-3.703 4.013c-.974 0-1.907.048-2.77.135-.147.015-.241.168-.183.305.483 1.154 1.622 1.964 2.953 1.964 1.33 0 2.47-.81 2.953-1.964.057-.137-.037-.29-.184-.305-.863-.087-1.795-.135-2.769-.135Z"
112
+ }
113
+ ]
114
+ }
115
+ };
package/dist/share.ts ADDED
@@ -0,0 +1,99 @@
1
+ export type ZdpShareIconName = 'copy' | 'device' | 'telegram' | 'line' | 'whatsapp' | 'x' | 'reddit';
2
+
3
+ export interface ZdpShareIconPath {
4
+ readonly d: string;
5
+ readonly fill?: boolean;
6
+ readonly stroke?: boolean;
7
+ readonly strokeLinecap?: 'round';
8
+ readonly strokeLinejoin?: 'round';
9
+ readonly strokeWidth?: string;
10
+ }
11
+
12
+ export interface ZdpShareIconCircle {
13
+ readonly cx: string;
14
+ readonly cy: string;
15
+ readonly r: string;
16
+ readonly fill?: boolean;
17
+ readonly stroke?: boolean;
18
+ readonly strokeWidth?: string;
19
+ }
20
+
21
+ export interface ZdpShareIconLine {
22
+ readonly x1: string;
23
+ readonly y1: string;
24
+ readonly x2: string;
25
+ readonly y2: string;
26
+ readonly strokeWidth?: string;
27
+ }
28
+
29
+ export interface ZdpShareIconShape {
30
+ readonly viewBox: string;
31
+ readonly paths?: readonly ZdpShareIconPath[];
32
+ readonly circles?: readonly ZdpShareIconCircle[];
33
+ readonly lines?: readonly ZdpShareIconLine[];
34
+ }
35
+
36
+ export interface ZdpShareDockItem {
37
+ readonly id: string;
38
+ readonly label: string;
39
+ readonly icon: ZdpShareIconName;
40
+ readonly href?: string;
41
+ readonly target?: '_blank' | '_self' | '_parent' | '_top';
42
+ readonly rel?: string;
43
+ readonly disabled?: boolean;
44
+ readonly ariaLabel?: string;
45
+ readonly onclick?: (event: MouseEvent, item: ZdpShareDockItem) => void;
46
+ }
47
+
48
+ export const zdpShareIcons: Record<ZdpShareIconName, ZdpShareIconShape> = {
49
+ copy: {
50
+ viewBox: '0 0 24 24',
51
+ paths: [
52
+ { d: 'M9.5 13.5 14.5 8.5', fill: false, stroke: true, strokeLinecap: 'round', strokeWidth: '2' },
53
+ { d: 'm8.2 9.8-1.4 1.4a4 4 0 0 0 5.7 5.7l1.2-1.2', fill: false, stroke: true, strokeLinecap: 'round', strokeLinejoin: 'round', strokeWidth: '2' },
54
+ { d: 'm10.3 8.3 1.2-1.2a4 4 0 0 1 5.7 5.7l-1.4 1.4', fill: false, stroke: true, strokeLinecap: 'round', strokeLinejoin: 'round', strokeWidth: '2' }
55
+ ]
56
+ },
57
+ device: {
58
+ viewBox: '0 0 24 24',
59
+ lines: [
60
+ { x1: '9', y1: '12', x2: '15', y2: '7', strokeWidth: '2' },
61
+ { x1: '9', y1: '12', x2: '15', y2: '17', strokeWidth: '2' }
62
+ ],
63
+ circles: [
64
+ { cx: '7', cy: '12', r: '2.6', fill: false, stroke: true, strokeWidth: '2' },
65
+ { cx: '17', cy: '6', r: '2.6', fill: false, stroke: true, strokeWidth: '2' },
66
+ { cx: '17', cy: '18', r: '2.6', fill: false, stroke: true, strokeWidth: '2' }
67
+ ]
68
+ },
69
+ telegram: {
70
+ viewBox: '0 0 24 24',
71
+ paths: [
72
+ { d: 'M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z' }
73
+ ]
74
+ },
75
+ line: {
76
+ viewBox: '0 0 24 24',
77
+ paths: [
78
+ { d: 'M19.365 9.863c.349 0 .63.285.63.631 0 .345-.281.63-.63.63H17.61v1.125h1.755c.349 0 .63.283.63.63 0 .344-.281.629-.63.629h-2.386c-.345 0-.627-.285-.627-.629V8.108c0-.345.282-.63.63-.63h2.386c.346 0 .627.285.627.63 0 .349-.281.63-.63.63H17.61v1.125h1.755zm-3.855 3.016c0 .27-.174.51-.432.596-.064.021-.133.031-.199.031-.211 0-.391-.09-.51-.25l-2.443-3.317v2.94c0 .344-.279.629-.631.629-.346 0-.626-.285-.626-.629V8.108c0-.27.173-.51.43-.595.06-.023.136-.033.194-.033.195 0 .375.104.495.254l2.462 3.33V8.108c0-.345.282-.63.63-.63.345 0 .63.285.63.63v4.771zm-5.741 0c0 .344-.282.629-.631.629-.345 0-.627-.285-.627-.629V8.108c0-.345.282-.63.63-.63.346 0 .628.285.628.63v4.771zm-2.466.629H4.917c-.345 0-.63-.285-.63-.629V8.108c0-.345.285-.63.63-.63.348 0 .63.285.63.63v4.141h1.756c.348 0 .629.283.629.63 0 .344-.282.629-.629.629M24 10.314C24 4.943 18.615.572 12 .572S0 4.943 0 10.314c0 4.811 4.27 8.842 10.035 9.608.391.082.923.258 1.058.59.12.301.079.766.038 1.08l-.164 1.02c-.045.301-.24 1.186 1.049.645 1.291-.539 6.916-4.078 9.436-6.975C23.176 14.393 24 12.458 24 10.314' }
79
+ ]
80
+ },
81
+ whatsapp: {
82
+ viewBox: '0 0 24 24',
83
+ paths: [
84
+ { d: 'M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z' }
85
+ ]
86
+ },
87
+ x: {
88
+ viewBox: '0 0 24 24',
89
+ paths: [
90
+ { d: 'M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z' }
91
+ ]
92
+ },
93
+ reddit: {
94
+ viewBox: '0 0 24 24',
95
+ paths: [
96
+ { d: 'M12 0C5.373 0 0 5.373 0 12c0 3.314 1.343 6.314 3.515 8.485l-2.286 2.286C.775 23.225 1.097 24 1.738 24H12c6.627 0 12-5.373 12-12S18.627 0 12 0Zm4.388 3.199c1.104 0 1.999.895 1.999 1.999 0 1.105-.895 2-1.999 2-.946 0-1.739-.657-1.947-1.539v.002c-1.147.162-2.032 1.15-2.032 2.341v.007c1.776.067 3.4.567 4.686 1.363.473-.363 1.064-.58 1.707-.58 1.547 0 2.802 1.254 2.802 2.802 0 1.117-.655 2.081-1.601 2.531-.088 3.256-3.637 5.876-7.997 5.876-4.361 0-7.905-2.617-7.998-5.87-.954-.447-1.614-1.415-1.614-2.538 0-1.548 1.255-2.802 2.803-2.802.645 0 1.239.218 1.712.585 1.275-.79 2.881-1.291 4.64-1.365v-.01c0-1.663 1.263-3.034 2.88-3.207.188-.911.993-1.595 1.959-1.595Zm-8.085 8.376c-.784 0-1.459.78-1.506 1.797-.047 1.016.64 1.429 1.426 1.429.786 0 1.371-.369 1.418-1.385.047-1.017-.553-1.841-1.338-1.841Zm7.406 0c-.786 0-1.385.824-1.338 1.841.047 1.017.634 1.385 1.418 1.385.785 0 1.473-.413 1.426-1.429-.046-1.017-.721-1.797-1.506-1.797Zm-3.703 4.013c-.974 0-1.907.048-2.77.135-.147.015-.241.168-.183.305.483 1.154 1.622 1.964 2.953 1.964 1.33 0 2.47-.81 2.953-1.964.057-.137-.037-.29-.184-.305-.863-.087-1.795-.135-2.769-.135Z' }
97
+ ]
98
+ }
99
+ };
package/dist/sheet.ts ADDED
@@ -0,0 +1,3 @@
1
+ export type ZdpSheetPlacement = 'right' | 'left' | 'bottom';
2
+
3
+ export type ZdpSheetSize = 'sm' | 'md' | 'lg';
@@ -0,0 +1,125 @@
1
+ const textEntrySelector = [
2
+ 'input',
3
+ 'textarea',
4
+ 'select',
5
+ '[contenteditable=""]',
6
+ '[contenteditable="true"]',
7
+ '[role="textbox"]',
8
+ '[role="searchbox"]',
9
+ '[role="combobox"]',
10
+ '[role="spinbutton"]'
11
+ ].join(',');
12
+
13
+ const reservedModifierKeys = new Set([
14
+ 'a',
15
+ 'c',
16
+ 'f',
17
+ 'l',
18
+ 'n',
19
+ 'o',
20
+ 'p',
21
+ 'q',
22
+ 'r',
23
+ 's',
24
+ 't',
25
+ 'v',
26
+ 'w',
27
+ 'x',
28
+ 'y',
29
+ 'z'
30
+ ]);
31
+
32
+ const reservedFunctionKeys = new Set(['F5', 'F11', 'F12']);
33
+
34
+ export const zdpShortcutRecommendations = [
35
+ { intent: 'search', keys: ['/'], risk: 'safe', scope: 'global' },
36
+ { intent: 'help', keys: ['?'], risk: 'safe', scope: 'global' },
37
+ { intent: 'escape', keys: ['Esc'], risk: 'safe', scope: 'global' },
38
+ { intent: 'open', keys: ['Enter'], risk: 'safe', scope: 'focused-list' },
39
+ { intent: 'previous', keys: ['ArrowUp'], risk: 'safe', scope: 'focused-list' },
40
+ { intent: 'next', keys: ['ArrowDown'], risk: 'safe', scope: 'focused-list' },
41
+ { intent: 'submit', keys: ['Mod', 'Enter'], risk: 'safe', scope: 'focused-form' },
42
+ { intent: 'create', keys: ['N'], risk: 'safe', scope: 'global' },
43
+ { intent: 'edit', keys: ['E'], risk: 'safe', scope: 'global' },
44
+ { intent: 'filter', keys: ['F'], risk: 'safe', scope: 'global' },
45
+ { intent: 'goHome', keys: ['G', 'H'], risk: 'safe', scope: 'sequence' },
46
+ { intent: 'goSettings', keys: ['G', 'S'], risk: 'safe', scope: 'sequence' }
47
+ ];
48
+
49
+ export const zdpShortcutReservedExamples = [
50
+ 'Ctrl+S',
51
+ 'Ctrl+P',
52
+ 'Ctrl+F',
53
+ 'Ctrl+R',
54
+ 'Ctrl+L',
55
+ 'Ctrl+T',
56
+ 'Ctrl+W',
57
+ 'Ctrl+A',
58
+ 'Ctrl+C',
59
+ 'Ctrl+V',
60
+ 'Ctrl+X',
61
+ 'Ctrl+Z',
62
+ 'Ctrl+Y',
63
+ 'Cmd+S',
64
+ 'Cmd+P',
65
+ 'Cmd+F',
66
+ 'Cmd+R',
67
+ 'Cmd+L',
68
+ 'Cmd+T',
69
+ 'Cmd+W',
70
+ 'Cmd+Q',
71
+ 'Alt+ArrowLeft',
72
+ 'Alt+ArrowRight',
73
+ 'F5',
74
+ 'F11',
75
+ 'F12',
76
+ 'Space',
77
+ 'Backspace'
78
+ ];
79
+
80
+ export function isZdpTextEntryTarget(target) {
81
+ if (!(target instanceof Element)) {
82
+ return false;
83
+ }
84
+
85
+ return target.closest(textEntrySelector) !== null;
86
+ }
87
+
88
+ export function isZdpBrowserReservedShortcut(event) {
89
+ if (reservedFunctionKeys.has(event.key)) {
90
+ return true;
91
+ }
92
+
93
+ if (!event.ctrlKey && !event.metaKey && !event.altKey) {
94
+ return event.key === ' ' || event.key === 'Spacebar' || event.key === 'Backspace';
95
+ }
96
+
97
+ if (event.altKey && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
98
+ return true;
99
+ }
100
+
101
+ if (event.ctrlKey || event.metaKey) {
102
+ return reservedModifierKeys.has(event.key.toLowerCase());
103
+ }
104
+
105
+ return false;
106
+ }
107
+
108
+ export function shouldZdpIgnoreShortcutEvent(
109
+ event,
110
+ options = {}
111
+ ) {
112
+ if (event.defaultPrevented || event.isComposing || event.keyCode === 229) {
113
+ return true;
114
+ }
115
+
116
+ if (!options.allowTextEntryTarget && isZdpTextEntryTarget(event.target)) {
117
+ return true;
118
+ }
119
+
120
+ if (!options.allowBrowserReservedShortcut && isZdpBrowserReservedShortcut(event)) {
121
+ return true;
122
+ }
123
+
124
+ return false;
125
+ }
@@ -0,0 +1,153 @@
1
+ export type ZdpShortcutIntent =
2
+ | 'search'
3
+ | 'help'
4
+ | 'escape'
5
+ | 'open'
6
+ | 'submit'
7
+ | 'create'
8
+ | 'edit'
9
+ | 'filter'
10
+ | 'next'
11
+ | 'previous'
12
+ | 'goHome'
13
+ | 'goSettings';
14
+
15
+ export type ZdpShortcutRisk = 'safe' | 'confirm' | 'reserved';
16
+
17
+ export interface ZdpShortcutRecommendation {
18
+ readonly intent: ZdpShortcutIntent;
19
+ readonly keys: readonly string[];
20
+ readonly risk: ZdpShortcutRisk;
21
+ readonly scope: 'global' | 'focused-list' | 'focused-form' | 'sequence';
22
+ }
23
+
24
+ export interface ZdpShortcutGuardOptions {
25
+ readonly allowTextEntryTarget?: boolean;
26
+ readonly allowBrowserReservedShortcut?: boolean;
27
+ }
28
+
29
+ const textEntrySelector = [
30
+ 'input',
31
+ 'textarea',
32
+ 'select',
33
+ '[contenteditable=""]',
34
+ '[contenteditable="true"]',
35
+ '[role="textbox"]',
36
+ '[role="searchbox"]',
37
+ '[role="combobox"]',
38
+ '[role="spinbutton"]'
39
+ ].join(',');
40
+
41
+ const reservedModifierKeys = new Set([
42
+ 'a',
43
+ 'c',
44
+ 'f',
45
+ 'l',
46
+ 'n',
47
+ 'o',
48
+ 'p',
49
+ 'q',
50
+ 'r',
51
+ 's',
52
+ 't',
53
+ 'v',
54
+ 'w',
55
+ 'x',
56
+ 'y',
57
+ 'z'
58
+ ]);
59
+
60
+ const reservedFunctionKeys = new Set(['F5', 'F11', 'F12']);
61
+
62
+ export const zdpShortcutRecommendations = [
63
+ { intent: 'search', keys: ['/'], risk: 'safe', scope: 'global' },
64
+ { intent: 'help', keys: ['?'], risk: 'safe', scope: 'global' },
65
+ { intent: 'escape', keys: ['Esc'], risk: 'safe', scope: 'global' },
66
+ { intent: 'open', keys: ['Enter'], risk: 'safe', scope: 'focused-list' },
67
+ { intent: 'previous', keys: ['ArrowUp'], risk: 'safe', scope: 'focused-list' },
68
+ { intent: 'next', keys: ['ArrowDown'], risk: 'safe', scope: 'focused-list' },
69
+ { intent: 'submit', keys: ['Mod', 'Enter'], risk: 'safe', scope: 'focused-form' },
70
+ { intent: 'create', keys: ['N'], risk: 'safe', scope: 'global' },
71
+ { intent: 'edit', keys: ['E'], risk: 'safe', scope: 'global' },
72
+ { intent: 'filter', keys: ['F'], risk: 'safe', scope: 'global' },
73
+ { intent: 'goHome', keys: ['G', 'H'], risk: 'safe', scope: 'sequence' },
74
+ { intent: 'goSettings', keys: ['G', 'S'], risk: 'safe', scope: 'sequence' }
75
+ ] as const satisfies readonly ZdpShortcutRecommendation[];
76
+
77
+ export const zdpShortcutReservedExamples = [
78
+ 'Ctrl+S',
79
+ 'Ctrl+P',
80
+ 'Ctrl+F',
81
+ 'Ctrl+R',
82
+ 'Ctrl+L',
83
+ 'Ctrl+T',
84
+ 'Ctrl+W',
85
+ 'Ctrl+A',
86
+ 'Ctrl+C',
87
+ 'Ctrl+V',
88
+ 'Ctrl+X',
89
+ 'Ctrl+Z',
90
+ 'Ctrl+Y',
91
+ 'Cmd+S',
92
+ 'Cmd+P',
93
+ 'Cmd+F',
94
+ 'Cmd+R',
95
+ 'Cmd+L',
96
+ 'Cmd+T',
97
+ 'Cmd+W',
98
+ 'Cmd+Q',
99
+ 'Alt+ArrowLeft',
100
+ 'Alt+ArrowRight',
101
+ 'F5',
102
+ 'F11',
103
+ 'F12',
104
+ 'Space',
105
+ 'Backspace'
106
+ ] as const;
107
+
108
+ export function isZdpTextEntryTarget(target: EventTarget | null): boolean {
109
+ if (!(target instanceof Element)) {
110
+ return false;
111
+ }
112
+
113
+ return target.closest(textEntrySelector) !== null;
114
+ }
115
+
116
+ export function isZdpBrowserReservedShortcut(event: KeyboardEvent): boolean {
117
+ if (reservedFunctionKeys.has(event.key)) {
118
+ return true;
119
+ }
120
+
121
+ if (!event.ctrlKey && !event.metaKey && !event.altKey) {
122
+ return event.key === ' ' || event.key === 'Spacebar' || event.key === 'Backspace';
123
+ }
124
+
125
+ if (event.altKey && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
126
+ return true;
127
+ }
128
+
129
+ if (event.ctrlKey || event.metaKey) {
130
+ return reservedModifierKeys.has(event.key.toLowerCase());
131
+ }
132
+
133
+ return false;
134
+ }
135
+
136
+ export function shouldZdpIgnoreShortcutEvent(
137
+ event: KeyboardEvent,
138
+ options: ZdpShortcutGuardOptions = {}
139
+ ): boolean {
140
+ if (event.defaultPrevented || event.isComposing || event.keyCode === 229) {
141
+ return true;
142
+ }
143
+
144
+ if (!options.allowTextEntryTarget && isZdpTextEntryTarget(event.target)) {
145
+ return true;
146
+ }
147
+
148
+ if (!options.allowBrowserReservedShortcut && isZdpBrowserReservedShortcut(event)) {
149
+ return true;
150
+ }
151
+
152
+ return false;
153
+ }