@a2ui/web_core 0.8.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 (225) hide show
  1. package/README.md +13 -0
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/src/v0_8/data/guards.d.ts +24 -0
  4. package/dist/src/v0_8/data/guards.d.ts.map +1 -0
  5. package/dist/src/v0_8/data/guards.js +153 -0
  6. package/dist/src/v0_8/data/guards.js.map +1 -0
  7. package/dist/src/v0_8/data/model-processor.d.ts +79 -0
  8. package/dist/src/v0_8/data/model-processor.d.ts.map +1 -0
  9. package/dist/src/v0_8/data/model-processor.js +627 -0
  10. package/dist/src/v0_8/data/model-processor.js.map +1 -0
  11. package/dist/src/v0_8/events/base.d.ts +24 -0
  12. package/dist/src/v0_8/events/base.d.ts.map +1 -0
  13. package/dist/src/v0_8/events/base.js +17 -0
  14. package/dist/src/v0_8/events/base.js.map +1 -0
  15. package/dist/src/v0_8/events/index.d.ts +18 -0
  16. package/dist/src/v0_8/events/index.d.ts.map +1 -0
  17. package/dist/src/v0_8/events/index.js +18 -0
  18. package/dist/src/v0_8/events/index.js.map +1 -0
  19. package/dist/src/v0_8/events/validation-event.d.ts +46 -0
  20. package/dist/src/v0_8/events/validation-event.d.ts.map +1 -0
  21. package/dist/src/v0_8/events/validation-event.js +33 -0
  22. package/dist/src/v0_8/events/validation-event.js.map +1 -0
  23. package/dist/src/v0_8/index.d.ts +743 -0
  24. package/dist/src/v0_8/index.d.ts.map +1 -0
  25. package/dist/src/v0_8/index.js +12 -0
  26. package/dist/src/v0_8/index.js.map +1 -0
  27. package/dist/src/v0_8/schemas/a2ui_client_capabilities_schema.json +23 -0
  28. package/dist/src/v0_8/schemas/catalog_description_schema.json +34 -0
  29. package/dist/src/v0_8/schemas/client_to_server.json +53 -0
  30. package/dist/src/v0_8/schemas/server_to_client.json +148 -0
  31. package/dist/src/v0_8/schemas/server_to_client_with_standard_catalog.json +823 -0
  32. package/dist/src/v0_8/schemas/standard_catalog_definition.json +772 -0
  33. package/dist/src/v0_8/styles/behavior.d.ts +2 -0
  34. package/dist/src/v0_8/styles/behavior.d.ts.map +1 -0
  35. package/dist/src/v0_8/styles/behavior.js +54 -0
  36. package/dist/src/v0_8/styles/behavior.js.map +1 -0
  37. package/dist/src/v0_8/styles/border.d.ts +2 -0
  38. package/dist/src/v0_8/styles/border.d.ts.map +1 -0
  39. package/dist/src/v0_8/styles/border.js +41 -0
  40. package/dist/src/v0_8/styles/border.js.map +1 -0
  41. package/dist/src/v0_8/styles/colors.d.ts +2 -0
  42. package/dist/src/v0_8/styles/colors.d.ts.map +1 -0
  43. package/dist/src/v0_8/styles/colors.js +80 -0
  44. package/dist/src/v0_8/styles/colors.js.map +1 -0
  45. package/dist/src/v0_8/styles/icons.d.ts +11 -0
  46. package/dist/src/v0_8/styles/icons.d.ts.map +1 -0
  47. package/dist/src/v0_8/styles/icons.js +60 -0
  48. package/dist/src/v0_8/styles/icons.js.map +1 -0
  49. package/dist/src/v0_8/styles/index.d.ts +3 -0
  50. package/dist/src/v0_8/styles/index.d.ts.map +1 -0
  51. package/dist/src/v0_8/styles/index.js +35 -0
  52. package/dist/src/v0_8/styles/index.js.map +1 -0
  53. package/dist/src/v0_8/styles/layout.d.ts +2 -0
  54. package/dist/src/v0_8/styles/layout.d.ts.map +1 -0
  55. package/dist/src/v0_8/styles/layout.js +232 -0
  56. package/dist/src/v0_8/styles/layout.js.map +1 -0
  57. package/dist/src/v0_8/styles/opacity.d.ts +2 -0
  58. package/dist/src/v0_8/styles/opacity.d.ts.map +1 -0
  59. package/dist/src/v0_8/styles/opacity.js +24 -0
  60. package/dist/src/v0_8/styles/opacity.js.map +1 -0
  61. package/dist/src/v0_8/styles/shared.d.ts +2 -0
  62. package/dist/src/v0_8/styles/shared.d.ts.map +1 -0
  63. package/dist/src/v0_8/styles/shared.js +17 -0
  64. package/dist/src/v0_8/styles/shared.js.map +1 -0
  65. package/dist/src/v0_8/styles/type.d.ts +2 -0
  66. package/dist/src/v0_8/styles/type.d.ts.map +1 -0
  67. package/dist/src/v0_8/styles/type.js +156 -0
  68. package/dist/src/v0_8/styles/type.js.map +1 -0
  69. package/dist/src/v0_8/styles/utils.d.ts +6 -0
  70. package/dist/src/v0_8/styles/utils.d.ts.map +1 -0
  71. package/dist/src/v0_8/styles/utils.js +81 -0
  72. package/dist/src/v0_8/styles/utils.js.map +1 -0
  73. package/dist/src/v0_8/types/client-event.d.ts +66 -0
  74. package/dist/src/v0_8/types/client-event.d.ts.map +1 -0
  75. package/dist/src/v0_8/types/client-event.js +17 -0
  76. package/dist/src/v0_8/types/client-event.js.map +1 -0
  77. package/dist/src/v0_8/types/colors.d.ts +25 -0
  78. package/dist/src/v0_8/types/colors.d.ts.map +1 -0
  79. package/dist/src/v0_8/types/colors.js +19 -0
  80. package/dist/src/v0_8/types/colors.js.map +1 -0
  81. package/dist/src/v0_8/types/components.d.ts +176 -0
  82. package/dist/src/v0_8/types/components.d.ts.map +1 -0
  83. package/dist/src/v0_8/types/components.js +17 -0
  84. package/dist/src/v0_8/types/components.js.map +1 -0
  85. package/dist/src/v0_8/types/primitives.d.ts +43 -0
  86. package/dist/src/v0_8/types/primitives.d.ts.map +1 -0
  87. package/dist/src/v0_8/types/primitives.js +17 -0
  88. package/dist/src/v0_8/types/primitives.js.map +1 -0
  89. package/dist/src/v0_8/types/types.d.ts +411 -0
  90. package/dist/src/v0_8/types/types.d.ts.map +1 -0
  91. package/dist/src/v0_8/types/types.js +17 -0
  92. package/dist/src/v0_8/types/types.js.map +1 -0
  93. package/dist/src/v0_9/catalog/types.d.ts +27 -0
  94. package/dist/src/v0_9/catalog/types.d.ts.map +1 -0
  95. package/dist/src/v0_9/catalog/types.js +11 -0
  96. package/dist/src/v0_9/catalog/types.js.map +1 -0
  97. package/dist/src/v0_9/common/events.d.ts +24 -0
  98. package/dist/src/v0_9/common/events.d.ts.map +1 -0
  99. package/dist/src/v0_9/common/events.js +29 -0
  100. package/dist/src/v0_9/common/events.js.map +1 -0
  101. package/dist/src/v0_9/index.d.ts +11 -0
  102. package/dist/src/v0_9/index.d.ts.map +1 -0
  103. package/dist/src/v0_9/index.js +11 -0
  104. package/dist/src/v0_9/index.js.map +1 -0
  105. package/dist/src/v0_9/processing/message-processor.d.ts +34 -0
  106. package/dist/src/v0_9/processing/message-processor.d.ts.map +1 -0
  107. package/dist/src/v0_9/processing/message-processor.js +128 -0
  108. package/dist/src/v0_9/processing/message-processor.js.map +1 -0
  109. package/dist/src/v0_9/processing/message-processor.test.d.ts +2 -0
  110. package/dist/src/v0_9/processing/message-processor.test.d.ts.map +1 -0
  111. package/dist/src/v0_9/processing/message-processor.test.js +112 -0
  112. package/dist/src/v0_9/processing/message-processor.test.js.map +1 -0
  113. package/dist/src/v0_9/rendering/component-context.d.ts +17 -0
  114. package/dist/src/v0_9/rendering/component-context.d.ts.map +1 -0
  115. package/dist/src/v0_9/rendering/component-context.js +21 -0
  116. package/dist/src/v0_9/rendering/component-context.js.map +1 -0
  117. package/dist/src/v0_9/rendering/data-context.d.ts +37 -0
  118. package/dist/src/v0_9/rendering/data-context.d.ts.map +1 -0
  119. package/dist/src/v0_9/rendering/data-context.js +97 -0
  120. package/dist/src/v0_9/rendering/data-context.js.map +1 -0
  121. package/dist/src/v0_9/rendering/data-context.test.d.ts +2 -0
  122. package/dist/src/v0_9/rendering/data-context.test.d.ts.map +1 -0
  123. package/dist/src/v0_9/rendering/data-context.test.js +71 -0
  124. package/dist/src/v0_9/rendering/data-context.test.js.map +1 -0
  125. package/dist/src/v0_9/schema/common-types.d.ts +608 -0
  126. package/dist/src/v0_9/schema/common-types.d.ts.map +1 -0
  127. package/dist/src/v0_9/schema/common-types.js +92 -0
  128. package/dist/src/v0_9/schema/common-types.js.map +1 -0
  129. package/dist/src/v0_9/schema/index.d.ts +3 -0
  130. package/dist/src/v0_9/schema/index.d.ts.map +1 -0
  131. package/dist/src/v0_9/schema/index.js +3 -0
  132. package/dist/src/v0_9/schema/index.js.map +1 -0
  133. package/dist/src/v0_9/schema/server-to-client.d.ts +84 -0
  134. package/dist/src/v0_9/schema/server-to-client.d.ts.map +1 -0
  135. package/dist/src/v0_9/schema/server-to-client.js +21 -0
  136. package/dist/src/v0_9/schema/server-to-client.js.map +1 -0
  137. package/dist/src/v0_9/state/component-model.d.ts +16 -0
  138. package/dist/src/v0_9/state/component-model.d.ts.map +1 -0
  139. package/dist/src/v0_9/state/component-model.js +24 -0
  140. package/dist/src/v0_9/state/component-model.js.map +1 -0
  141. package/dist/src/v0_9/state/component-model.test.d.ts +2 -0
  142. package/dist/src/v0_9/state/component-model.test.d.ts.map +1 -0
  143. package/dist/src/v0_9/state/component-model.test.js +39 -0
  144. package/dist/src/v0_9/state/component-model.test.js.map +1 -0
  145. package/dist/src/v0_9/state/data-model.d.ts +47 -0
  146. package/dist/src/v0_9/state/data-model.d.ts.map +1 -0
  147. package/dist/src/v0_9/state/data-model.js +191 -0
  148. package/dist/src/v0_9/state/data-model.js.map +1 -0
  149. package/dist/src/v0_9/state/data-model.test.d.ts +2 -0
  150. package/dist/src/v0_9/state/data-model.test.d.ts.map +1 -0
  151. package/dist/src/v0_9/state/data-model.test.js +204 -0
  152. package/dist/src/v0_9/state/data-model.test.js.map +1 -0
  153. package/dist/src/v0_9/state/surface-components-model.d.ts +19 -0
  154. package/dist/src/v0_9/state/surface-components-model.d.ts.map +1 -0
  155. package/dist/src/v0_9/state/surface-components-model.js +42 -0
  156. package/dist/src/v0_9/state/surface-components-model.js.map +1 -0
  157. package/dist/src/v0_9/state/surface-components-model.test.d.ts +2 -0
  158. package/dist/src/v0_9/state/surface-components-model.test.d.ts.map +1 -0
  159. package/dist/src/v0_9/state/surface-components-model.test.js +49 -0
  160. package/dist/src/v0_9/state/surface-components-model.test.js.map +1 -0
  161. package/dist/src/v0_9/state/surface-group-model.d.ts +25 -0
  162. package/dist/src/v0_9/state/surface-group-model.d.ts.map +1 -0
  163. package/dist/src/v0_9/state/surface-group-model.js +56 -0
  164. package/dist/src/v0_9/state/surface-group-model.js.map +1 -0
  165. package/dist/src/v0_9/state/surface-group-model.test.d.ts +2 -0
  166. package/dist/src/v0_9/state/surface-group-model.test.d.ts.map +1 -0
  167. package/dist/src/v0_9/state/surface-group-model.test.js +67 -0
  168. package/dist/src/v0_9/state/surface-group-model.test.js.map +1 -0
  169. package/dist/src/v0_9/state/surface-model.d.ts +23 -0
  170. package/dist/src/v0_9/state/surface-model.d.ts.map +1 -0
  171. package/dist/src/v0_9/state/surface-model.js +28 -0
  172. package/dist/src/v0_9/state/surface-model.js.map +1 -0
  173. package/dist/src/v0_9/state/surface-model.test.d.ts +2 -0
  174. package/dist/src/v0_9/state/surface-model.test.d.ts.map +1 -0
  175. package/dist/src/v0_9/state/surface-model.test.js +39 -0
  176. package/dist/src/v0_9/state/surface-model.test.js.map +1 -0
  177. package/dist/src/v0_9/test/test-utils.d.ts +8 -0
  178. package/dist/src/v0_9/test/test-utils.d.ts.map +1 -0
  179. package/dist/src/v0_9/test/test-utils.js +18 -0
  180. package/dist/src/v0_9/test/test-utils.js.map +1 -0
  181. package/package.json +94 -0
  182. package/src/v0_8/data/guards.ts +236 -0
  183. package/src/v0_8/data/model-processor.ts +855 -0
  184. package/src/v0_8/events/base.ts +24 -0
  185. package/src/v0_8/events/index.ts +18 -0
  186. package/src/v0_8/events/validation-event.ts +66 -0
  187. package/src/v0_8/index.ts +12 -0
  188. package/src/v0_8/schemas/server_to_client_with_standard_catalog.json +823 -0
  189. package/src/v0_8/styles/behavior.ts +55 -0
  190. package/src/v0_8/styles/border.ts +42 -0
  191. package/src/v0_8/styles/colors.ts +100 -0
  192. package/src/v0_8/styles/icons.ts +60 -0
  193. package/src/v0_8/styles/index.ts +37 -0
  194. package/src/v0_8/styles/layout.ts +235 -0
  195. package/src/v0_8/styles/opacity.ts +24 -0
  196. package/src/v0_8/styles/shared.ts +17 -0
  197. package/src/v0_8/styles/type.ts +156 -0
  198. package/src/v0_8/styles/utils.ts +104 -0
  199. package/src/v0_8/types/client-event.ts +80 -0
  200. package/src/v0_8/types/colors.ts +66 -0
  201. package/src/v0_8/types/components.ts +213 -0
  202. package/src/v0_8/types/primitives.ts +60 -0
  203. package/src/v0_8/types/types.ts +557 -0
  204. package/src/v0_9/catalog/types.ts +38 -0
  205. package/src/v0_9/common/events.ts +44 -0
  206. package/src/v0_9/index.ts +12 -0
  207. package/src/v0_9/processing/message-processor.test.ts +133 -0
  208. package/src/v0_9/processing/message-processor.ts +150 -0
  209. package/src/v0_9/rendering/component-context.ts +36 -0
  210. package/src/v0_9/rendering/data-context.test.ts +85 -0
  211. package/src/v0_9/rendering/data-context.ts +110 -0
  212. package/src/v0_9/schema/common-types.ts +125 -0
  213. package/src/v0_9/schema/index.ts +2 -0
  214. package/src/v0_9/schema/server-to-client.ts +23 -0
  215. package/src/v0_9/state/component-model.test.ts +50 -0
  216. package/src/v0_9/state/component-model.ts +32 -0
  217. package/src/v0_9/state/data-model.test.ts +257 -0
  218. package/src/v0_9/state/data-model.ts +239 -0
  219. package/src/v0_9/state/surface-components-model.test.ts +59 -0
  220. package/src/v0_9/state/surface-components-model.ts +48 -0
  221. package/src/v0_9/state/surface-group-model.test.ts +82 -0
  222. package/src/v0_9/state/surface-group-model.ts +66 -0
  223. package/src/v0_9/state/surface-model.test.ts +44 -0
  224. package/src/v0_9/state/surface-model.ts +39 -0
  225. package/src/v0_9/test/test-utils.ts +22 -0
@@ -0,0 +1,55 @@
1
+ /*
2
+ Copyright 2025 Google LLC
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ https://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ const opacityBehavior = `
18
+ &:not([disabled]) {
19
+ cursor: pointer;
20
+ opacity: var(--opacity, 0);
21
+ transition: opacity var(--speed, 0.2s) cubic-bezier(0, 0, 0.3, 1);
22
+
23
+ &:hover,
24
+ &:focus {
25
+ opacity: 1;
26
+ }
27
+ }`;
28
+
29
+ export const behavior = `
30
+ ${new Array(21)
31
+ .fill(0)
32
+ .map((_, idx) => {
33
+ return `.behavior-ho-${idx * 5} {
34
+ --opacity: ${idx / 20};
35
+ ${opacityBehavior}
36
+ }`;
37
+ })
38
+ .join("\n")}
39
+
40
+ .behavior-o-s {
41
+ overflow: scroll;
42
+ }
43
+
44
+ .behavior-o-a {
45
+ overflow: auto;
46
+ }
47
+
48
+ .behavior-o-h {
49
+ overflow: hidden;
50
+ }
51
+
52
+ .behavior-sw-n {
53
+ scrollbar-width: none;
54
+ }
55
+ `;
@@ -0,0 +1,42 @@
1
+ /*
2
+ Copyright 2025 Google LLC
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ https://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ import { grid } from "./shared.js";
18
+
19
+ export const border = `
20
+ ${new Array(25)
21
+ .fill(0)
22
+ .map((_, idx) => {
23
+ return `
24
+ .border-bw-${idx} { border-width: ${idx}px; }
25
+ .border-btw-${idx} { border-top-width: ${idx}px; }
26
+ .border-bbw-${idx} { border-bottom-width: ${idx}px; }
27
+ .border-blw-${idx} { border-left-width: ${idx}px; }
28
+ .border-brw-${idx} { border-right-width: ${idx}px; }
29
+
30
+ .border-ow-${idx} { outline-width: ${idx}px; }
31
+ .border-br-${idx} { border-radius: ${idx * grid}px; overflow: hidden;}`;
32
+ })
33
+ .join("\n")}
34
+
35
+ .border-br-50pc {
36
+ border-radius: 50%;
37
+ }
38
+
39
+ .border-bs-s {
40
+ border-style: solid;
41
+ }
42
+ `;
@@ -0,0 +1,100 @@
1
+ /*
2
+ Copyright 2025 Google LLC
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ https://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ import { PaletteKey, PaletteKeyVals, shades } from "../types/colors.js";
18
+ import { toProp } from "./utils.js";
19
+
20
+ const color = <C extends PaletteKeyVals>(src: PaletteKey<C>) =>
21
+ `
22
+ ${src
23
+ .map((key: string) => {
24
+ const inverseKey = getInverseKey(key);
25
+ return `.color-bc-${key} { border-color: light-dark(var(${toProp(
26
+ key
27
+ )}), var(${toProp(inverseKey)})); }`;
28
+ })
29
+ .join("\n")}
30
+
31
+ ${src
32
+ .map((key: string) => {
33
+ const inverseKey = getInverseKey(key);
34
+ const vals = [
35
+ `.color-bgc-${key} { background-color: light-dark(var(${toProp(
36
+ key
37
+ )}), var(${toProp(inverseKey)})); }`,
38
+ `.color-bbgc-${key}::backdrop { background-color: light-dark(var(${toProp(
39
+ key
40
+ )}), var(${toProp(inverseKey)})); }`,
41
+ ];
42
+
43
+ for (let o = 0.1; o < 1; o += 0.1) {
44
+ vals.push(`.color-bbgc-${key}_${(o * 100).toFixed(0)}::backdrop {
45
+ background-color: light-dark(oklch(from var(${toProp(
46
+ key
47
+ )}) l c h / calc(alpha * ${o.toFixed(1)})), oklch(from var(${toProp(
48
+ inverseKey
49
+ )}) l c h / calc(alpha * ${o.toFixed(1)})) );
50
+ }
51
+ `);
52
+ }
53
+
54
+ return vals.join("\n");
55
+ })
56
+ .join("\n")}
57
+
58
+ ${src
59
+ .map((key: string) => {
60
+ const inverseKey = getInverseKey(key);
61
+ return `.color-c-${key} { color: light-dark(var(${toProp(
62
+ key
63
+ )}), var(${toProp(inverseKey)})); }`;
64
+ })
65
+ .join("\n")}
66
+ `;
67
+
68
+ const getInverseKey = (key: string): string => {
69
+ const match = key.match(/^([a-z]+)(\d+)$/);
70
+ if (!match) return key;
71
+ const [, prefix, shadeStr] = match;
72
+ const shade = parseInt(shadeStr, 10);
73
+ const target = 100 - shade;
74
+ const inverseShade = shades.reduce((prev, curr) =>
75
+ Math.abs(curr - target) < Math.abs(prev - target) ? curr : prev
76
+ );
77
+ return `${prefix}${inverseShade}`;
78
+ };
79
+
80
+ const keyFactory = <K extends PaletteKeyVals>(prefix: K) => {
81
+ return shades.map((v) => `${prefix}${v}`) as PaletteKey<K>;
82
+ };
83
+
84
+ export const colors = [
85
+ color(keyFactory("p")),
86
+ color(keyFactory("s")),
87
+ color(keyFactory("t")),
88
+ color(keyFactory("n")),
89
+ color(keyFactory("nv")),
90
+ color(keyFactory("e")),
91
+ `
92
+ .color-bgc-transparent {
93
+ background-color: transparent;
94
+ }
95
+
96
+ :host {
97
+ color-scheme: var(--color-scheme);
98
+ }
99
+ `,
100
+ ];
@@ -0,0 +1,60 @@
1
+ /*
2
+ Copyright 2025 Google LLC
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ https://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ /**
18
+ * CSS classes for Google Symbols.
19
+ *
20
+ * Usage:
21
+ *
22
+ * ```html
23
+ * <span class="g-icon">pen_spark</span>
24
+ * ```
25
+ */
26
+ export const icons = `
27
+ .g-icon {
28
+ font-family: "Material Symbols Outlined", "Google Symbols";
29
+ font-weight: normal;
30
+ font-style: normal;
31
+ font-display: optional;
32
+ font-size: 20px;
33
+ width: 1em;
34
+ height: 1em;
35
+ user-select: none;
36
+ line-height: 1;
37
+ letter-spacing: normal;
38
+ text-transform: none;
39
+ display: inline-block;
40
+ white-space: nowrap;
41
+ word-wrap: normal;
42
+ direction: ltr;
43
+ -webkit-font-feature-settings: "liga";
44
+ -webkit-font-smoothing: antialiased;
45
+ overflow: hidden;
46
+
47
+ font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 48,
48
+ "ROND" 100;
49
+
50
+ &.filled {
51
+ font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 0, "opsz" 48,
52
+ "ROND" 100;
53
+ }
54
+
55
+ &.filled-heavy {
56
+ font-variation-settings: "FILL" 1, "wght" 700, "GRAD" 0, "opsz" 48,
57
+ "ROND" 100;
58
+ }
59
+ }
60
+ `;
@@ -0,0 +1,37 @@
1
+ /*
2
+ Copyright 2025 Google LLC
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ https://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ import { behavior } from "./behavior.js";
18
+ import { border } from "./border.js";
19
+ import { colors } from "./colors.js";
20
+ import { icons } from "./icons.js";
21
+ import { layout } from "./layout.js";
22
+ import { opacity } from "./opacity.js";
23
+ import { type } from "./type.js";
24
+
25
+ export * from "./utils.js";
26
+
27
+ export const structuralStyles: string = [
28
+ behavior,
29
+ border,
30
+ colors,
31
+ icons,
32
+ layout,
33
+ opacity,
34
+ type,
35
+ ]
36
+ .flat(Infinity)
37
+ .join("\n");
@@ -0,0 +1,235 @@
1
+ /*
2
+ Copyright 2025 Google LLC
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ https://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ import { grid } from "./shared.js";
18
+
19
+ export const layout = `
20
+ :host {
21
+ ${new Array(16)
22
+ .fill(0)
23
+ .map((_, idx) => {
24
+ return `--g-${idx + 1}: ${(idx + 1) * grid}px;`;
25
+ })
26
+ .join("\n")}
27
+ }
28
+
29
+ ${new Array(49)
30
+ .fill(0)
31
+ .map((_, index) => {
32
+ const idx = index - 24;
33
+ const lbl = idx < 0 ? `n${Math.abs(idx)}` : idx.toString();
34
+ return `
35
+ .layout-p-${lbl} { --padding: ${
36
+ idx * grid
37
+ }px; padding: var(--padding); }
38
+ .layout-pt-${lbl} { padding-top: ${idx * grid}px; }
39
+ .layout-pr-${lbl} { padding-right: ${idx * grid}px; }
40
+ .layout-pb-${lbl} { padding-bottom: ${idx * grid}px; }
41
+ .layout-pl-${lbl} { padding-left: ${idx * grid}px; }
42
+
43
+ .layout-m-${lbl} { --margin: ${idx * grid}px; margin: var(--margin); }
44
+ .layout-mt-${lbl} { margin-top: ${idx * grid}px; }
45
+ .layout-mr-${lbl} { margin-right: ${idx * grid}px; }
46
+ .layout-mb-${lbl} { margin-bottom: ${idx * grid}px; }
47
+ .layout-ml-${lbl} { margin-left: ${idx * grid}px; }
48
+
49
+ .layout-t-${lbl} { top: ${idx * grid}px; }
50
+ .layout-r-${lbl} { right: ${idx * grid}px; }
51
+ .layout-b-${lbl} { bottom: ${idx * grid}px; }
52
+ .layout-l-${lbl} { left: ${idx * grid}px; }`;
53
+ })
54
+ .join("\n")}
55
+
56
+ ${new Array(25)
57
+ .fill(0)
58
+ .map((_, idx) => {
59
+ return `
60
+ .layout-g-${idx} { gap: ${idx * grid}px; }`;
61
+ })
62
+ .join("\n")}
63
+
64
+ ${new Array(8)
65
+ .fill(0)
66
+ .map((_, idx) => {
67
+ return `
68
+ .layout-grd-col${idx + 1} { grid-template-columns: ${"1fr "
69
+ .repeat(idx + 1)
70
+ .trim()}; }`;
71
+ })
72
+ .join("\n")}
73
+
74
+ .layout-pos-a {
75
+ position: absolute;
76
+ }
77
+
78
+ .layout-pos-rel {
79
+ position: relative;
80
+ }
81
+
82
+ .layout-dsp-none {
83
+ display: none;
84
+ }
85
+
86
+ .layout-dsp-block {
87
+ display: block;
88
+ }
89
+
90
+ .layout-dsp-grid {
91
+ display: grid;
92
+ }
93
+
94
+ .layout-dsp-iflex {
95
+ display: inline-flex;
96
+ }
97
+
98
+ .layout-dsp-flexvert {
99
+ display: flex;
100
+ flex-direction: column;
101
+ }
102
+
103
+ .layout-dsp-flexhor {
104
+ display: flex;
105
+ flex-direction: row;
106
+ }
107
+
108
+ .layout-fw-w {
109
+ flex-wrap: wrap;
110
+ }
111
+
112
+ .layout-al-fs {
113
+ align-items: start;
114
+ }
115
+
116
+ .layout-al-fe {
117
+ align-items: end;
118
+ }
119
+
120
+ .layout-al-c {
121
+ align-items: center;
122
+ }
123
+
124
+ .layout-as-n {
125
+ align-self: normal;
126
+ }
127
+
128
+ .layout-js-c {
129
+ justify-self: center;
130
+ }
131
+
132
+ .layout-sp-c {
133
+ justify-content: center;
134
+ }
135
+
136
+ .layout-sp-ev {
137
+ justify-content: space-evenly;
138
+ }
139
+
140
+ .layout-sp-bt {
141
+ justify-content: space-between;
142
+ }
143
+
144
+ .layout-sp-s {
145
+ justify-content: start;
146
+ }
147
+
148
+ .layout-sp-e {
149
+ justify-content: end;
150
+ }
151
+
152
+ .layout-ji-e {
153
+ justify-items: end;
154
+ }
155
+
156
+ .layout-r-none {
157
+ resize: none;
158
+ }
159
+
160
+ .layout-fs-c {
161
+ field-sizing: content;
162
+ }
163
+
164
+ .layout-fs-n {
165
+ field-sizing: none;
166
+ }
167
+
168
+ .layout-flx-0 {
169
+ flex: 0 0 auto;
170
+ }
171
+
172
+ .layout-flx-1 {
173
+ flex: 1 0 auto;
174
+ }
175
+
176
+ .layout-c-s {
177
+ contain: strict;
178
+ }
179
+
180
+ /** Widths **/
181
+
182
+ ${new Array(10)
183
+ .fill(0)
184
+ .map((_, idx) => {
185
+ const weight = (idx + 1) * 10;
186
+ return `.layout-w-${weight} { width: ${weight}%; max-width: ${weight}%; }`;
187
+ })
188
+ .join("\n")}
189
+
190
+ ${new Array(16)
191
+ .fill(0)
192
+ .map((_, idx) => {
193
+ const weight = idx * grid;
194
+ return `.layout-wp-${idx} { width: ${weight}px; }`;
195
+ })
196
+ .join("\n")}
197
+
198
+ /** Heights **/
199
+
200
+ ${new Array(10)
201
+ .fill(0)
202
+ .map((_, idx) => {
203
+ const height = (idx + 1) * 10;
204
+ return `.layout-h-${height} { height: ${height}%; }`;
205
+ })
206
+ .join("\n")}
207
+
208
+ ${new Array(16)
209
+ .fill(0)
210
+ .map((_, idx) => {
211
+ const height = idx * grid;
212
+ return `.layout-hp-${idx} { height: ${height}px; }`;
213
+ })
214
+ .join("\n")}
215
+
216
+ .layout-el-cv {
217
+ & img,
218
+ & video {
219
+ width: 100%;
220
+ height: 100%;
221
+ object-fit: cover;
222
+ margin: 0;
223
+ }
224
+ }
225
+
226
+ .layout-ar-sq {
227
+ aspect-ratio: 1 / 1;
228
+ }
229
+
230
+ .layout-ex-fb {
231
+ margin: calc(var(--padding) * -1) 0 0 calc(var(--padding) * -1);
232
+ width: calc(100% + var(--padding) * 2);
233
+ height: calc(100% + var(--padding) * 2);
234
+ }
235
+ `;
@@ -0,0 +1,24 @@
1
+ /*
2
+ Copyright 2025 Google LLC
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ https://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ export const opacity = `
18
+ ${new Array(21)
19
+ .fill(0)
20
+ .map((_, idx) => {
21
+ return `.opacity-el-${idx * 5} { opacity: ${idx / 20}; }`;
22
+ })
23
+ .join("\n")}
24
+ `;
@@ -0,0 +1,17 @@
1
+ /*
2
+ Copyright 2025 Google LLC
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ https://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ export const grid = 4;