@polyxd/core 0.3.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.
- package/LICENSE +202 -0
- package/NOTICE +190 -0
- package/README.md +43 -0
- package/dist/actionbar.d.ts +20 -0
- package/dist/actionbar.js +34 -0
- package/dist/actionbar.js.map +1 -0
- package/dist/actions.d.ts +24 -0
- package/dist/actions.js +33 -0
- package/dist/actions.js.map +1 -0
- package/dist/avatar.d.ts +13 -0
- package/dist/avatar.js +63 -0
- package/dist/avatar.js.map +1 -0
- package/dist/chart.d.ts +41 -0
- package/dist/chart.js +106 -0
- package/dist/chart.js.map +1 -0
- package/dist/choice.d.ts +35 -0
- package/dist/choice.js +32 -0
- package/dist/choice.js.map +1 -0
- package/dist/collection.d.ts +54 -0
- package/dist/collection.js +61 -0
- package/dist/collection.js.map +1 -0
- package/dist/color.d.ts +20 -0
- package/dist/color.js +105 -0
- package/dist/color.js.map +1 -0
- package/dist/comparison.d.ts +21 -0
- package/dist/comparison.js +51 -0
- package/dist/comparison.js.map +1 -0
- package/dist/data.d.ts +30 -0
- package/dist/data.js +67 -0
- package/dist/data.js.map +1 -0
- package/dist/document.d.ts +64 -0
- package/dist/document.js +18 -0
- package/dist/document.js.map +1 -0
- package/dist/files.d.ts +18 -0
- package/dist/files.js +64 -0
- package/dist/files.js.map +1 -0
- package/dist/filter.d.ts +17 -0
- package/dist/filter.js +55 -0
- package/dist/filter.js.map +1 -0
- package/dist/format.d.ts +21 -0
- package/dist/format.js +81 -0
- package/dist/format.js.map +1 -0
- package/dist/frame.d.ts +21 -0
- package/dist/frame.js +30 -0
- package/dist/frame.js.map +1 -0
- package/dist/ids.d.ts +4 -0
- package/dist/ids.js +8 -0
- package/dist/ids.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/marks.d.ts +48 -0
- package/dist/marks.js +57 -0
- package/dist/marks.js.map +1 -0
- package/dist/mask.d.ts +10 -0
- package/dist/mask.js +40 -0
- package/dist/mask.js.map +1 -0
- package/dist/options.d.ts +11 -0
- package/dist/options.js +21 -0
- package/dist/options.js.map +1 -0
- package/dist/qr.d.ts +3 -0
- package/dist/qr.js +242 -0
- package/dist/qr.js.map +1 -0
- package/dist/richtext.d.ts +17 -0
- package/dist/richtext.js +59 -0
- package/dist/richtext.js.map +1 -0
- package/dist/shortcuts.d.ts +32 -0
- package/dist/shortcuts.js +59 -0
- package/dist/shortcuts.js.map +1 -0
- package/dist/skeleton.d.ts +22 -0
- package/dist/skeleton.js +32 -0
- package/dist/skeleton.js.map +1 -0
- package/dist/split.d.ts +53 -0
- package/dist/split.js +55 -0
- package/dist/split.js.map +1 -0
- package/dist/steps.d.ts +32 -0
- package/dist/steps.js +24 -0
- package/dist/steps.js.map +1 -0
- package/dist/surface.d.ts +52 -0
- package/dist/surface.js +64 -0
- package/dist/surface.js.map +1 -0
- package/dist/table.d.ts +34 -0
- package/dist/table.js +30 -0
- package/dist/table.js.map +1 -0
- package/dist/tree.d.ts +58 -0
- package/dist/tree.js +93 -0
- package/dist/tree.js.map +1 -0
- package/dist/views.d.ts +11 -0
- package/dist/views.js +10 -0
- package/dist/views.js.map +1 -0
- package/package.json +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
package/NOTICE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Polyxd
|
|
2
|
+
Copyright 2026 the Polyxd authors
|
|
3
|
+
|
|
4
|
+
This product includes software developed at Polyxd, licensed under the Apache
|
|
5
|
+
License, Version 2.0 (see LICENSE).
|
|
6
|
+
|
|
7
|
+
It also includes material from the projects below. Each is used under its own
|
|
8
|
+
licence, and each licence is included in full beside the material it covers.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Design-system packs
|
|
12
|
+
|
|
13
|
+
A pack reads a design system's published tokens and maps them onto Polyxd's
|
|
14
|
+
semantic token contract. The upstream token files are vendored verbatim — so a
|
|
15
|
+
pack can be regenerated and audited without a network — under that pack's
|
|
16
|
+
`scripts/sources/` directory, together with the upstream licence.
|
|
17
|
+
|
|
18
|
+
The packs are Polyxd's work, not the work of the design systems they read. The
|
|
19
|
+
names below identify whose tokens a pack reads. Polyxd is not affiliated with,
|
|
20
|
+
endorsed by, or sponsored by any of these projects or their owners, and each
|
|
21
|
+
name is the trademark of its owner.
|
|
22
|
+
|
|
23
|
+
### Ant Design (`@polyxd/ds-antd`)
|
|
24
|
+
|
|
25
|
+
Upstream: https://github.com/ant-design/ant-design
|
|
26
|
+
|
|
27
|
+
- npm:antd 6.6.4 — MIT
|
|
28
|
+
- npm:@ant-design/colors 8.0.1 — MIT
|
|
29
|
+
|
|
30
|
+
Vendored under `packages/ds-antd/scripts/sources/`, with the upstream licence file beside it.
|
|
31
|
+
|
|
32
|
+
### Bootstrap 5 (`@polyxd/ds-bootstrap`)
|
|
33
|
+
|
|
34
|
+
Upstream: https://github.com/twbs/bootstrap
|
|
35
|
+
|
|
36
|
+
- npm:bootstrap dist/css/bootstrap.css 5.3.8 — MIT
|
|
37
|
+
|
|
38
|
+
Vendored under `packages/ds-bootstrap/scripts/sources/`, with the upstream licence file beside it.
|
|
39
|
+
|
|
40
|
+
### IBM Carbon (`@polyxd/ds-carbon`)
|
|
41
|
+
|
|
42
|
+
Upstream: https://github.com/carbon-design-system/carbon
|
|
43
|
+
|
|
44
|
+
- npm:@carbon/colors 11.58.0 — Apache-2.0
|
|
45
|
+
- npm:@carbon/themes 11.81.0 — Apache-2.0
|
|
46
|
+
- npm:@carbon/layout 11.59.0 — Apache-2.0
|
|
47
|
+
- npm:@carbon/type 11.67.0 — Apache-2.0
|
|
48
|
+
- npm:@carbon/motion 11.52.0 — Apache-2.0
|
|
49
|
+
- npm:@carbon/charts scss/_color-palette.scss 1.27.20 — Apache-2.0
|
|
50
|
+
- npm:@carbon/styles scss/utilities/_box-shadow.scss and _focus-outline.scss 1.115.0 — Apache-2.0
|
|
51
|
+
|
|
52
|
+
Vendored under `packages/ds-carbon/scripts/sources/`, with the upstream licence file beside it.
|
|
53
|
+
|
|
54
|
+
### Chakra UI 3 (`@polyxd/ds-chakra`)
|
|
55
|
+
|
|
56
|
+
Upstream: https://github.com/chakra-ui/chakra-ui
|
|
57
|
+
|
|
58
|
+
- npm:@chakra-ui/react defaultSystem.getTokenCss 3.37.0 — MIT
|
|
59
|
+
|
|
60
|
+
Vendored under `packages/ds-chakra/scripts/sources/`, with the upstream licence file beside it.
|
|
61
|
+
|
|
62
|
+
### Microsoft Fluent 2 (`@polyxd/ds-fluent`)
|
|
63
|
+
|
|
64
|
+
Upstream: https://github.com/microsoft/fluentui
|
|
65
|
+
|
|
66
|
+
- npm:@fluentui/tokens 1.0.0-alpha.24 — MIT
|
|
67
|
+
|
|
68
|
+
Vendored under `packages/ds-fluent/scripts/sources/`, with the upstream licence file beside it.
|
|
69
|
+
|
|
70
|
+
### GOV.UK Frontend (`@polyxd/ds-govuk`)
|
|
71
|
+
|
|
72
|
+
Upstream: https://github.com/alphagov/govuk-frontend
|
|
73
|
+
|
|
74
|
+
- npm:govuk-frontend dist/govuk/settings 6.5.1 — MIT
|
|
75
|
+
|
|
76
|
+
Vendored under `packages/ds-govuk/scripts/sources/`, with the upstream licence file beside it.
|
|
77
|
+
|
|
78
|
+
### Mantine 8 (`@polyxd/ds-mantine`)
|
|
79
|
+
|
|
80
|
+
Upstream: https://github.com/mantinedev/mantine
|
|
81
|
+
|
|
82
|
+
- npm:@mantine/core styles.css 8.4.2 — MIT
|
|
83
|
+
|
|
84
|
+
Vendored under `packages/ds-mantine/scripts/sources/`, with the upstream licence file beside it.
|
|
85
|
+
|
|
86
|
+
### Material 3 (`@polyxd/ds-material3`)
|
|
87
|
+
|
|
88
|
+
Upstream: https://github.com/material-components/material-web
|
|
89
|
+
|
|
90
|
+
- npm:@material/material-color-utilities 0.4.0 — Apache-2.0
|
|
91
|
+
- github:material-components/material-web tokens/versions/v0_192/_md-ref-typeface.scss, _md-sys-typescale.scss, _md-sys-shape.scss, _md-sys-motion.scss, _md-sys-state.scss, _md-sys-elevation.scss v2.5.0 (commit b4de401eb665ec63474f39319a4ba8f2145974cc) — Apache-2.0
|
|
92
|
+
- github:material-components/material-web tokens/versions/v0_192/_md-comp-scrim.scss, _md-comp-filled-button.scss, _md-comp-icon-button.scss, _md-comp-outlined-text-field.scss v2.5.0 (commit b4de401eb665ec63474f39319a4ba8f2145974cc) — Apache-2.0
|
|
93
|
+
- github:material-components/material-web tokens/_md-comp-focus-ring.scss and elevation/internal/_elevation.scss v2.5.0 (commit b4de401eb665ec63474f39319a4ba8f2145974cc) — Apache-2.0
|
|
94
|
+
|
|
95
|
+
Vendored under `packages/ds-material3/scripts/sources/`, with the upstream licence file beside it.
|
|
96
|
+
|
|
97
|
+
### Shopify Polaris (`@polyxd/ds-polaris`)
|
|
98
|
+
|
|
99
|
+
Upstream: https://github.com/Shopify/polaris
|
|
100
|
+
|
|
101
|
+
- npm:@shopify/polaris-tokens dist/css/styles.css 9.4.2 — MIT
|
|
102
|
+
|
|
103
|
+
Vendored under `packages/ds-polaris/scripts/sources/`, with the upstream licence file beside it.
|
|
104
|
+
|
|
105
|
+
### GitHub Primer (`@polyxd/ds-primer`)
|
|
106
|
+
|
|
107
|
+
Upstream: https://github.com/primer/primitives
|
|
108
|
+
|
|
109
|
+
- npm:@primer/primitives dist/css 11.10.0 — MIT
|
|
110
|
+
|
|
111
|
+
Vendored under `packages/ds-primer/scripts/sources/`, with the upstream licence file beside it.
|
|
112
|
+
|
|
113
|
+
### Radix Themes 3 (`@polyxd/ds-radix`)
|
|
114
|
+
|
|
115
|
+
Upstream: https://github.com/radix-ui/themes
|
|
116
|
+
|
|
117
|
+
- npm:@radix-ui/themes styles.css 3.3.0 — MIT
|
|
118
|
+
|
|
119
|
+
Vendored under `packages/ds-radix/scripts/sources/`, with the upstream licence file beside it.
|
|
120
|
+
|
|
121
|
+
### shadcn/ui on Tailwind CSS (`@polyxd/ds-shadcn`)
|
|
122
|
+
|
|
123
|
+
Upstream: https://github.com/shadcn-ui/ui
|
|
124
|
+
|
|
125
|
+
- shadcn/ui default theme main @ 2026-09-20 — MIT
|
|
126
|
+
- npm:tailwindcss theme.css 4.3.3 — MIT
|
|
127
|
+
|
|
128
|
+
Vendored under `packages/ds-shadcn/scripts/sources/`, with the upstream licence file beside it.
|
|
129
|
+
|
|
130
|
+
### Adobe Spectrum 2 (`@polyxd/ds-spectrum`)
|
|
131
|
+
|
|
132
|
+
Upstream: https://github.com/adobe/spectrum-tokens
|
|
133
|
+
|
|
134
|
+
- npm:@adobe/spectrum-tokens dist/json/variables.json 15.4.1 — Apache-2.0
|
|
135
|
+
|
|
136
|
+
Vendored under `packages/ds-spectrum/scripts/sources/`, with the upstream licence file beside it.
|
|
137
|
+
|
|
138
|
+
## Template packs
|
|
139
|
+
|
|
140
|
+
Twelve packs are original Polyxd templates, not readings of any design system:
|
|
141
|
+
`@polyxd/ds-sketch`, `@polyxd/ds-wireframe`, `@polyxd/ds-editorial`,
|
|
142
|
+
`@polyxd/ds-brutalist`, `@polyxd/ds-glass`, `@polyxd/ds-terminal`,
|
|
143
|
+
`@polyxd/ds-pastel`, `@polyxd/ds-civic`, `@polyxd/ds-finance`,
|
|
144
|
+
`@polyxd/ds-health`, `@polyxd/ds-neon` and `@polyxd/ds-mono`. Every value in
|
|
145
|
+
them was chosen for the template, they vendor nothing, and they are Apache-2.0
|
|
146
|
+
like the rest of Polyxd. The typefaces some of them name (Caveat, Patrick Hand,
|
|
147
|
+
Fraunces, Nunito, JetBrains Mono, Space Grotesk) are under the SIL Open Font
|
|
148
|
+
License and are loaded from Google Fonts by the page that uses them, never
|
|
149
|
+
distributed here.
|
|
150
|
+
|
|
151
|
+
## Specification
|
|
152
|
+
|
|
153
|
+
### A2UI
|
|
154
|
+
|
|
155
|
+
- `packages/a2ui/vendor/a2ui/v1_0-04e6f07/` — Apache-2.0
|
|
156
|
+
|
|
157
|
+
Vendored at a pinned commit so the component catalogue can be checked against
|
|
158
|
+
A2UI's schema without a network.
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
## Dependencies
|
|
162
|
+
|
|
163
|
+
Everything Polyxd depends on at runtime or to build is fetched from npm rather
|
|
164
|
+
than vendored, so the licences below are recorded rather than reproduced.
|
|
165
|
+
|
|
166
|
+
Apache-2.0: playwright
|
|
167
|
+
MIT: react, react-dom, radix-ui, ajv, ajv-formats, vite, @vitejs/plugin-react,
|
|
168
|
+
marked, lenis, @types/react, @types/react-dom
|
|
169
|
+
MIT OR Apache-2.0: wrangler, @cloudflare/workers-types
|
|
170
|
+
|
|
171
|
+
Two need a word.
|
|
172
|
+
|
|
173
|
+
**axe-core** (Mozilla Public License 2.0) runs inside the verifier's rendered
|
|
174
|
+
audit. MPL-2.0 is file-level copyleft: it attaches to modified MPL files, and
|
|
175
|
+
axe-core is used unmodified, as a library. No Polyxd file is covered by it.
|
|
176
|
+
|
|
177
|
+
**GSAP** (https://gsap.com/standard-license) drives the motion on polyxd.com
|
|
178
|
+
only, and is not an OSI-approved licence. It is not used by the spec, the
|
|
179
|
+
renderer, the packs or the verifier, none of which it can reach; and no GSAP
|
|
180
|
+
file is committed to this repository — the site's build copies them out of
|
|
181
|
+
node_modules into its own output. Anyone building the site is therefore subject
|
|
182
|
+
to GSAP's licence, and anyone using the rest of Polyxd is not.
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
## Fonts
|
|
186
|
+
|
|
187
|
+
No font files are distributed. polyxd.com loads its typefaces from Google Fonts
|
|
188
|
+
at request time, and a design-system pack names the typeface its system
|
|
189
|
+
specifies without shipping it — a pack that asks for Adobe Clean, for example,
|
|
190
|
+
names an open metric-compatible fallback for anyone who does not have it.
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @polyxd/core
|
|
2
|
+
|
|
3
|
+
The framework-free heart of rendering a Polyxd UI document: the document types, JSON Pointer bindings, localised formatting, every decision the renderer makes instead of the model, and a headless surface model. No DOM, no framework, no dependencies. `@polyxd/react` and `@polyxd/web` are both built on it, and a renderer for another platform starts here.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { createSurface } from "@polyxd/core";
|
|
7
|
+
|
|
8
|
+
const surface = createSurface(doc, {
|
|
9
|
+
data: { quote },
|
|
10
|
+
locale: "en-GB",
|
|
11
|
+
onAction: ({ name, context, source }) => handlers[name]?.(context),
|
|
12
|
+
onDataChange: (data) => save(data),
|
|
13
|
+
onDismiss: () => close(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
surface.byId.get(doc.root); // walk the tree from the root
|
|
17
|
+
surface.text({ path: "/quote/amount" }, { type: "currency", currency: "GBP" }); // "£40.00"
|
|
18
|
+
surface.setValue("/draft/amount", 40); // inputs write here; subscribers redraw
|
|
19
|
+
surface.dispatch(node.action, scope, node.id); // ui.dismiss → onDismiss; everything else → onAction
|
|
20
|
+
surface.subscribe((data) => render());
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## What is here
|
|
24
|
+
|
|
25
|
+
| Module | Exports |
|
|
26
|
+
|---|---|
|
|
27
|
+
| Document | `UIDocument`, `Node`, `Action`, `ActionEvent`, `FrameLayout`, `NavigationPlacement`, `COMPONENTS`, `RENDERER_ACTIONS`, `indexById`, `mainNavigation` |
|
|
28
|
+
| Bindings | `get`, `set`, `resolve`, `resolveContext`, `resolveDeep`, `absolute`, `childPointer`, `asList`, `isBinding`, `itemScopes`, `ROOT_SCOPE` |
|
|
29
|
+
| Formatting | `formatValue`, `resolveFormat`, `safeColor`, `currencySymbol`, `formatCount`, `formatPercent` |
|
|
30
|
+
| Surface | `createSurface`, `a11yAttributes`, `dispatchAction`, `contextWithValue`, `copyText`, `rowChangeAction`, `isRendererAction` |
|
|
31
|
+
| Choice | `optionsOf`, `planChoice` (chips, people or list; searchable past 10), `optionKey`, `matchesQuery`, `partitionRecent`, `toggleSelection`, `isSelected`, `searchPlaceholder`, `idOf` |
|
|
32
|
+
| State machines | `stepsReducer`, `initialStep`, `isLastStep`, `stepsProgress`, `taskStatus`, `tasklistReducer`, `tasklistProgress`; `selectedView`, `viewsReducer`; `splitReducer`, `initialSplit`, `splitPanes`, `splitSelection`, `splitItemValue`, `clampShare` |
|
|
33
|
+
| Layout rules | `frameWidth`, `placementFor`, `appBarTitle`, `documentTitle` (the Frame); `TABLE_COMPACT_PX`, `stackedColumns`, `isNumericColumn`, `paging`, `rowValue`, `nextSort`, `columnCount` (Table); `fitActions`, `minShown`, `menuOrder` (ActionBar); `collectionLayout`, `orderedIndices`, `moveItem`, `calendarMonth` (Collection); `treeRows`, `treeKey`, `typeAheadTarget`, `visibleWindow` (Tree); `activeFilters` (FilterPanel) |
|
|
34
|
+
| Loading | `skeletonShape`, `SKELETON_SHAPES`, `PATTERN_SHAPE`, `skeletonStatus` |
|
|
35
|
+
| Shortcuts | `parseShortcut`, `shortcutMatches`, `unmodified`, `isApplePlatform` |
|
|
36
|
+
| Small marks | `metricChange`, `gaugeState`, `meterHint`, `starsLabel`, `ratingSaid`, `maskSecret`, `groupSummary`, `avatarTone`, `initialsOf`, `iconPath` |
|
|
37
|
+
| Content | `richText` (tokens for `**bold**`, `*italic*`, `` `code` ``, `[text](href)`), `qrEncode`, chart geometry (`niceMax`, `axisLabel`, `treemap`, `verticalScale`, `flowLayout`, `markerShape`), `applyMask`, colour parsing (`parseColor`, `formatColor`), file limits (`formatBytes`, `refuseFile`, `fileLimits`) |
|
|
38
|
+
|
|
39
|
+
Every renderer that uses these makes the same decisions from the same document: a `Choice` with three short options is chips everywhere, a Table stacks below 720px everywhere, `ui.dismiss` closes everywhere. The conformance suite in `@polyxd/verifier` checks that it does.
|
|
40
|
+
|
|
41
|
+
## Tests
|
|
42
|
+
|
|
43
|
+
`npm test -w @polyxd/core` runs the unit tests: pointer resolution, formatting per locale, the reducers, control selection, the layout rules, shortcuts, and the headless surface.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ActionBar folding and ActionMenu ordering. Children are in order of importance; in the wide
|
|
3
|
+
* (row) layout, actions that would wrap onto a second line fold into a "More actions" menu,
|
|
4
|
+
* least important first. The first child never folds, two actions never fold.
|
|
5
|
+
*/
|
|
6
|
+
import type { Node } from "./document.ts";
|
|
7
|
+
/** What the overflow control is called; also what a task runner looks for. */
|
|
8
|
+
export declare const MORE_ACTIONS = "More actions";
|
|
9
|
+
/** The trigger's width before it has been drawn: size.target.min in every pack. */
|
|
10
|
+
export declare const TRIGGER_FALLBACK = 44;
|
|
11
|
+
/** Only a trailing run of Actions can fold; anything else (a menu, a split) stays put. */
|
|
12
|
+
export declare function minShown(ids: string[], byId: Map<string, Node>): number;
|
|
13
|
+
/** How many children fit as buttons in `room`, with a trigger for the rest. An unmeasured child counts as nothing wide. */
|
|
14
|
+
export declare function fitActions(ids: string[], width: (id: string) => number, gap: number, room: number, triggerWidth: number, floor: number): number;
|
|
15
|
+
/** Menu items in order: the usual ones, then a divider, then danger last. */
|
|
16
|
+
export declare function menuOrder(actions: Node[]): {
|
|
17
|
+
usual: Node[];
|
|
18
|
+
danger: Node[];
|
|
19
|
+
divider: boolean;
|
|
20
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** What the overflow control is called; also what a task runner looks for. */
|
|
2
|
+
export const MORE_ACTIONS = "More actions";
|
|
3
|
+
/** The trigger's width before it has been drawn: size.target.min in every pack. */
|
|
4
|
+
export const TRIGGER_FALLBACK = 44;
|
|
5
|
+
/** Only a trailing run of Actions can fold; anything else (a menu, a split) stays put. */
|
|
6
|
+
export function minShown(ids, byId) {
|
|
7
|
+
for (let i = ids.length - 1; i > 0; i--)
|
|
8
|
+
if (byId.get(ids[i])?.component !== "Action")
|
|
9
|
+
return i + 1;
|
|
10
|
+
return 1;
|
|
11
|
+
}
|
|
12
|
+
/** How many children fit as buttons in `room`, with a trigger for the rest. An unmeasured child counts as nothing wide. */
|
|
13
|
+
export function fitActions(ids, width, gap, room, triggerWidth, floor) {
|
|
14
|
+
if (ids.length <= 2)
|
|
15
|
+
return ids.length;
|
|
16
|
+
let used = 0;
|
|
17
|
+
let n = 0;
|
|
18
|
+
while (n < ids.length && used + (n ? gap : 0) + width(ids[n]) <= room)
|
|
19
|
+
used += (n ? gap : 0) + width(ids[n++]);
|
|
20
|
+
if (n < ids.length) {
|
|
21
|
+
// Make room for the trigger itself, giving up the least important buttons first.
|
|
22
|
+
while (n > floor && used + gap + triggerWidth > room)
|
|
23
|
+
used -= gap + width(ids[--n]);
|
|
24
|
+
n = Math.max(n, floor);
|
|
25
|
+
}
|
|
26
|
+
return n;
|
|
27
|
+
}
|
|
28
|
+
/** Menu items in order: the usual ones, then a divider, then danger last. */
|
|
29
|
+
export function menuOrder(actions) {
|
|
30
|
+
const usual = actions.filter((a) => a.tone !== "danger");
|
|
31
|
+
const danger = actions.filter((a) => a.tone === "danger");
|
|
32
|
+
return { usual, danger, divider: danger.length > 0 && usual.length > 0 };
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=actionbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actionbar.js","sourceRoot":"","sources":["../src/actionbar.ts"],"names":[],"mappings":"AAOA,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAC3C,mFAAmF;AACnF,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC,0FAA0F;AAC1F,MAAM,UAAU,QAAQ,CAAC,GAAa,EAAE,IAAuB;IAC7D,KAAK,IAAI,CAAC,GAAG,GAA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AM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;IAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** What an action does when it fires: the renderer's own names, and everything else to the host. */
|
|
2
|
+
import { type Scope } from "./data.ts";
|
|
3
|
+
import type { Action, ActionEvent, Node } from "./document.ts";
|
|
4
|
+
export interface DispatchHandlers {
|
|
5
|
+
onAction?: (event: ActionEvent) => void;
|
|
6
|
+
onDismiss?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const isRendererAction: (name: string) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* ui.dismiss closes the surface (the host's onDismiss); every other action reaches onAction with
|
|
11
|
+
* its context resolved in the scope it fired from. ui.back and ui.next are a Steps' to handle
|
|
12
|
+
* before this; ui.copy copies first and then reaches the host like any action.
|
|
13
|
+
*/
|
|
14
|
+
export declare function dispatchAction(action: Action | undefined, scope: Scope, source: string, data: unknown, handlers: DispatchHandlers): void;
|
|
15
|
+
/**
|
|
16
|
+
* An input's action, with the value it just wrote applied wherever the context binds to the
|
|
17
|
+
* input's own path, so the event carries the change rather than the value still in host data
|
|
18
|
+
* (Toggle, Rating, CodeInput).
|
|
19
|
+
*/
|
|
20
|
+
export declare function contextWithValue(node: Node, data: unknown, scope: Scope, next: unknown): Record<string, unknown>;
|
|
21
|
+
/** What ui.copy puts on the clipboard: the Action's `copy`, else the context's `text`. */
|
|
22
|
+
export declare function copyText(node: Node, data: unknown, scope: Scope, text: (v: unknown) => string): string;
|
|
23
|
+
/** The 'Change' link of a DetailList row: the row's key travels with the context. */
|
|
24
|
+
export declare const rowChangeAction: (rowAction: Action, key: string) => Action;
|
package/dist/actions.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** What an action does when it fires: the renderer's own names, and everything else to the host. */
|
|
2
|
+
import { absolute, isBinding, resolve, resolveContext } from "./data.js";
|
|
3
|
+
import { RENDERER_ACTIONS } from "./document.js";
|
|
4
|
+
export const isRendererAction = (name) => RENDERER_ACTIONS.includes(name);
|
|
5
|
+
/**
|
|
6
|
+
* ui.dismiss closes the surface (the host's onDismiss); every other action reaches onAction with
|
|
7
|
+
* its context resolved in the scope it fired from. ui.back and ui.next are a Steps' to handle
|
|
8
|
+
* before this; ui.copy copies first and then reaches the host like any action.
|
|
9
|
+
*/
|
|
10
|
+
export function dispatchAction(action, scope, source, data, handlers) {
|
|
11
|
+
if (!action)
|
|
12
|
+
return;
|
|
13
|
+
const { name, context } = action.event;
|
|
14
|
+
if (name === "ui.dismiss")
|
|
15
|
+
return handlers.onDismiss?.();
|
|
16
|
+
handlers.onAction?.({ name, context: resolveContext(context, data, scope), source });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* An input's action, with the value it just wrote applied wherever the context binds to the
|
|
20
|
+
* input's own path, so the event carries the change rather than the value still in host data
|
|
21
|
+
* (Toggle, Rating, CodeInput).
|
|
22
|
+
*/
|
|
23
|
+
export function contextWithValue(node, data, scope, next) {
|
|
24
|
+
const ptr = absolute(node.value.path, scope);
|
|
25
|
+
return Object.fromEntries(Object.entries(node.action?.event?.context ?? {}).map(([k, v]) => [k, isBinding(v) && absolute(v.path, scope) === ptr ? next : resolve(v, data, scope)]));
|
|
26
|
+
}
|
|
27
|
+
/** What ui.copy puts on the clipboard: the Action's `copy`, else the context's `text`. */
|
|
28
|
+
export function copyText(node, data, scope, text) {
|
|
29
|
+
return node.copy !== undefined ? text(node.copy) : String(resolveContext(node.action?.event?.context, data, scope).text ?? "");
|
|
30
|
+
}
|
|
31
|
+
/** The 'Change' link of a DetailList row: the row's key travels with the context. */
|
|
32
|
+
export const rowChangeAction = (rowAction, key) => ({ event: { name: rowAction.event.name, context: { key, ...(rowAction.event.context ?? {}) } } });
|
|
33
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAc,MAAM,WAAW,CAAC;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAOjD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAW,EAAE,CAAE,gBAAsC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAElH;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,MAA0B,EAAE,KAAY,EAAE,MAAc,EAAE,IAAa,EAAE,QAA0B;IAChI,IAAI,CAAC,MAAM;QAAE,OAAO;IACpB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;IACvC,IAAI,IAAI,KAAK,YAAY;QAAE,OAAO,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC;IACzD,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;AACvF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAU,EAAE,IAAa,EAAE,KAAY,EAAE,IAAa;IACrF,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAgB,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CACxK,CAAC;AACJ,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,QAAQ,CAAC,IAAU,EAAE,IAAa,EAAE,KAAY,EAAE,IAA4B;IAC5F,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;AACjI,CAAC;AAED,qFAAqF;AACrF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAiB,EAAE,GAAW,EAAU,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC"}
|
package/dist/avatar.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** A face without a picture: initials on a tone chosen per name; and the icon set every renderer draws from. */
|
|
2
|
+
export declare function avatarTone(name: string): string;
|
|
3
|
+
/** Up to three characters of reference are the initials themselves; longer references are host media. */
|
|
4
|
+
export declare function initialsOf(ref: string, name: string): string;
|
|
5
|
+
/** A reference longer than three characters is a host media reference to resolve. */
|
|
6
|
+
export declare const isMediaRef: (ref: string) => boolean;
|
|
7
|
+
export declare const ICON_PATHS: Record<string, string>;
|
|
8
|
+
/** The path for an icon name; an unknown name draws the info glyph. */
|
|
9
|
+
export declare const iconPath: (name: string) => string;
|
|
10
|
+
/** The Status kinds' icons. */
|
|
11
|
+
export declare const STATUS_ICON: Record<string, string>;
|
|
12
|
+
/** The star every Rating draws. */
|
|
13
|
+
export declare const STAR_PATH = "M12 2.5l2.9 6.2 6.8.8-5 4.7 1.3 6.8L12 17.6 6 21l1.3-6.8-5-4.7 6.8-.8z";
|
package/dist/avatar.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** A face without a picture: initials on a tone chosen per name; and the icon set every renderer draws from. */
|
|
2
|
+
/** A stable tone per name, from the pack's container colours. */
|
|
3
|
+
const TONES = ["primary", "secondary", "tertiary", "success", "warning"];
|
|
4
|
+
export function avatarTone(name) {
|
|
5
|
+
return TONES[[...name].reduce((h, c) => (h * 31 + c.charCodeAt(0)) >>> 0, 7) % TONES.length];
|
|
6
|
+
}
|
|
7
|
+
/** Up to three characters of reference are the initials themselves; longer references are host media. */
|
|
8
|
+
export function initialsOf(ref, name) {
|
|
9
|
+
return (ref && ref.length <= 3 ? ref : name.split(/\s+/).map((w) => w[0]).join("").slice(0, 2)).toUpperCase();
|
|
10
|
+
}
|
|
11
|
+
/** A reference longer than three characters is a host media reference to resolve. */
|
|
12
|
+
export const isMediaRef = (ref) => ref.length > 3;
|
|
13
|
+
export const ICON_PATHS = {
|
|
14
|
+
search: "M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14zM21 21l-4.3-4.3",
|
|
15
|
+
check: "M20 6 9 17l-5-5",
|
|
16
|
+
info: "M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18zM12 16v-4M12 8h.01",
|
|
17
|
+
lock: "M5 11h14v10H5zM8 11V7a4 4 0 0 1 8 0v4",
|
|
18
|
+
trash: "M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6",
|
|
19
|
+
clock: "M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18zM12 7v5l3 2",
|
|
20
|
+
tag: "M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0L3 13V3h10l7.6 7.6a2 2 0 0 1 0 2.8z",
|
|
21
|
+
alert: "M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h16.9a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0zM12 9v4M12 17h.01",
|
|
22
|
+
mail: "M3 5h18v14H3zM3 7l9 6 9-6",
|
|
23
|
+
shield: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",
|
|
24
|
+
book: "M4 19.5A2.5 2.5 0 0 1 6.5 17H20M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",
|
|
25
|
+
inbox: "M22 12h-6l-2 3h-4l-2-3H2M5.5 5h13L22 12v7H2v-7z",
|
|
26
|
+
filter: "M3 5h18l-7 8v6l-4 2v-8z",
|
|
27
|
+
close: "M18 6 6 18M6 6l12 12",
|
|
28
|
+
dash: "M6 12h12",
|
|
29
|
+
menu: "M4 6h16M4 12h16M4 18h16",
|
|
30
|
+
home: "M4 11 12 4l8 7M6 10v10h12V10",
|
|
31
|
+
settings: "M12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM19.4 15a1.7 1.7 0 0 0 .3 1.8 2 2 0 1 1-2.8 2.8 1.7 1.7 0 0 0-2.9 1.2 2 2 0 1 1-4 0 1.7 1.7 0 0 0-2.9-1.2 2 2 0 1 1-2.8-2.8A1.7 1.7 0 0 0 2.1 14a2 2 0 1 1 0-4 1.7 1.7 0 0 0 1.2-2.9 2 2 0 1 1 2.8-2.8A1.7 1.7 0 0 0 9 3.1a2 2 0 1 1 4 0 1.7 1.7 0 0 0 2.9 1.2 2 2 0 1 1 2.8 2.8A1.7 1.7 0 0 0 21 10a2 2 0 1 1 0 4 1.7 1.7 0 0 0-1.6 1z",
|
|
32
|
+
chart: "M4 20V10M10 20V4M16 20v-7M22 20H2",
|
|
33
|
+
people: "M9 4.5a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7zM2.5 20a6.5 6.5 0 0 1 13 0M16 4.5a3.5 3.5 0 0 1 0 7M18 14a6.5 6.5 0 0 1 3.5 6",
|
|
34
|
+
card: "M2 6h20v13H2zM2 10h20",
|
|
35
|
+
file: "M6 3h8l4 4v14H6zM14 3v4h4",
|
|
36
|
+
dots: "M12 5h.01M12 12h.01M12 19h.01",
|
|
37
|
+
sort: "M8 9l4-4 4 4M8 15l4 4 4-4",
|
|
38
|
+
sortUp: "M12 19V5M6 11l6-6 6 6",
|
|
39
|
+
sortDown: "M12 5v14M6 13l6 6 6-6",
|
|
40
|
+
chevronLeft: "M15 5l-7 7 7 7",
|
|
41
|
+
chevronRight: "M9 5l7 7-7 7",
|
|
42
|
+
chevronDown: "m6 9 6 6 6-6",
|
|
43
|
+
// The rest of Navigation's icon set: a product's sections.
|
|
44
|
+
orders: "M6 3h12v18l-3-2-3 2-3-2-3 2zM9 8h6M9 12h6",
|
|
45
|
+
products: "M12 3 3 7.5v9L12 21l9-4.5v-9zM3 7.5l9 4.5 9-4.5M12 12v9",
|
|
46
|
+
customers: "M12 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM4 21a8 8 0 0 1 16 0",
|
|
47
|
+
discounts: "M19 5 5 19M7.5 6a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zM16.5 15a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z",
|
|
48
|
+
analytics: "M3 17l5-6 4 3 5-7 4 4M3 21h18",
|
|
49
|
+
calendar: "M4 6h16v14H4zM4 10h16M8 3v4M16 3v4",
|
|
50
|
+
bell: "M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 21h4",
|
|
51
|
+
help: "M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18zM9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.7.3-1 .9-1 1.7M12 17h.01",
|
|
52
|
+
folder: "M3 6h6l2 2h10v11H3z",
|
|
53
|
+
star: "m12 3 2.8 5.7 6.2.9-4.5 4.4 1.1 6.2L12 17.3 6.4 20.2l1.1-6.2L3 9.6l6.2-.9z",
|
|
54
|
+
grid: "M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z",
|
|
55
|
+
layers: "m12 3 9 5-9 5-9-5zM3 13l9 5 9-5M3 17l9 5 9-5",
|
|
56
|
+
};
|
|
57
|
+
/** The path for an icon name; an unknown name draws the info glyph. */
|
|
58
|
+
export const iconPath = (name) => ICON_PATHS[name] ?? ICON_PATHS.info;
|
|
59
|
+
/** The Status kinds' icons. */
|
|
60
|
+
export const STATUS_ICON = { info: "info", success: "check", warning: "alert", error: "alert", empty: "inbox", undo: "check" };
|
|
61
|
+
/** The star every Rating draws. */
|
|
62
|
+
export const STAR_PATH = "M12 2.5l2.9 6.2 6.8.8-5 4.7 1.3 6.8L12 17.6 6 21l1.3-6.8-5-4.7 6.8-.8z";
|
|
63
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../src/avatar.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAEhH,iEAAiE;AACjE,MAAM,KAAK,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAEzE,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC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