@copilotkit/shared 2.0.0-rc.4 → 2.0.0-rc.40
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/README.md +4 -15
- package/dist/a2ui-envelope.cjs +2 -2
- package/dist/a2ui-envelope.cjs.map +1 -1
- package/dist/a2ui-envelope.d.cts +1 -1
- package/dist/a2ui-envelope.d.cts.map +1 -1
- package/dist/a2ui-envelope.d.mts +1 -1
- package/dist/a2ui-envelope.d.mts.map +1 -1
- package/dist/a2ui-envelope.mjs +2 -2
- package/dist/a2ui-envelope.mjs.map +1 -1
- package/dist/a2ui-prompts.cjs +21 -62
- package/dist/a2ui-prompts.cjs.map +1 -1
- package/dist/a2ui-prompts.d.cts +8 -1
- package/dist/a2ui-prompts.d.cts.map +1 -1
- package/dist/a2ui-prompts.d.mts +8 -1
- package/dist/a2ui-prompts.d.mts.map +1 -1
- package/dist/a2ui-prompts.mjs +22 -62
- package/dist/a2ui-prompts.mjs.map +1 -1
- package/dist/attachments/types.d.cts +1 -3
- package/dist/attachments/types.d.cts.map +1 -1
- package/dist/attachments/types.d.mts +1 -3
- package/dist/attachments/types.d.mts.map +1 -1
- package/dist/attachments/utils.cjs +16 -5
- package/dist/attachments/utils.cjs.map +1 -1
- package/dist/attachments/utils.d.cts +3 -1
- package/dist/attachments/utils.d.cts.map +1 -1
- package/dist/attachments/utils.d.mts +3 -1
- package/dist/attachments/utils.d.mts.map +1 -1
- package/dist/attachments/utils.mjs +16 -5
- package/dist/attachments/utils.mjs.map +1 -1
- package/dist/finalize-events.cjs +16 -0
- package/dist/finalize-events.cjs.map +1 -1
- package/dist/finalize-events.d.cts.map +1 -1
- package/dist/finalize-events.d.mts.map +1 -1
- package/dist/finalize-events.mjs +16 -0
- package/dist/finalize-events.mjs.map +1 -1
- package/dist/generative-ui/basic-functions.cjs +1 -1
- package/dist/generative-ui/basic-functions.cjs.map +1 -1
- package/dist/generative-ui/basic-functions.mjs +1 -1
- package/dist/generative-ui/basic-functions.mjs.map +1 -1
- package/dist/generative-ui/catalog/catalog-export.cjs +329 -0
- package/dist/generative-ui/catalog/catalog-export.cjs.map +1 -0
- package/dist/generative-ui/catalog/catalog-export.d.cts +92 -0
- package/dist/generative-ui/catalog/catalog-export.d.cts.map +1 -0
- package/dist/generative-ui/catalog/catalog-export.d.mts +92 -0
- package/dist/generative-ui/catalog/catalog-export.d.mts.map +1 -0
- package/dist/generative-ui/catalog/catalog-export.mjs +328 -0
- package/dist/generative-ui/catalog/catalog-export.mjs.map +1 -0
- package/dist/generative-ui/catalog/catalog.cjs +315 -0
- package/dist/generative-ui/catalog/catalog.cjs.map +1 -0
- package/dist/generative-ui/catalog/catalog.d.cts +407 -0
- package/dist/generative-ui/catalog/catalog.d.cts.map +1 -0
- package/dist/generative-ui/catalog/catalog.d.mts +407 -0
- package/dist/generative-ui/catalog/catalog.d.mts.map +1 -0
- package/dist/generative-ui/catalog/catalog.mjs +312 -0
- package/dist/generative-ui/catalog/catalog.mjs.map +1 -0
- package/dist/generative-ui/catalog/errors.cjs +13 -0
- package/dist/generative-ui/catalog/errors.cjs.map +1 -0
- package/dist/generative-ui/catalog/errors.d.cts +46 -0
- package/dist/generative-ui/catalog/errors.d.cts.map +1 -0
- package/dist/generative-ui/catalog/errors.d.mts +46 -0
- package/dist/generative-ui/catalog/errors.d.mts.map +1 -0
- package/dist/generative-ui/catalog/errors.mjs +12 -0
- package/dist/generative-ui/catalog/errors.mjs.map +1 -0
- package/dist/generative-ui/catalog/index.d.mts +6 -0
- package/dist/generative-ui/catalog/json-schema.cjs +16 -0
- package/dist/generative-ui/catalog/json-schema.cjs.map +1 -0
- package/dist/generative-ui/catalog/json-schema.d.cts +12 -0
- package/dist/generative-ui/catalog/json-schema.d.cts.map +1 -0
- package/dist/generative-ui/catalog/json-schema.d.mts +12 -0
- package/dist/generative-ui/catalog/json-schema.d.mts.map +1 -0
- package/dist/generative-ui/catalog/json-schema.mjs +16 -0
- package/dist/generative-ui/catalog/json-schema.mjs.map +1 -0
- package/dist/generative-ui/catalog/refs.cjs +21 -0
- package/dist/generative-ui/catalog/refs.cjs.map +1 -0
- package/dist/generative-ui/catalog/refs.d.cts +55 -0
- package/dist/generative-ui/catalog/refs.d.cts.map +1 -0
- package/dist/generative-ui/catalog/refs.d.mts +55 -0
- package/dist/generative-ui/catalog/refs.d.mts.map +1 -0
- package/dist/generative-ui/catalog/refs.mjs +18 -0
- package/dist/generative-ui/catalog/refs.mjs.map +1 -0
- package/dist/generative-ui/catalog/schema.cjs +74 -0
- package/dist/generative-ui/catalog/schema.cjs.map +1 -0
- package/dist/generative-ui/catalog/schema.d.cts +43 -0
- package/dist/generative-ui/catalog/schema.d.cts.map +1 -0
- package/dist/generative-ui/catalog/schema.d.mts +43 -0
- package/dist/generative-ui/catalog/schema.d.mts.map +1 -0
- package/dist/generative-ui/catalog/schema.mjs +68 -0
- package/dist/generative-ui/catalog/schema.mjs.map +1 -0
- package/dist/generative-ui/child-refs.cjs +3 -3
- package/dist/generative-ui/child-refs.cjs.map +1 -1
- package/dist/generative-ui/child-refs.d.cts.map +1 -1
- package/dist/generative-ui/child-refs.d.mts.map +1 -1
- package/dist/generative-ui/child-refs.mjs +3 -3
- package/dist/generative-ui/child-refs.mjs.map +1 -1
- package/dist/generative-ui/clone-value.cjs +364 -0
- package/dist/generative-ui/clone-value.cjs.map +1 -0
- package/dist/generative-ui/clone-value.d.cts +51 -0
- package/dist/generative-ui/clone-value.d.cts.map +1 -0
- package/dist/generative-ui/clone-value.d.mts +51 -0
- package/dist/generative-ui/clone-value.d.mts.map +1 -0
- package/dist/generative-ui/clone-value.mjs +363 -0
- package/dist/generative-ui/clone-value.mjs.map +1 -0
- package/dist/generative-ui/compact-schema.cjs +187 -0
- package/dist/generative-ui/compact-schema.cjs.map +1 -0
- package/dist/generative-ui/compact-schema.d.cts +55 -0
- package/dist/generative-ui/compact-schema.d.cts.map +1 -0
- package/dist/generative-ui/compact-schema.d.mts +55 -0
- package/dist/generative-ui/compact-schema.d.mts.map +1 -0
- package/dist/generative-ui/compact-schema.mjs +185 -0
- package/dist/generative-ui/compact-schema.mjs.map +1 -0
- package/dist/generative-ui/index.cjs +286 -0
- package/dist/generative-ui/index.d.cts +39 -0
- package/dist/generative-ui/index.d.mts +41 -0
- package/dist/generative-ui/index.mjs +40 -0
- package/dist/generative-ui/is-record.cjs +6 -1
- package/dist/generative-ui/is-record.cjs.map +1 -1
- package/dist/generative-ui/is-record.d.cts +8 -0
- package/dist/generative-ui/is-record.d.cts.map +1 -0
- package/dist/generative-ui/is-record.d.mts +8 -0
- package/dist/generative-ui/is-record.d.mts.map +1 -0
- package/dist/generative-ui/is-record.mjs +6 -2
- package/dist/generative-ui/is-record.mjs.map +1 -1
- package/dist/generative-ui/prompt-spec.cjs +225 -0
- package/dist/generative-ui/prompt-spec.cjs.map +1 -0
- package/dist/generative-ui/prompt-spec.d.cts +94 -0
- package/dist/generative-ui/prompt-spec.d.cts.map +1 -0
- package/dist/generative-ui/prompt-spec.d.mts +94 -0
- package/dist/generative-ui/prompt-spec.d.mts.map +1 -0
- package/dist/generative-ui/prompt-spec.mjs +220 -0
- package/dist/generative-ui/prompt-spec.mjs.map +1 -0
- package/dist/generative-ui/prompt.cjs +10 -36
- package/dist/generative-ui/prompt.cjs.map +1 -1
- package/dist/generative-ui/prompt.d.cts +2 -1
- package/dist/generative-ui/prompt.d.cts.map +1 -1
- package/dist/generative-ui/prompt.d.mts +2 -1
- package/dist/generative-ui/prompt.d.mts.map +1 -1
- package/dist/generative-ui/prompt.mjs +12 -38
- package/dist/generative-ui/prompt.mjs.map +1 -1
- package/dist/generative-ui/render-ui-args.cjs +1 -0
- package/dist/generative-ui/render-ui-args.cjs.map +1 -1
- package/dist/generative-ui/render-ui-args.d.cts.map +1 -1
- package/dist/generative-ui/render-ui-args.d.mts.map +1 -1
- package/dist/generative-ui/render-ui-args.mjs +1 -0
- package/dist/generative-ui/render-ui-args.mjs.map +1 -1
- package/dist/generative-ui/schema-render.cjs +243 -0
- package/dist/generative-ui/schema-render.cjs.map +1 -0
- package/dist/generative-ui/schema-render.d.cts +44 -0
- package/dist/generative-ui/schema-render.d.cts.map +1 -0
- package/dist/generative-ui/schema-render.d.mts +44 -0
- package/dist/generative-ui/schema-render.d.mts.map +1 -0
- package/dist/generative-ui/schema-render.mjs +240 -0
- package/dist/generative-ui/schema-render.mjs.map +1 -0
- package/dist/generative-ui/standard/chart-config.cjs +347 -0
- package/dist/generative-ui/standard/chart-config.cjs.map +1 -0
- package/dist/generative-ui/standard/chart-config.d.cts +97 -0
- package/dist/generative-ui/standard/chart-config.d.cts.map +1 -0
- package/dist/generative-ui/standard/chart-config.d.mts +97 -0
- package/dist/generative-ui/standard/chart-config.d.mts.map +1 -0
- package/dist/generative-ui/standard/chart-config.mjs +342 -0
- package/dist/generative-ui/standard/chart-config.mjs.map +1 -0
- package/dist/generative-ui/standard/chart.cjs +56 -0
- package/dist/generative-ui/standard/chart.cjs.map +1 -0
- package/dist/generative-ui/standard/chart.d.cts +62 -0
- package/dist/generative-ui/standard/chart.d.cts.map +1 -0
- package/dist/generative-ui/standard/chart.d.mts +62 -0
- package/dist/generative-ui/standard/chart.d.mts.map +1 -0
- package/dist/generative-ui/standard/chart.mjs +54 -0
- package/dist/generative-ui/standard/chart.mjs.map +1 -0
- package/dist/generative-ui/standard/checks.cjs +74 -0
- package/dist/generative-ui/standard/checks.cjs.map +1 -0
- package/dist/generative-ui/standard/checks.d.cts +56 -0
- package/dist/generative-ui/standard/checks.d.cts.map +1 -0
- package/dist/generative-ui/standard/checks.d.mts +56 -0
- package/dist/generative-ui/standard/checks.d.mts.map +1 -0
- package/dist/generative-ui/standard/checks.mjs +71 -0
- package/dist/generative-ui/standard/checks.mjs.map +1 -0
- package/dist/generative-ui/standard/components.cjs +23 -0
- package/dist/generative-ui/standard/components.cjs.map +1 -0
- package/dist/generative-ui/standard/components.d.cts +24 -0
- package/dist/generative-ui/standard/components.d.cts.map +1 -0
- package/dist/generative-ui/standard/components.d.mts +24 -0
- package/dist/generative-ui/standard/components.d.mts.map +1 -0
- package/dist/generative-ui/standard/components.mjs +22 -0
- package/dist/generative-ui/standard/components.mjs.map +1 -0
- package/dist/generative-ui/standard/composites.cjs +143 -0
- package/dist/generative-ui/standard/composites.cjs.map +1 -0
- package/dist/generative-ui/standard/composites.d.cts +233 -0
- package/dist/generative-ui/standard/composites.d.cts.map +1 -0
- package/dist/generative-ui/standard/composites.d.mts +233 -0
- package/dist/generative-ui/standard/composites.d.mts.map +1 -0
- package/dist/generative-ui/standard/composites.mjs +132 -0
- package/dist/generative-ui/standard/composites.mjs.map +1 -0
- package/dist/generative-ui/standard/data.cjs +176 -0
- package/dist/generative-ui/standard/data.cjs.map +1 -0
- package/dist/generative-ui/standard/data.d.cts +365 -0
- package/dist/generative-ui/standard/data.d.cts.map +1 -0
- package/dist/generative-ui/standard/data.d.mts +365 -0
- package/dist/generative-ui/standard/data.d.mts.map +1 -0
- package/dist/generative-ui/standard/data.mjs +167 -0
- package/dist/generative-ui/standard/data.mjs.map +1 -0
- package/dist/generative-ui/standard/declarations.cjs +40 -0
- package/dist/generative-ui/standard/declarations.cjs.map +1 -0
- package/dist/generative-ui/standard/declarations.d.cts +2570 -0
- package/dist/generative-ui/standard/declarations.d.cts.map +1 -0
- package/dist/generative-ui/standard/declarations.d.mts +2571 -0
- package/dist/generative-ui/standard/declarations.d.mts.map +1 -0
- package/dist/generative-ui/standard/declarations.mjs +39 -0
- package/dist/generative-ui/standard/declarations.mjs.map +1 -0
- package/dist/generative-ui/standard/feedback.cjs +97 -0
- package/dist/generative-ui/standard/feedback.cjs.map +1 -0
- package/dist/generative-ui/standard/feedback.d.cts +133 -0
- package/dist/generative-ui/standard/feedback.d.cts.map +1 -0
- package/dist/generative-ui/standard/feedback.d.mts +133 -0
- package/dist/generative-ui/standard/feedback.d.mts.map +1 -0
- package/dist/generative-ui/standard/feedback.mjs +90 -0
- package/dist/generative-ui/standard/feedback.mjs.map +1 -0
- package/dist/generative-ui/standard/index.d.mts +20 -0
- package/dist/generative-ui/standard/inputs.cjs +333 -0
- package/dist/generative-ui/standard/inputs.cjs.map +1 -0
- package/dist/generative-ui/standard/inputs.d.cts +1128 -0
- package/dist/generative-ui/standard/inputs.d.cts.map +1 -0
- package/dist/generative-ui/standard/inputs.d.mts +1128 -0
- package/dist/generative-ui/standard/inputs.d.mts.map +1 -0
- package/dist/generative-ui/standard/inputs.mjs +318 -0
- package/dist/generative-ui/standard/inputs.mjs.map +1 -0
- package/dist/generative-ui/standard/layout.cjs +289 -0
- package/dist/generative-ui/standard/layout.cjs.map +1 -0
- package/dist/generative-ui/standard/layout.d.cts +1974 -0
- package/dist/generative-ui/standard/layout.d.cts.map +1 -0
- package/dist/generative-ui/standard/layout.d.mts +1975 -0
- package/dist/generative-ui/standard/layout.d.mts.map +1 -0
- package/dist/generative-ui/standard/layout.mjs +269 -0
- package/dist/generative-ui/standard/layout.mjs.map +1 -0
- package/dist/generative-ui/standard/map-helpers.cjs +104 -0
- package/dist/generative-ui/standard/map-helpers.cjs.map +1 -0
- package/dist/generative-ui/standard/map-helpers.d.cts +88 -0
- package/dist/generative-ui/standard/map-helpers.d.cts.map +1 -0
- package/dist/generative-ui/standard/map-helpers.d.mts +88 -0
- package/dist/generative-ui/standard/map-helpers.d.mts.map +1 -0
- package/dist/generative-ui/standard/map-helpers.mjs +95 -0
- package/dist/generative-ui/standard/map-helpers.mjs.map +1 -0
- package/dist/generative-ui/standard/map.cjs +27 -0
- package/dist/generative-ui/standard/map.cjs.map +1 -0
- package/dist/generative-ui/standard/map.d.cts +31 -0
- package/dist/generative-ui/standard/map.d.cts.map +1 -0
- package/dist/generative-ui/standard/map.d.mts +31 -0
- package/dist/generative-ui/standard/map.d.mts.map +1 -0
- package/dist/generative-ui/standard/map.mjs +25 -0
- package/dist/generative-ui/standard/map.mjs.map +1 -0
- package/dist/generative-ui/standard/media.cjs +215 -0
- package/dist/generative-ui/standard/media.cjs.map +1 -0
- package/dist/generative-ui/standard/media.d.cts +396 -0
- package/dist/generative-ui/standard/media.d.cts.map +1 -0
- package/dist/generative-ui/standard/media.d.mts +396 -0
- package/dist/generative-ui/standard/media.d.mts.map +1 -0
- package/dist/generative-ui/standard/media.mjs +205 -0
- package/dist/generative-ui/standard/media.mjs.map +1 -0
- package/dist/generative-ui/standard/parameter-order.cjs +231 -0
- package/dist/generative-ui/standard/parameter-order.cjs.map +1 -0
- package/dist/generative-ui/standard/parameter-order.d.cts +84 -0
- package/dist/generative-ui/standard/parameter-order.d.cts.map +1 -0
- package/dist/generative-ui/standard/parameter-order.d.mts +84 -0
- package/dist/generative-ui/standard/parameter-order.d.mts.map +1 -0
- package/dist/generative-ui/standard/parameter-order.mjs +230 -0
- package/dist/generative-ui/standard/parameter-order.mjs.map +1 -0
- package/dist/generative-ui/standard/style-helpers.cjs +151 -0
- package/dist/generative-ui/standard/style-helpers.cjs.map +1 -0
- package/dist/generative-ui/standard/style-helpers.d.cts +56 -0
- package/dist/generative-ui/standard/style-helpers.d.cts.map +1 -0
- package/dist/generative-ui/standard/style-helpers.d.mts +56 -0
- package/dist/generative-ui/standard/style-helpers.d.mts.map +1 -0
- package/dist/generative-ui/standard/style-helpers.mjs +142 -0
- package/dist/generative-ui/standard/style-helpers.mjs.map +1 -0
- package/dist/generative-ui/standard/styles.cjs +62 -0
- package/dist/generative-ui/standard/styles.cjs.map +1 -0
- package/dist/generative-ui/standard/styles.d.cts +17 -0
- package/dist/generative-ui/standard/styles.d.cts.map +1 -0
- package/dist/generative-ui/standard/styles.d.mts +17 -0
- package/dist/generative-ui/standard/styles.d.mts.map +1 -0
- package/dist/generative-ui/standard/styles.mjs +60 -0
- package/dist/generative-ui/standard/styles.mjs.map +1 -0
- package/dist/generative-ui/standard/text.cjs +226 -0
- package/dist/generative-ui/standard/text.cjs.map +1 -0
- package/dist/generative-ui/standard/text.d.cts +522 -0
- package/dist/generative-ui/standard/text.d.cts.map +1 -0
- package/dist/generative-ui/standard/text.d.mts +522 -0
- package/dist/generative-ui/standard/text.d.mts.map +1 -0
- package/dist/generative-ui/standard/text.mjs +209 -0
- package/dist/generative-ui/standard/text.mjs.map +1 -0
- package/dist/generative-ui/standard/theme.cjs +115 -0
- package/dist/generative-ui/standard/theme.cjs.map +1 -0
- package/dist/generative-ui/standard/theme.d.cts +60 -0
- package/dist/generative-ui/standard/theme.d.cts.map +1 -0
- package/dist/generative-ui/standard/theme.d.mts +60 -0
- package/dist/generative-ui/standard/theme.d.mts.map +1 -0
- package/dist/generative-ui/standard/theme.mjs +112 -0
- package/dist/generative-ui/standard/theme.mjs.map +1 -0
- package/dist/generative-ui/standard/tokens.cjs +336 -0
- package/dist/generative-ui/standard/tokens.cjs.map +1 -0
- package/dist/generative-ui/standard/tokens.d.cts +76 -0
- package/dist/generative-ui/standard/tokens.d.cts.map +1 -0
- package/dist/generative-ui/standard/tokens.d.mts +76 -0
- package/dist/generative-ui/standard/tokens.d.mts.map +1 -0
- package/dist/generative-ui/standard/tokens.mjs +305 -0
- package/dist/generative-ui/standard/tokens.mjs.map +1 -0
- package/dist/generative-ui/standard/url.cjs +54 -0
- package/dist/generative-ui/standard/url.cjs.map +1 -0
- package/dist/generative-ui/standard/url.d.cts +32 -0
- package/dist/generative-ui/standard/url.d.cts.map +1 -0
- package/dist/generative-ui/standard/url.d.mts +32 -0
- package/dist/generative-ui/standard/url.d.mts.map +1 -0
- package/dist/generative-ui/standard/url.mjs +50 -0
- package/dist/generative-ui/standard/url.mjs.map +1 -0
- package/dist/generative-ui/thrown.cjs +69 -0
- package/dist/generative-ui/thrown.cjs.map +1 -0
- package/dist/generative-ui/thrown.d.cts +21 -0
- package/dist/generative-ui/thrown.d.cts.map +1 -0
- package/dist/generative-ui/thrown.d.mts +21 -0
- package/dist/generative-ui/thrown.d.mts.map +1 -0
- package/dist/generative-ui/thrown.mjs +67 -0
- package/dist/generative-ui/thrown.mjs.map +1 -0
- package/dist/generative-ui/types.cjs +2 -2
- package/dist/generative-ui/types.cjs.map +1 -1
- package/dist/generative-ui/types.d.cts +7 -7
- package/dist/generative-ui/types.d.cts.map +1 -1
- package/dist/generative-ui/types.d.mts +7 -7
- package/dist/generative-ui/types.d.mts.map +1 -1
- package/dist/generative-ui/types.mjs +2 -2
- package/dist/generative-ui/types.mjs.map +1 -1
- package/dist/generative-ui/validate-operation.cjs +2 -2
- package/dist/generative-ui/validate-operation.cjs.map +1 -1
- package/dist/generative-ui/validate-operation.mjs +2 -2
- package/dist/generative-ui/validate-operation.mjs.map +1 -1
- package/dist/index.cjs +18 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -16
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +17 -16
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +10 -8
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +1233 -456
- package/dist/index.umd.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/standard-schema.cjs +20 -7
- package/dist/standard-schema.cjs.map +1 -1
- package/dist/standard-schema.d.cts +15 -16
- package/dist/standard-schema.d.cts.map +1 -1
- package/dist/standard-schema.d.mts +15 -16
- package/dist/standard-schema.d.mts.map +1 -1
- package/dist/standard-schema.mjs +20 -8
- package/dist/standard-schema.mjs.map +1 -1
- package/dist/telemetry/lambda-client.cjs +1 -1
- package/dist/telemetry/lambda-client.cjs.map +1 -1
- package/dist/telemetry/lambda-client.d.cts.map +1 -1
- package/dist/telemetry/lambda-client.d.mts.map +1 -1
- package/dist/telemetry/lambda-client.mjs +1 -1
- package/dist/telemetry/lambda-client.mjs.map +1 -1
- package/dist/telemetry/telemetry-disabled.cjs +0 -5
- package/dist/telemetry/telemetry-disabled.cjs.map +1 -1
- package/dist/telemetry/telemetry-disabled.d.cts +0 -5
- package/dist/telemetry/telemetry-disabled.d.cts.map +1 -1
- package/dist/telemetry/telemetry-disabled.d.mts +0 -5
- package/dist/telemetry/telemetry-disabled.d.mts.map +1 -1
- package/dist/telemetry/telemetry-disabled.mjs +0 -5
- package/dist/telemetry/telemetry-disabled.mjs.map +1 -1
- package/dist/types/message.d.cts +1 -18
- package/dist/types/message.d.cts.map +1 -1
- package/dist/types/message.d.mts +1 -18
- package/dist/types/message.d.mts.map +1 -1
- package/dist/utils/errors.cjs +5 -42
- package/dist/utils/errors.cjs.map +1 -1
- package/dist/utils/errors.d.cts +16 -34
- package/dist/utils/errors.d.cts.map +1 -1
- package/dist/utils/errors.d.mts +16 -34
- package/dist/utils/errors.d.mts.map +1 -1
- package/dist/utils/errors.mjs +6 -41
- package/dist/utils/errors.mjs.map +1 -1
- package/dist/utils/index.cjs +0 -2
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +4 -6
- package/dist/utils/index.d.cts.map +1 -1
- package/dist/utils/index.d.mts +4 -6
- package/dist/utils/index.d.mts.map +1 -1
- package/dist/utils/index.mjs +4 -6
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/inspector-visibility.cjs +25 -3
- package/dist/utils/inspector-visibility.cjs.map +1 -1
- package/dist/utils/inspector-visibility.d.cts +26 -3
- package/dist/utils/inspector-visibility.d.cts.map +1 -1
- package/dist/utils/inspector-visibility.d.mts +26 -3
- package/dist/utils/inspector-visibility.d.mts.map +1 -1
- package/dist/utils/inspector-visibility.mjs +25 -4
- package/dist/utils/inspector-visibility.mjs.map +1 -1
- package/dist/utils/json-schema.cjs +4 -79
- package/dist/utils/json-schema.cjs.map +1 -1
- package/dist/utils/json-schema.d.cts +1 -4
- package/dist/utils/json-schema.d.cts.map +1 -1
- package/dist/utils/json-schema.d.mts +1 -4
- package/dist/utils/json-schema.d.mts.map +1 -1
- package/dist/utils/json-schema.mjs +5 -78
- package/dist/utils/json-schema.mjs.map +1 -1
- package/dist/utils/random-id.cjs +13 -26
- package/dist/utils/random-id.cjs.map +1 -1
- package/dist/utils/random-id.d.cts +6 -3
- package/dist/utils/random-id.d.cts.map +1 -1
- package/dist/utils/random-id.d.mts +6 -3
- package/dist/utils/random-id.d.mts.map +1 -1
- package/dist/utils/random-id.mjs +14 -25
- package/dist/utils/random-id.mjs.map +1 -1
- package/package.json +19 -32
- package/scripts/verify-cjs-exports.cjs +1 -1
- package/src/__tests__/a2ui-envelope.test.ts +18 -13
- package/src/__tests__/a2ui-prompts.test.ts +47 -14
- package/src/__tests__/fixtures/prompt-goldens.json +354 -0
- package/src/__tests__/prompt-spec.test.ts +191 -0
- package/src/__tests__/root-entry-browser-safety.test.ts +5 -7
- package/src/__tests__/schema-render.test.ts +323 -0
- package/src/__tests__/standard-schema.test.ts +61 -101
- package/src/a2ui-envelope.ts +7 -6
- package/src/a2ui-prompts.ts +47 -96
- package/src/attachments/__tests__/utils.test.ts +22 -0
- package/src/attachments/types.ts +1 -3
- package/src/attachments/utils.ts +23 -5
- package/src/finalize-events.ts +16 -0
- package/src/generative-ui/__tests__/clone-value-differential.test.ts +480 -0
- package/src/generative-ui/__tests__/clone-value.test.ts +226 -0
- package/src/generative-ui/__tests__/render-ui-args.test.ts +7 -7
- package/src/generative-ui/__tests__/validate-operation.test.ts +19 -13
- package/src/generative-ui/base.ts +9 -0
- package/src/generative-ui/basic-functions.ts +1 -1
- package/src/generative-ui/catalog/catalog-export.ts +478 -0
- package/src/generative-ui/catalog/catalog.ts +1167 -0
- package/src/generative-ui/catalog/errors.ts +102 -0
- package/src/generative-ui/catalog/index.ts +6 -0
- package/src/generative-ui/catalog/json-schema.ts +14 -0
- package/src/generative-ui/catalog/refs.ts +87 -0
- package/src/generative-ui/catalog/schema.ts +107 -0
- package/src/generative-ui/child-refs.ts +5 -4
- package/src/generative-ui/clone-value.ts +511 -0
- package/src/generative-ui/compact-schema.ts +277 -0
- package/src/generative-ui/index.ts +14 -0
- package/src/generative-ui/is-record.ts +6 -1
- package/src/generative-ui/prompt-spec.ts +335 -0
- package/src/generative-ui/prompt.ts +25 -75
- package/src/generative-ui/render-ui-args.ts +3 -0
- package/src/generative-ui/schema-render.ts +378 -0
- package/src/generative-ui/standard/__tests__/standard-helpers.test.ts +407 -0
- package/src/generative-ui/standard/__tests__/theme.test.ts +61 -0
- package/src/generative-ui/standard/__tests__/tokens.test.ts +139 -0
- package/src/generative-ui/standard/chart-config.ts +434 -0
- package/src/generative-ui/standard/chart.ts +79 -0
- package/src/generative-ui/standard/checks.ts +98 -0
- package/src/generative-ui/standard/components.ts +35 -0
- package/src/generative-ui/standard/composites.ts +158 -0
- package/src/generative-ui/standard/data.ts +213 -0
- package/src/generative-ui/standard/declarations.ts +57 -0
- package/src/generative-ui/standard/feedback.ts +105 -0
- package/src/generative-ui/standard/index.ts +55 -0
- package/src/generative-ui/standard/inputs.ts +423 -0
- package/src/generative-ui/standard/layout.ts +312 -0
- package/src/generative-ui/standard/map-helpers.ts +155 -0
- package/src/generative-ui/standard/map.ts +32 -0
- package/src/generative-ui/standard/media.ts +265 -0
- package/src/generative-ui/standard/parameter-order.ts +155 -0
- package/src/generative-ui/standard/style-helpers.ts +170 -0
- package/src/generative-ui/standard/styles.ts +79 -0
- package/src/generative-ui/standard/text.ts +210 -0
- package/src/generative-ui/standard/theme.ts +198 -0
- package/src/generative-ui/standard/tokens.ts +317 -0
- package/src/generative-ui/standard/url.ts +51 -0
- package/src/generative-ui/thrown.ts +90 -0
- package/src/generative-ui/types.ts +10 -7
- package/src/generative-ui/validate-operation.ts +2 -2
- package/src/index.ts +9 -17
- package/src/standard-schema.ts +24 -27
- package/src/telemetry/lambda-client.ts +8 -3
- package/src/telemetry/model-host.test.ts +2 -5
- package/src/telemetry/telemetry-disabled.ts +0 -5
- package/src/types/message.ts +1 -19
- package/src/utils/__tests__/errors.test.ts +44 -0
- package/src/utils/__tests__/json-schema.test.ts +3 -479
- package/src/utils/__tests__/random-id.test.ts +37 -0
- package/src/utils/errors.ts +28 -85
- package/src/utils/index.ts +0 -2
- package/src/utils/inspector-visibility.test.ts +26 -0
- package/src/utils/inspector-visibility.ts +35 -3
- package/src/utils/json-schema.ts +5 -152
- package/src/utils/random-id.ts +17 -37
- package/tsconfig.json +3 -1
- package/tsdown.config.ts +2 -19
- package/dist/event-transforms/index.cjs +0 -15
- package/dist/event-transforms/index.d.cts +0 -4
- package/dist/event-transforms/index.d.mts +0 -4
- package/dist/event-transforms/index.mjs +0 -5
- package/dist/event-transforms/open-generative-ui-middleware.cjs +0 -286
- package/dist/event-transforms/open-generative-ui-middleware.cjs.map +0 -1
- package/dist/event-transforms/open-generative-ui-middleware.d.cts +0 -60
- package/dist/event-transforms/open-generative-ui-middleware.d.cts.map +0 -1
- package/dist/event-transforms/open-generative-ui-middleware.d.mts +0 -60
- package/dist/event-transforms/open-generative-ui-middleware.d.mts.map +0 -1
- package/dist/event-transforms/open-generative-ui-middleware.mjs +0 -283
- package/dist/event-transforms/open-generative-ui-middleware.mjs.map +0 -1
- package/dist/event-transforms/recorded-events.cjs +0 -59
- package/dist/event-transforms/recorded-events.cjs.map +0 -1
- package/dist/event-transforms/recorded-events.d.cts +0 -23
- package/dist/event-transforms/recorded-events.d.cts.map +0 -1
- package/dist/event-transforms/recorded-events.d.mts +0 -23
- package/dist/event-transforms/recorded-events.d.mts.map +0 -1
- package/dist/event-transforms/recorded-events.mjs +0 -58
- package/dist/event-transforms/recorded-events.mjs.map +0 -1
- package/dist/telemetry/events.d.cts +0 -72
- package/dist/telemetry/events.d.cts.map +0 -1
- package/dist/telemetry/events.d.mts +0 -72
- package/dist/telemetry/events.d.mts.map +0 -1
- package/dist/telemetry/index.cjs +0 -18
- package/dist/telemetry/index.d.cts +0 -5
- package/dist/telemetry/index.d.mts +0 -5
- package/dist/telemetry/index.mjs +0 -6
- package/dist/telemetry/telemetry-client.cjs +0 -165
- package/dist/telemetry/telemetry-client.cjs.map +0 -1
- package/dist/telemetry/telemetry-client.d.cts +0 -87
- package/dist/telemetry/telemetry-client.d.cts.map +0 -1
- package/dist/telemetry/telemetry-client.d.mts +0 -87
- package/dist/telemetry/telemetry-client.d.mts.map +0 -1
- package/dist/telemetry/telemetry-client.mjs +0 -164
- package/dist/telemetry/telemetry-client.mjs.map +0 -1
- package/dist/telemetry/utils.cjs +0 -14
- package/dist/telemetry/utils.cjs.map +0 -1
- package/dist/telemetry/utils.mjs +0 -13
- package/dist/telemetry/utils.mjs.map +0 -1
- package/dist/utils/conditions.cjs +0 -32
- package/dist/utils/conditions.cjs.map +0 -1
- package/dist/utils/conditions.d.cts +0 -31
- package/dist/utils/conditions.d.cts.map +0 -1
- package/dist/utils/conditions.d.mts +0 -31
- package/dist/utils/conditions.d.mts.map +0 -1
- package/dist/utils/conditions.mjs +0 -31
- package/dist/utils/conditions.mjs.map +0 -1
- package/dist/utils/console-styling.cjs +0 -91
- package/dist/utils/console-styling.cjs.map +0 -1
- package/dist/utils/console-styling.d.cts +0 -65
- package/dist/utils/console-styling.d.cts.map +0 -1
- package/dist/utils/console-styling.d.mts +0 -65
- package/dist/utils/console-styling.d.mts.map +0 -1
- package/dist/utils/console-styling.mjs +0 -85
- package/dist/utils/console-styling.mjs.map +0 -1
- package/src/__tests__/zod-regression.test.ts +0 -319
- package/src/event-transforms/index.ts +0 -5
- package/src/event-transforms/open-generative-ui-middleware.ts +0 -392
- package/src/event-transforms/recorded-events.test.ts +0 -166
- package/src/event-transforms/recorded-events.ts +0 -74
- package/src/telemetry/events.ts +0 -68
- package/src/telemetry/index.ts +0 -9
- package/src/telemetry/telemetry-blank-license-identity.test.ts +0 -128
- package/src/telemetry/telemetry-client.test.ts +0 -798
- package/src/telemetry/telemetry-client.ts +0 -328
- package/src/telemetry/utils.ts +0 -15
- package/src/utils/__tests__/conditions.test.ts +0 -161
- package/src/utils/conditions.ts +0 -116
- package/src/utils/console-styling.ts +0 -126
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
const require_tokens = require('./tokens.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/generative-ui/standard/style-helpers.ts
|
|
4
|
+
/**
|
|
5
|
+
* Equal when the JSON is equal. Use it as the equality check of a computed
|
|
6
|
+
* value over agent data, so a new object with the same content does not
|
|
7
|
+
* trigger a redraw.
|
|
8
|
+
*/
|
|
9
|
+
const jsonEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
10
|
+
/** Hides an element on screen. Screen readers still read it. */
|
|
11
|
+
const VISUALLY_HIDDEN = {
|
|
12
|
+
position: "absolute",
|
|
13
|
+
width: "1px",
|
|
14
|
+
height: "1px",
|
|
15
|
+
padding: 0,
|
|
16
|
+
margin: "-1px",
|
|
17
|
+
overflow: "hidden",
|
|
18
|
+
clipPath: "inset(50%)",
|
|
19
|
+
whiteSpace: "nowrap",
|
|
20
|
+
border: 0
|
|
21
|
+
};
|
|
22
|
+
/** The outline of a focused control, for a `:focus-visible` rule. */
|
|
23
|
+
const FOCUS_RING = "2px solid var(--a2ui-color-focus, #0285ff)";
|
|
24
|
+
/**
|
|
25
|
+
* Cuts the text after `lines` lines, with an ellipsis.
|
|
26
|
+
*
|
|
27
|
+
* @param lines - The number of lines to show.
|
|
28
|
+
*/
|
|
29
|
+
function lineClamp(lines) {
|
|
30
|
+
return {
|
|
31
|
+
display: "-webkit-box",
|
|
32
|
+
WebkitLineClamp: lines,
|
|
33
|
+
WebkitBoxOrient: "vertical",
|
|
34
|
+
overflow: "hidden"
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** The `align-items` value of each `align` prop value. */
|
|
38
|
+
const ALIGN_CSS = {
|
|
39
|
+
start: "flex-start",
|
|
40
|
+
end: "flex-end",
|
|
41
|
+
center: "center",
|
|
42
|
+
baseline: "baseline",
|
|
43
|
+
stretch: "stretch"
|
|
44
|
+
};
|
|
45
|
+
/** The `justify-content` value of each `justify` prop value. */
|
|
46
|
+
const JUSTIFY_CSS = {
|
|
47
|
+
start: "flex-start",
|
|
48
|
+
end: "flex-end",
|
|
49
|
+
center: "center",
|
|
50
|
+
spaceBetween: "space-between",
|
|
51
|
+
spaceAround: "space-around",
|
|
52
|
+
spaceEvenly: "space-evenly",
|
|
53
|
+
stretch: "stretch"
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* A CSS length: pixels when `value` is a number, the raw CSS when it is a
|
|
57
|
+
* string, and `undefined` when it is not set.
|
|
58
|
+
*
|
|
59
|
+
* @example px(12) // "12px"
|
|
60
|
+
*/
|
|
61
|
+
function px(value) {
|
|
62
|
+
if (value === void 0) return void 0;
|
|
63
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The CSS of a `radius` prop: one radius for all corners, or one radius for
|
|
67
|
+
* each corner.
|
|
68
|
+
*
|
|
69
|
+
* @param value - A radius token, a raw CSS value, or an object of corners.
|
|
70
|
+
*/
|
|
71
|
+
function radiusStyle(value) {
|
|
72
|
+
if (typeof value === "string" || typeof value === "number") return { borderRadius: require_tokens.radius(value) };
|
|
73
|
+
if (value === void 0) return {};
|
|
74
|
+
return {
|
|
75
|
+
borderTopLeftRadius: require_tokens.radius(value.topLeft),
|
|
76
|
+
borderTopRightRadius: require_tokens.radius(value.topRight),
|
|
77
|
+
borderBottomLeftRadius: require_tokens.radius(value.bottomLeft),
|
|
78
|
+
borderBottomRightRadius: require_tokens.radius(value.bottomRight)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A copy of `style` without the undefined entries, so a later spread never
|
|
83
|
+
* erases a value. An undefined longhand next to a shorthand is a removal:
|
|
84
|
+
* clearing `row-gap` resets the `gap` shorthand in real browsers.
|
|
85
|
+
*/
|
|
86
|
+
function defined(style) {
|
|
87
|
+
const result = {};
|
|
88
|
+
for (const [key, value] of Object.entries(style)) if (value !== void 0) result[key] = value;
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The `gap` of the layout props, with `rowGap` and `columnGap` winning over
|
|
93
|
+
* it. A renderer can apply a style object in sorted key order (Angular does),
|
|
94
|
+
* so `columnGap` would come before the `gap` shorthand and lose to it. A
|
|
95
|
+
* longhand therefore sets both longhands and no shorthand.
|
|
96
|
+
*/
|
|
97
|
+
function gapStyle(props) {
|
|
98
|
+
const gap = require_tokens.spacing(props.gap) ?? (props.disableAutoSpacing ? 0 : void 0);
|
|
99
|
+
const rowGap = require_tokens.spacing(props.rowGap);
|
|
100
|
+
const columnGap = require_tokens.spacing(props.columnGap);
|
|
101
|
+
if (rowGap === void 0 && columnGap === void 0) return { gap };
|
|
102
|
+
return {
|
|
103
|
+
rowGap: rowGap ?? gap,
|
|
104
|
+
columnGap: columnGap ?? gap
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The flex container CSS of the shared layout props (`align`, `gap`,
|
|
109
|
+
* `padding`, `radius`, sizes and the rest). An unset prop gives no CSS.
|
|
110
|
+
*
|
|
111
|
+
* @param props - The layout props of a container component.
|
|
112
|
+
*/
|
|
113
|
+
function layoutStyle(props) {
|
|
114
|
+
const overflow = props.scrollable ? "auto" : props.clip ? "hidden" : void 0;
|
|
115
|
+
return defined({
|
|
116
|
+
display: props.inline ? "inline-flex" : "flex",
|
|
117
|
+
alignItems: props.align ? ALIGN_CSS[props.align] : void 0,
|
|
118
|
+
justifyContent: props.justify ? JUSTIFY_CSS[props.justify] : void 0,
|
|
119
|
+
flexWrap: props.wrap,
|
|
120
|
+
...gapStyle(props),
|
|
121
|
+
padding: props.flush ? 0 : require_tokens.spacing(props.padding),
|
|
122
|
+
background: require_tokens.backgroundColor(props.background),
|
|
123
|
+
border: props.border ? `1px solid ${require_tokens.borderColor(props.borderColor ?? "default")}` : void 0,
|
|
124
|
+
...radiusStyle(props.radius),
|
|
125
|
+
width: require_tokens.spacing(props.width),
|
|
126
|
+
height: require_tokens.spacing(props.height),
|
|
127
|
+
minWidth: require_tokens.spacing(props.minWidth ?? props.minSize) ?? 0,
|
|
128
|
+
maxWidth: require_tokens.spacing(props.maxWidth ?? props.maxSize) ?? "100%",
|
|
129
|
+
minHeight: require_tokens.spacing(props.minHeight ?? props.minSize),
|
|
130
|
+
maxHeight: require_tokens.spacing(props.maxHeight ?? props.maxSize),
|
|
131
|
+
flex: props.flex,
|
|
132
|
+
flexGrow: props.weight,
|
|
133
|
+
aspectRatio: props.aspectRatio,
|
|
134
|
+
overflow,
|
|
135
|
+
boxShadow: props.shadow ? require_tokens.SHADOW_SM : void 0,
|
|
136
|
+
boxSizing: "border-box"
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//#endregion
|
|
141
|
+
exports.ALIGN_CSS = ALIGN_CSS;
|
|
142
|
+
exports.FOCUS_RING = FOCUS_RING;
|
|
143
|
+
exports.JUSTIFY_CSS = JUSTIFY_CSS;
|
|
144
|
+
exports.VISUALLY_HIDDEN = VISUALLY_HIDDEN;
|
|
145
|
+
exports.defined = defined;
|
|
146
|
+
exports.jsonEqual = jsonEqual;
|
|
147
|
+
exports.layoutStyle = layoutStyle;
|
|
148
|
+
exports.lineClamp = lineClamp;
|
|
149
|
+
exports.px = px;
|
|
150
|
+
exports.radiusStyle = radiusStyle;
|
|
151
|
+
//# sourceMappingURL=style-helpers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-helpers.cjs","names":["radius","spacing","backgroundColor","borderColor","SHADOW_SM"],"sources":["../../../src/generative-ui/standard/style-helpers.ts"],"sourcesContent":["// Framework-free style helpers of the standard components. Each framework\n// binds the returned style objects to its own elements.\nimport {\n SHADOW_SM,\n backgroundColor,\n borderColor,\n radius,\n spacing,\n} from \"./tokens\";\nimport type { ALIGN, JUSTIFY } from \"./tokens\";\nimport type { LayoutProps } from \"./layout\";\n\n/** An inline style object, with camelCase CSS properties as keys. */\nexport type StyleMap = Record<string, string | number | undefined>;\n\n/**\n * Equal when the JSON is equal. Use it as the equality check of a computed\n * value over agent data, so a new object with the same content does not\n * trigger a redraw.\n */\nexport const jsonEqual = (a: unknown, b: unknown) =>\n JSON.stringify(a) === JSON.stringify(b);\n\n/** Hides an element on screen. Screen readers still read it. */\nexport const VISUALLY_HIDDEN: StyleMap = {\n position: \"absolute\",\n width: \"1px\",\n height: \"1px\",\n padding: 0,\n margin: \"-1px\",\n overflow: \"hidden\",\n clipPath: \"inset(50%)\",\n whiteSpace: \"nowrap\",\n border: 0,\n};\n\n/** The outline of a focused control, for a `:focus-visible` rule. */\nexport const FOCUS_RING = \"2px solid var(--a2ui-color-focus, #0285ff)\";\n\n/**\n * Cuts the text after `lines` lines, with an ellipsis.\n *\n * @param lines - The number of lines to show.\n */\nexport function lineClamp(lines: number): StyleMap {\n return {\n display: \"-webkit-box\",\n WebkitLineClamp: lines,\n WebkitBoxOrient: \"vertical\",\n overflow: \"hidden\",\n };\n}\n\n/** The `align-items` value of each `align` prop value. */\nexport const ALIGN_CSS: Record<(typeof ALIGN)[number], string> = {\n start: \"flex-start\",\n end: \"flex-end\",\n center: \"center\",\n baseline: \"baseline\",\n stretch: \"stretch\",\n};\n\n/** The `justify-content` value of each `justify` prop value. */\nexport const JUSTIFY_CSS: Record<(typeof JUSTIFY)[number], string> = {\n start: \"flex-start\",\n end: \"flex-end\",\n center: \"center\",\n spaceBetween: \"space-between\",\n spaceAround: \"space-around\",\n spaceEvenly: \"space-evenly\",\n stretch: \"stretch\",\n};\n\n/**\n * A CSS length: pixels when `value` is a number, the raw CSS when it is a\n * string, and `undefined` when it is not set.\n *\n * @example px(12) // \"12px\"\n */\nexport function px(value: number | string | undefined) {\n if (value === undefined) return undefined;\n return typeof value === \"number\" ? `${value}px` : value;\n}\n\n/**\n * The CSS of a `radius` prop: one radius for all corners, or one radius for\n * each corner.\n *\n * @param value - A radius token, a raw CSS value, or an object of corners.\n */\nexport function radiusStyle(value: LayoutProps[\"radius\"]): StyleMap {\n if (typeof value === \"string\" || typeof value === \"number\") {\n return { borderRadius: radius(value) };\n }\n if (value === undefined) return {};\n return {\n borderTopLeftRadius: radius(value.topLeft),\n borderTopRightRadius: radius(value.topRight),\n borderBottomLeftRadius: radius(value.bottomLeft),\n borderBottomRightRadius: radius(value.bottomRight),\n };\n}\n\n/**\n * A copy of `style` without the undefined entries, so a later spread never\n * erases a value. An undefined longhand next to a shorthand is a removal:\n * clearing `row-gap` resets the `gap` shorthand in real browsers.\n */\nexport function defined(style: StyleMap): StyleMap {\n const result: StyleMap = {};\n for (const [key, value] of Object.entries(style)) {\n if (value !== undefined) result[key] = value;\n }\n return result;\n}\n\n/**\n * The `gap` of the layout props, with `rowGap` and `columnGap` winning over\n * it. A renderer can apply a style object in sorted key order (Angular does),\n * so `columnGap` would come before the `gap` shorthand and lose to it. A\n * longhand therefore sets both longhands and no shorthand.\n */\nfunction gapStyle(props: LayoutProps): StyleMap {\n const gap = spacing(props.gap) ?? (props.disableAutoSpacing ? 0 : undefined);\n const rowGap = spacing(props.rowGap);\n const columnGap = spacing(props.columnGap);\n if (rowGap === undefined && columnGap === undefined) return { gap };\n return { rowGap: rowGap ?? gap, columnGap: columnGap ?? gap };\n}\n\n/**\n * The flex container CSS of the shared layout props (`align`, `gap`,\n * `padding`, `radius`, sizes and the rest). An unset prop gives no CSS.\n *\n * @param props - The layout props of a container component.\n */\nexport function layoutStyle(props: LayoutProps): StyleMap {\n const overflow = props.scrollable\n ? \"auto\"\n : props.clip\n ? \"hidden\"\n : undefined;\n return defined({\n display: props.inline ? \"inline-flex\" : \"flex\",\n alignItems: props.align ? ALIGN_CSS[props.align] : undefined,\n justifyContent: props.justify ? JUSTIFY_CSS[props.justify] : undefined,\n flexWrap: props.wrap,\n ...gapStyle(props),\n padding: props.flush ? 0 : spacing(props.padding),\n background: backgroundColor(props.background),\n border: props.border\n ? `1px solid ${borderColor(props.borderColor ?? \"default\")}`\n : undefined,\n ...radiusStyle(props.radius),\n width: spacing(props.width),\n height: spacing(props.height),\n // A container can shrink below its content and never gets wider than\n // its parent.\n minWidth: spacing(props.minWidth ?? props.minSize) ?? 0,\n maxWidth: spacing(props.maxWidth ?? props.maxSize) ?? \"100%\",\n minHeight: spacing(props.minHeight ?? props.minSize),\n maxHeight: spacing(props.maxHeight ?? props.maxSize),\n flex: props.flex,\n flexGrow: props.weight,\n aspectRatio: props.aspectRatio,\n overflow,\n boxShadow: props.shadow ? SHADOW_SM : undefined,\n boxSizing: \"border-box\",\n });\n}\n"],"mappings":";;;;;;;;AAoBA,MAAa,aAAa,GAAY,MACpC,KAAK,UAAU,EAAE,KAAK,KAAK,UAAU,EAAE;;AAGzC,MAAa,kBAA4B;CACvC,UAAU;CACV,OAAO;CACP,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,YAAY;CACZ,QAAQ;CACT;;AAGD,MAAa,aAAa;;;;;;AAO1B,SAAgB,UAAU,OAAyB;AACjD,QAAO;EACL,SAAS;EACT,iBAAiB;EACjB,iBAAiB;EACjB,UAAU;EACX;;;AAIH,MAAa,YAAoD;CAC/D,OAAO;CACP,KAAK;CACL,QAAQ;CACR,UAAU;CACV,SAAS;CACV;;AAGD,MAAa,cAAwD;CACnE,OAAO;CACP,KAAK;CACL,QAAQ;CACR,cAAc;CACd,aAAa;CACb,aAAa;CACb,SAAS;CACV;;;;;;;AAQD,SAAgB,GAAG,OAAoC;AACrD,KAAI,UAAU,OAAW,QAAO;AAChC,QAAO,OAAO,UAAU,WAAW,GAAG,MAAM,MAAM;;;;;;;;AASpD,SAAgB,YAAY,OAAwC;AAClE,KAAI,OAAO,UAAU,YAAY,OAAO,UAAU,SAChD,QAAO,EAAE,cAAcA,sBAAO,MAAM,EAAE;AAExC,KAAI,UAAU,OAAW,QAAO,EAAE;AAClC,QAAO;EACL,qBAAqBA,sBAAO,MAAM,QAAQ;EAC1C,sBAAsBA,sBAAO,MAAM,SAAS;EAC5C,wBAAwBA,sBAAO,MAAM,WAAW;EAChD,yBAAyBA,sBAAO,MAAM,YAAY;EACnD;;;;;;;AAQH,SAAgB,QAAQ,OAA2B;CACjD,MAAM,SAAmB,EAAE;AAC3B,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC9C,KAAI,UAAU,OAAW,QAAO,OAAO;AAEzC,QAAO;;;;;;;;AAST,SAAS,SAAS,OAA8B;CAC9C,MAAM,MAAMC,uBAAQ,MAAM,IAAI,KAAK,MAAM,qBAAqB,IAAI;CAClE,MAAM,SAASA,uBAAQ,MAAM,OAAO;CACpC,MAAM,YAAYA,uBAAQ,MAAM,UAAU;AAC1C,KAAI,WAAW,UAAa,cAAc,OAAW,QAAO,EAAE,KAAK;AACnE,QAAO;EAAE,QAAQ,UAAU;EAAK,WAAW,aAAa;EAAK;;;;;;;;AAS/D,SAAgB,YAAY,OAA8B;CACxD,MAAM,WAAW,MAAM,aACnB,SACA,MAAM,OACJ,WACA;AACN,QAAO,QAAQ;EACb,SAAS,MAAM,SAAS,gBAAgB;EACxC,YAAY,MAAM,QAAQ,UAAU,MAAM,SAAS;EACnD,gBAAgB,MAAM,UAAU,YAAY,MAAM,WAAW;EAC7D,UAAU,MAAM;EAChB,GAAG,SAAS,MAAM;EAClB,SAAS,MAAM,QAAQ,IAAIA,uBAAQ,MAAM,QAAQ;EACjD,YAAYC,+BAAgB,MAAM,WAAW;EAC7C,QAAQ,MAAM,SACV,aAAaC,2BAAY,MAAM,eAAe,UAAU,KACxD;EACJ,GAAG,YAAY,MAAM,OAAO;EAC5B,OAAOF,uBAAQ,MAAM,MAAM;EAC3B,QAAQA,uBAAQ,MAAM,OAAO;EAG7B,UAAUA,uBAAQ,MAAM,YAAY,MAAM,QAAQ,IAAI;EACtD,UAAUA,uBAAQ,MAAM,YAAY,MAAM,QAAQ,IAAI;EACtD,WAAWA,uBAAQ,MAAM,aAAa,MAAM,QAAQ;EACpD,WAAWA,uBAAQ,MAAM,aAAa,MAAM,QAAQ;EACpD,MAAM,MAAM;EACZ,UAAU,MAAM;EAChB,aAAa,MAAM;EACnB;EACA,WAAW,MAAM,SAASG,2BAAY;EACtC,WAAW;EACZ,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ALIGN, JUSTIFY } from "./tokens.cjs";
|
|
2
|
+
import { LayoutProps } from "./layout.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/generative-ui/standard/style-helpers.d.ts
|
|
5
|
+
/** An inline style object, with camelCase CSS properties as keys. */
|
|
6
|
+
type StyleMap = Record<string, string | number | undefined>;
|
|
7
|
+
/**
|
|
8
|
+
* Equal when the JSON is equal. Use it as the equality check of a computed
|
|
9
|
+
* value over agent data, so a new object with the same content does not
|
|
10
|
+
* trigger a redraw.
|
|
11
|
+
*/
|
|
12
|
+
declare const jsonEqual: (a: unknown, b: unknown) => boolean;
|
|
13
|
+
/** Hides an element on screen. Screen readers still read it. */
|
|
14
|
+
declare const VISUALLY_HIDDEN: StyleMap;
|
|
15
|
+
/** The outline of a focused control, for a `:focus-visible` rule. */
|
|
16
|
+
declare const FOCUS_RING = "2px solid var(--a2ui-color-focus, #0285ff)";
|
|
17
|
+
/**
|
|
18
|
+
* Cuts the text after `lines` lines, with an ellipsis.
|
|
19
|
+
*
|
|
20
|
+
* @param lines - The number of lines to show.
|
|
21
|
+
*/
|
|
22
|
+
declare function lineClamp(lines: number): StyleMap;
|
|
23
|
+
/** The `align-items` value of each `align` prop value. */
|
|
24
|
+
declare const ALIGN_CSS: Record<(typeof ALIGN)[number], string>;
|
|
25
|
+
/** The `justify-content` value of each `justify` prop value. */
|
|
26
|
+
declare const JUSTIFY_CSS: Record<(typeof JUSTIFY)[number], string>;
|
|
27
|
+
/**
|
|
28
|
+
* A CSS length: pixels when `value` is a number, the raw CSS when it is a
|
|
29
|
+
* string, and `undefined` when it is not set.
|
|
30
|
+
*
|
|
31
|
+
* @example px(12) // "12px"
|
|
32
|
+
*/
|
|
33
|
+
declare function px(value: number | string | undefined): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The CSS of a `radius` prop: one radius for all corners, or one radius for
|
|
36
|
+
* each corner.
|
|
37
|
+
*
|
|
38
|
+
* @param value - A radius token, a raw CSS value, or an object of corners.
|
|
39
|
+
*/
|
|
40
|
+
declare function radiusStyle(value: LayoutProps["radius"]): StyleMap;
|
|
41
|
+
/**
|
|
42
|
+
* A copy of `style` without the undefined entries, so a later spread never
|
|
43
|
+
* erases a value. An undefined longhand next to a shorthand is a removal:
|
|
44
|
+
* clearing `row-gap` resets the `gap` shorthand in real browsers.
|
|
45
|
+
*/
|
|
46
|
+
declare function defined(style: StyleMap): StyleMap;
|
|
47
|
+
/**
|
|
48
|
+
* The flex container CSS of the shared layout props (`align`, `gap`,
|
|
49
|
+
* `padding`, `radius`, sizes and the rest). An unset prop gives no CSS.
|
|
50
|
+
*
|
|
51
|
+
* @param props - The layout props of a container component.
|
|
52
|
+
*/
|
|
53
|
+
declare function layoutStyle(props: LayoutProps): StyleMap;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { ALIGN_CSS, FOCUS_RING, JUSTIFY_CSS, StyleMap, VISUALLY_HIDDEN, defined, jsonEqual, layoutStyle, lineClamp, px, radiusStyle };
|
|
56
|
+
//# sourceMappingURL=style-helpers.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-helpers.d.cts","names":[],"sources":["../../../src/generative-ui/standard/style-helpers.ts"],"mappings":";;;;;KAaY,QAAA,GAAW,MAAA;AAAvB;;;;;AAAA,cAOa,SAAA,GAAa,CAAA,WAAY,CAAA;;cAIzB,eAAA,EAAiB,QAAA;;cAajB,UAAA;AAbb;;;;;AAAA,iBAoBgB,SAAA,CAAU,KAAA,WAAgB,QAAA;;cAU7B,SAAA,EAAW,MAAA,SAAe,KAAA;;cAS1B,WAAA,EAAa,MAAA,SAAe,OAAA;AAnBzC;;;;;AAUA;AAVA,iBAmCgB,EAAA,CAAG,KAAA;;;;AAhBnB;;;iBA2BgB,WAAA,CAAY,KAAA,EAAO,WAAA,aAAwB,QAAA;;AAX3D;;;;iBA6BgB,OAAA,CAAQ,KAAA,EAAO,QAAA,GAAW,QAAA;AAlB1C;;;;;;AAAA,iBA8CgB,WAAA,CAAY,KAAA,EAAO,WAAA,GAAc,QAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ALIGN, JUSTIFY } from "./tokens.mjs";
|
|
2
|
+
import { LayoutProps } from "./layout.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/generative-ui/standard/style-helpers.d.ts
|
|
5
|
+
/** An inline style object, with camelCase CSS properties as keys. */
|
|
6
|
+
type StyleMap = Record<string, string | number | undefined>;
|
|
7
|
+
/**
|
|
8
|
+
* Equal when the JSON is equal. Use it as the equality check of a computed
|
|
9
|
+
* value over agent data, so a new object with the same content does not
|
|
10
|
+
* trigger a redraw.
|
|
11
|
+
*/
|
|
12
|
+
declare const jsonEqual: (a: unknown, b: unknown) => boolean;
|
|
13
|
+
/** Hides an element on screen. Screen readers still read it. */
|
|
14
|
+
declare const VISUALLY_HIDDEN: StyleMap;
|
|
15
|
+
/** The outline of a focused control, for a `:focus-visible` rule. */
|
|
16
|
+
declare const FOCUS_RING = "2px solid var(--a2ui-color-focus, #0285ff)";
|
|
17
|
+
/**
|
|
18
|
+
* Cuts the text after `lines` lines, with an ellipsis.
|
|
19
|
+
*
|
|
20
|
+
* @param lines - The number of lines to show.
|
|
21
|
+
*/
|
|
22
|
+
declare function lineClamp(lines: number): StyleMap;
|
|
23
|
+
/** The `align-items` value of each `align` prop value. */
|
|
24
|
+
declare const ALIGN_CSS: Record<(typeof ALIGN)[number], string>;
|
|
25
|
+
/** The `justify-content` value of each `justify` prop value. */
|
|
26
|
+
declare const JUSTIFY_CSS: Record<(typeof JUSTIFY)[number], string>;
|
|
27
|
+
/**
|
|
28
|
+
* A CSS length: pixels when `value` is a number, the raw CSS when it is a
|
|
29
|
+
* string, and `undefined` when it is not set.
|
|
30
|
+
*
|
|
31
|
+
* @example px(12) // "12px"
|
|
32
|
+
*/
|
|
33
|
+
declare function px(value: number | string | undefined): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The CSS of a `radius` prop: one radius for all corners, or one radius for
|
|
36
|
+
* each corner.
|
|
37
|
+
*
|
|
38
|
+
* @param value - A radius token, a raw CSS value, or an object of corners.
|
|
39
|
+
*/
|
|
40
|
+
declare function radiusStyle(value: LayoutProps["radius"]): StyleMap;
|
|
41
|
+
/**
|
|
42
|
+
* A copy of `style` without the undefined entries, so a later spread never
|
|
43
|
+
* erases a value. An undefined longhand next to a shorthand is a removal:
|
|
44
|
+
* clearing `row-gap` resets the `gap` shorthand in real browsers.
|
|
45
|
+
*/
|
|
46
|
+
declare function defined(style: StyleMap): StyleMap;
|
|
47
|
+
/**
|
|
48
|
+
* The flex container CSS of the shared layout props (`align`, `gap`,
|
|
49
|
+
* `padding`, `radius`, sizes and the rest). An unset prop gives no CSS.
|
|
50
|
+
*
|
|
51
|
+
* @param props - The layout props of a container component.
|
|
52
|
+
*/
|
|
53
|
+
declare function layoutStyle(props: LayoutProps): StyleMap;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { ALIGN_CSS, FOCUS_RING, JUSTIFY_CSS, StyleMap, VISUALLY_HIDDEN, defined, jsonEqual, layoutStyle, lineClamp, px, radiusStyle };
|
|
56
|
+
//# sourceMappingURL=style-helpers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-helpers.d.mts","names":[],"sources":["../../../src/generative-ui/standard/style-helpers.ts"],"mappings":";;;;;KAaY,QAAA,GAAW,MAAA;AAAvB;;;;;AAAA,cAOa,SAAA,GAAa,CAAA,WAAY,CAAA;;cAIzB,eAAA,EAAiB,QAAA;;cAajB,UAAA;AAbb;;;;;AAAA,iBAoBgB,SAAA,CAAU,KAAA,WAAgB,QAAA;;cAU7B,SAAA,EAAW,MAAA,SAAe,KAAA;;cAS1B,WAAA,EAAa,MAAA,SAAe,OAAA;AAnBzC;;;;;AAUA;AAVA,iBAmCgB,EAAA,CAAG,KAAA;;;;AAhBnB;;;iBA2BgB,WAAA,CAAY,KAAA,EAAO,WAAA,aAAwB,QAAA;;AAX3D;;;;iBA6BgB,OAAA,CAAQ,KAAA,EAAO,QAAA,GAAW,QAAA;AAlB1C;;;;;;AAAA,iBA8CgB,WAAA,CAAY,KAAA,EAAO,WAAA,GAAc,QAAA"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { SHADOW_SM, backgroundColor, borderColor, radius, spacing } from "./tokens.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/generative-ui/standard/style-helpers.ts
|
|
4
|
+
/**
|
|
5
|
+
* Equal when the JSON is equal. Use it as the equality check of a computed
|
|
6
|
+
* value over agent data, so a new object with the same content does not
|
|
7
|
+
* trigger a redraw.
|
|
8
|
+
*/
|
|
9
|
+
const jsonEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
10
|
+
/** Hides an element on screen. Screen readers still read it. */
|
|
11
|
+
const VISUALLY_HIDDEN = {
|
|
12
|
+
position: "absolute",
|
|
13
|
+
width: "1px",
|
|
14
|
+
height: "1px",
|
|
15
|
+
padding: 0,
|
|
16
|
+
margin: "-1px",
|
|
17
|
+
overflow: "hidden",
|
|
18
|
+
clipPath: "inset(50%)",
|
|
19
|
+
whiteSpace: "nowrap",
|
|
20
|
+
border: 0
|
|
21
|
+
};
|
|
22
|
+
/** The outline of a focused control, for a `:focus-visible` rule. */
|
|
23
|
+
const FOCUS_RING = "2px solid var(--a2ui-color-focus, #0285ff)";
|
|
24
|
+
/**
|
|
25
|
+
* Cuts the text after `lines` lines, with an ellipsis.
|
|
26
|
+
*
|
|
27
|
+
* @param lines - The number of lines to show.
|
|
28
|
+
*/
|
|
29
|
+
function lineClamp(lines) {
|
|
30
|
+
return {
|
|
31
|
+
display: "-webkit-box",
|
|
32
|
+
WebkitLineClamp: lines,
|
|
33
|
+
WebkitBoxOrient: "vertical",
|
|
34
|
+
overflow: "hidden"
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** The `align-items` value of each `align` prop value. */
|
|
38
|
+
const ALIGN_CSS = {
|
|
39
|
+
start: "flex-start",
|
|
40
|
+
end: "flex-end",
|
|
41
|
+
center: "center",
|
|
42
|
+
baseline: "baseline",
|
|
43
|
+
stretch: "stretch"
|
|
44
|
+
};
|
|
45
|
+
/** The `justify-content` value of each `justify` prop value. */
|
|
46
|
+
const JUSTIFY_CSS = {
|
|
47
|
+
start: "flex-start",
|
|
48
|
+
end: "flex-end",
|
|
49
|
+
center: "center",
|
|
50
|
+
spaceBetween: "space-between",
|
|
51
|
+
spaceAround: "space-around",
|
|
52
|
+
spaceEvenly: "space-evenly",
|
|
53
|
+
stretch: "stretch"
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* A CSS length: pixels when `value` is a number, the raw CSS when it is a
|
|
57
|
+
* string, and `undefined` when it is not set.
|
|
58
|
+
*
|
|
59
|
+
* @example px(12) // "12px"
|
|
60
|
+
*/
|
|
61
|
+
function px(value) {
|
|
62
|
+
if (value === void 0) return void 0;
|
|
63
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The CSS of a `radius` prop: one radius for all corners, or one radius for
|
|
67
|
+
* each corner.
|
|
68
|
+
*
|
|
69
|
+
* @param value - A radius token, a raw CSS value, or an object of corners.
|
|
70
|
+
*/
|
|
71
|
+
function radiusStyle(value) {
|
|
72
|
+
if (typeof value === "string" || typeof value === "number") return { borderRadius: radius(value) };
|
|
73
|
+
if (value === void 0) return {};
|
|
74
|
+
return {
|
|
75
|
+
borderTopLeftRadius: radius(value.topLeft),
|
|
76
|
+
borderTopRightRadius: radius(value.topRight),
|
|
77
|
+
borderBottomLeftRadius: radius(value.bottomLeft),
|
|
78
|
+
borderBottomRightRadius: radius(value.bottomRight)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A copy of `style` without the undefined entries, so a later spread never
|
|
83
|
+
* erases a value. An undefined longhand next to a shorthand is a removal:
|
|
84
|
+
* clearing `row-gap` resets the `gap` shorthand in real browsers.
|
|
85
|
+
*/
|
|
86
|
+
function defined(style) {
|
|
87
|
+
const result = {};
|
|
88
|
+
for (const [key, value] of Object.entries(style)) if (value !== void 0) result[key] = value;
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The `gap` of the layout props, with `rowGap` and `columnGap` winning over
|
|
93
|
+
* it. A renderer can apply a style object in sorted key order (Angular does),
|
|
94
|
+
* so `columnGap` would come before the `gap` shorthand and lose to it. A
|
|
95
|
+
* longhand therefore sets both longhands and no shorthand.
|
|
96
|
+
*/
|
|
97
|
+
function gapStyle(props) {
|
|
98
|
+
const gap = spacing(props.gap) ?? (props.disableAutoSpacing ? 0 : void 0);
|
|
99
|
+
const rowGap = spacing(props.rowGap);
|
|
100
|
+
const columnGap = spacing(props.columnGap);
|
|
101
|
+
if (rowGap === void 0 && columnGap === void 0) return { gap };
|
|
102
|
+
return {
|
|
103
|
+
rowGap: rowGap ?? gap,
|
|
104
|
+
columnGap: columnGap ?? gap
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The flex container CSS of the shared layout props (`align`, `gap`,
|
|
109
|
+
* `padding`, `radius`, sizes and the rest). An unset prop gives no CSS.
|
|
110
|
+
*
|
|
111
|
+
* @param props - The layout props of a container component.
|
|
112
|
+
*/
|
|
113
|
+
function layoutStyle(props) {
|
|
114
|
+
const overflow = props.scrollable ? "auto" : props.clip ? "hidden" : void 0;
|
|
115
|
+
return defined({
|
|
116
|
+
display: props.inline ? "inline-flex" : "flex",
|
|
117
|
+
alignItems: props.align ? ALIGN_CSS[props.align] : void 0,
|
|
118
|
+
justifyContent: props.justify ? JUSTIFY_CSS[props.justify] : void 0,
|
|
119
|
+
flexWrap: props.wrap,
|
|
120
|
+
...gapStyle(props),
|
|
121
|
+
padding: props.flush ? 0 : spacing(props.padding),
|
|
122
|
+
background: backgroundColor(props.background),
|
|
123
|
+
border: props.border ? `1px solid ${borderColor(props.borderColor ?? "default")}` : void 0,
|
|
124
|
+
...radiusStyle(props.radius),
|
|
125
|
+
width: spacing(props.width),
|
|
126
|
+
height: spacing(props.height),
|
|
127
|
+
minWidth: spacing(props.minWidth ?? props.minSize) ?? 0,
|
|
128
|
+
maxWidth: spacing(props.maxWidth ?? props.maxSize) ?? "100%",
|
|
129
|
+
minHeight: spacing(props.minHeight ?? props.minSize),
|
|
130
|
+
maxHeight: spacing(props.maxHeight ?? props.maxSize),
|
|
131
|
+
flex: props.flex,
|
|
132
|
+
flexGrow: props.weight,
|
|
133
|
+
aspectRatio: props.aspectRatio,
|
|
134
|
+
overflow,
|
|
135
|
+
boxShadow: props.shadow ? SHADOW_SM : void 0,
|
|
136
|
+
boxSizing: "border-box"
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//#endregion
|
|
141
|
+
export { ALIGN_CSS, FOCUS_RING, JUSTIFY_CSS, VISUALLY_HIDDEN, defined, jsonEqual, layoutStyle, lineClamp, px, radiusStyle };
|
|
142
|
+
//# sourceMappingURL=style-helpers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-helpers.mjs","names":[],"sources":["../../../src/generative-ui/standard/style-helpers.ts"],"sourcesContent":["// Framework-free style helpers of the standard components. Each framework\n// binds the returned style objects to its own elements.\nimport {\n SHADOW_SM,\n backgroundColor,\n borderColor,\n radius,\n spacing,\n} from \"./tokens\";\nimport type { ALIGN, JUSTIFY } from \"./tokens\";\nimport type { LayoutProps } from \"./layout\";\n\n/** An inline style object, with camelCase CSS properties as keys. */\nexport type StyleMap = Record<string, string | number | undefined>;\n\n/**\n * Equal when the JSON is equal. Use it as the equality check of a computed\n * value over agent data, so a new object with the same content does not\n * trigger a redraw.\n */\nexport const jsonEqual = (a: unknown, b: unknown) =>\n JSON.stringify(a) === JSON.stringify(b);\n\n/** Hides an element on screen. Screen readers still read it. */\nexport const VISUALLY_HIDDEN: StyleMap = {\n position: \"absolute\",\n width: \"1px\",\n height: \"1px\",\n padding: 0,\n margin: \"-1px\",\n overflow: \"hidden\",\n clipPath: \"inset(50%)\",\n whiteSpace: \"nowrap\",\n border: 0,\n};\n\n/** The outline of a focused control, for a `:focus-visible` rule. */\nexport const FOCUS_RING = \"2px solid var(--a2ui-color-focus, #0285ff)\";\n\n/**\n * Cuts the text after `lines` lines, with an ellipsis.\n *\n * @param lines - The number of lines to show.\n */\nexport function lineClamp(lines: number): StyleMap {\n return {\n display: \"-webkit-box\",\n WebkitLineClamp: lines,\n WebkitBoxOrient: \"vertical\",\n overflow: \"hidden\",\n };\n}\n\n/** The `align-items` value of each `align` prop value. */\nexport const ALIGN_CSS: Record<(typeof ALIGN)[number], string> = {\n start: \"flex-start\",\n end: \"flex-end\",\n center: \"center\",\n baseline: \"baseline\",\n stretch: \"stretch\",\n};\n\n/** The `justify-content` value of each `justify` prop value. */\nexport const JUSTIFY_CSS: Record<(typeof JUSTIFY)[number], string> = {\n start: \"flex-start\",\n end: \"flex-end\",\n center: \"center\",\n spaceBetween: \"space-between\",\n spaceAround: \"space-around\",\n spaceEvenly: \"space-evenly\",\n stretch: \"stretch\",\n};\n\n/**\n * A CSS length: pixels when `value` is a number, the raw CSS when it is a\n * string, and `undefined` when it is not set.\n *\n * @example px(12) // \"12px\"\n */\nexport function px(value: number | string | undefined) {\n if (value === undefined) return undefined;\n return typeof value === \"number\" ? `${value}px` : value;\n}\n\n/**\n * The CSS of a `radius` prop: one radius for all corners, or one radius for\n * each corner.\n *\n * @param value - A radius token, a raw CSS value, or an object of corners.\n */\nexport function radiusStyle(value: LayoutProps[\"radius\"]): StyleMap {\n if (typeof value === \"string\" || typeof value === \"number\") {\n return { borderRadius: radius(value) };\n }\n if (value === undefined) return {};\n return {\n borderTopLeftRadius: radius(value.topLeft),\n borderTopRightRadius: radius(value.topRight),\n borderBottomLeftRadius: radius(value.bottomLeft),\n borderBottomRightRadius: radius(value.bottomRight),\n };\n}\n\n/**\n * A copy of `style` without the undefined entries, so a later spread never\n * erases a value. An undefined longhand next to a shorthand is a removal:\n * clearing `row-gap` resets the `gap` shorthand in real browsers.\n */\nexport function defined(style: StyleMap): StyleMap {\n const result: StyleMap = {};\n for (const [key, value] of Object.entries(style)) {\n if (value !== undefined) result[key] = value;\n }\n return result;\n}\n\n/**\n * The `gap` of the layout props, with `rowGap` and `columnGap` winning over\n * it. A renderer can apply a style object in sorted key order (Angular does),\n * so `columnGap` would come before the `gap` shorthand and lose to it. A\n * longhand therefore sets both longhands and no shorthand.\n */\nfunction gapStyle(props: LayoutProps): StyleMap {\n const gap = spacing(props.gap) ?? (props.disableAutoSpacing ? 0 : undefined);\n const rowGap = spacing(props.rowGap);\n const columnGap = spacing(props.columnGap);\n if (rowGap === undefined && columnGap === undefined) return { gap };\n return { rowGap: rowGap ?? gap, columnGap: columnGap ?? gap };\n}\n\n/**\n * The flex container CSS of the shared layout props (`align`, `gap`,\n * `padding`, `radius`, sizes and the rest). An unset prop gives no CSS.\n *\n * @param props - The layout props of a container component.\n */\nexport function layoutStyle(props: LayoutProps): StyleMap {\n const overflow = props.scrollable\n ? \"auto\"\n : props.clip\n ? \"hidden\"\n : undefined;\n return defined({\n display: props.inline ? \"inline-flex\" : \"flex\",\n alignItems: props.align ? ALIGN_CSS[props.align] : undefined,\n justifyContent: props.justify ? JUSTIFY_CSS[props.justify] : undefined,\n flexWrap: props.wrap,\n ...gapStyle(props),\n padding: props.flush ? 0 : spacing(props.padding),\n background: backgroundColor(props.background),\n border: props.border\n ? `1px solid ${borderColor(props.borderColor ?? \"default\")}`\n : undefined,\n ...radiusStyle(props.radius),\n width: spacing(props.width),\n height: spacing(props.height),\n // A container can shrink below its content and never gets wider than\n // its parent.\n minWidth: spacing(props.minWidth ?? props.minSize) ?? 0,\n maxWidth: spacing(props.maxWidth ?? props.maxSize) ?? \"100%\",\n minHeight: spacing(props.minHeight ?? props.minSize),\n maxHeight: spacing(props.maxHeight ?? props.maxSize),\n flex: props.flex,\n flexGrow: props.weight,\n aspectRatio: props.aspectRatio,\n overflow,\n boxShadow: props.shadow ? SHADOW_SM : undefined,\n boxSizing: \"border-box\",\n });\n}\n"],"mappings":";;;;;;;;AAoBA,MAAa,aAAa,GAAY,MACpC,KAAK,UAAU,EAAE,KAAK,KAAK,UAAU,EAAE;;AAGzC,MAAa,kBAA4B;CACvC,UAAU;CACV,OAAO;CACP,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,YAAY;CACZ,QAAQ;CACT;;AAGD,MAAa,aAAa;;;;;;AAO1B,SAAgB,UAAU,OAAyB;AACjD,QAAO;EACL,SAAS;EACT,iBAAiB;EACjB,iBAAiB;EACjB,UAAU;EACX;;;AAIH,MAAa,YAAoD;CAC/D,OAAO;CACP,KAAK;CACL,QAAQ;CACR,UAAU;CACV,SAAS;CACV;;AAGD,MAAa,cAAwD;CACnE,OAAO;CACP,KAAK;CACL,QAAQ;CACR,cAAc;CACd,aAAa;CACb,aAAa;CACb,SAAS;CACV;;;;;;;AAQD,SAAgB,GAAG,OAAoC;AACrD,KAAI,UAAU,OAAW,QAAO;AAChC,QAAO,OAAO,UAAU,WAAW,GAAG,MAAM,MAAM;;;;;;;;AASpD,SAAgB,YAAY,OAAwC;AAClE,KAAI,OAAO,UAAU,YAAY,OAAO,UAAU,SAChD,QAAO,EAAE,cAAc,OAAO,MAAM,EAAE;AAExC,KAAI,UAAU,OAAW,QAAO,EAAE;AAClC,QAAO;EACL,qBAAqB,OAAO,MAAM,QAAQ;EAC1C,sBAAsB,OAAO,MAAM,SAAS;EAC5C,wBAAwB,OAAO,MAAM,WAAW;EAChD,yBAAyB,OAAO,MAAM,YAAY;EACnD;;;;;;;AAQH,SAAgB,QAAQ,OAA2B;CACjD,MAAM,SAAmB,EAAE;AAC3B,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC9C,KAAI,UAAU,OAAW,QAAO,OAAO;AAEzC,QAAO;;;;;;;;AAST,SAAS,SAAS,OAA8B;CAC9C,MAAM,MAAM,QAAQ,MAAM,IAAI,KAAK,MAAM,qBAAqB,IAAI;CAClE,MAAM,SAAS,QAAQ,MAAM,OAAO;CACpC,MAAM,YAAY,QAAQ,MAAM,UAAU;AAC1C,KAAI,WAAW,UAAa,cAAc,OAAW,QAAO,EAAE,KAAK;AACnE,QAAO;EAAE,QAAQ,UAAU;EAAK,WAAW,aAAa;EAAK;;;;;;;;AAS/D,SAAgB,YAAY,OAA8B;CACxD,MAAM,WAAW,MAAM,aACnB,SACA,MAAM,OACJ,WACA;AACN,QAAO,QAAQ;EACb,SAAS,MAAM,SAAS,gBAAgB;EACxC,YAAY,MAAM,QAAQ,UAAU,MAAM,SAAS;EACnD,gBAAgB,MAAM,UAAU,YAAY,MAAM,WAAW;EAC7D,UAAU,MAAM;EAChB,GAAG,SAAS,MAAM;EAClB,SAAS,MAAM,QAAQ,IAAI,QAAQ,MAAM,QAAQ;EACjD,YAAY,gBAAgB,MAAM,WAAW;EAC7C,QAAQ,MAAM,SACV,aAAa,YAAY,MAAM,eAAe,UAAU,KACxD;EACJ,GAAG,YAAY,MAAM,OAAO;EAC5B,OAAO,QAAQ,MAAM,MAAM;EAC3B,QAAQ,QAAQ,MAAM,OAAO;EAG7B,UAAU,QAAQ,MAAM,YAAY,MAAM,QAAQ,IAAI;EACtD,UAAU,QAAQ,MAAM,YAAY,MAAM,QAAQ,IAAI;EACtD,WAAW,QAAQ,MAAM,aAAa,MAAM,QAAQ;EACpD,WAAW,QAAQ,MAAM,aAAa,MAAM,QAAQ;EACpD,MAAM,MAAM;EACZ,UAAU,MAAM;EAChB,aAAa,MAAM;EACnB;EACA,WAAW,MAAM,SAAS,YAAY;EACtC,WAAW;EACZ,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const require_tokens = require('./tokens.cjs');
|
|
2
|
+
const require_theme = require('./theme.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/generative-ui/standard/styles.ts
|
|
5
|
+
/**
|
|
6
|
+
* The stylesheet for what inline styles cannot do: pseudo-elements (slider
|
|
7
|
+
* track and thumb, placeholder), `:checked` and `:first-child` states,
|
|
8
|
+
* heading fallbacks, and resets for host prose styles. It is added once per
|
|
9
|
+
* document.
|
|
10
|
+
*
|
|
11
|
+
* Typography is inherited: a surface takes the font, size, line height and
|
|
12
|
+
* color of the text around it (the chat prose). Headings take the heading
|
|
13
|
+
* styles of the host.
|
|
14
|
+
*/
|
|
15
|
+
const STANDARD_STYLE_ID = "a2ui-standard-catalog";
|
|
16
|
+
const ACCENT = "var(--a2ui-color-accent, #0d0d0d)";
|
|
17
|
+
const FOCUS_RING = "2px solid var(--a2ui-color-focus, #0285ff)";
|
|
18
|
+
const CHECK_SVG = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E\")";
|
|
19
|
+
const SLIDER_TRACK = "var(--a2ui-color-slider-track, rgba(0, 0, 0, 0.04))";
|
|
20
|
+
const THUMB = `width:20px;height:20px;box-sizing:border-box;border-radius:9999px;background:${require_tokens.CONTROL_BG};border:1px solid ${require_tokens.borderColor("default")};box-shadow:${require_tokens.SHADOW_XS};cursor:pointer`;
|
|
21
|
+
const STANDARD_CSS = [
|
|
22
|
+
require_theme.DARK_THEME_CSS,
|
|
23
|
+
".a2ui-surface{min-width:0;max-width:100%;box-sizing:border-box}",
|
|
24
|
+
".a2ui-surface{font:inherit;color:inherit}",
|
|
25
|
+
":where(.a2ui-surface) :where(h2){font-size:1.5em;font-weight:600;line-height:1.3}",
|
|
26
|
+
":where(.a2ui-surface) :where(h3){font-size:1.25em;font-weight:600;line-height:1.3}",
|
|
27
|
+
":where(.a2ui-surface) :where(h4){font-size:1em;font-weight:600;line-height:1.4}",
|
|
28
|
+
"[data-a2ui-std] :is(button,input,select,textarea),[data-a2ui-input]{font:inherit;color:inherit}",
|
|
29
|
+
"[data-a2ui-row=\"spaceBetween\"]>[data-a2ui-text]:last-child:not(:first-child){text-align:right;margin-inline-start:auto}",
|
|
30
|
+
`[data-a2ui-input]:focus-visible{outline:${FOCUS_RING};outline-offset:1px}`,
|
|
31
|
+
`[data-a2ui-scroll]:focus-visible{outline:${FOCUS_RING};outline-offset:2px}`,
|
|
32
|
+
`[data-a2ui-input]::placeholder{color:${require_tokens.textColor("tertiary")};opacity:1}`,
|
|
33
|
+
`.a2ui-std-range{-webkit-appearance:none;appearance:none;display:block;width:100%;height:24px;margin:0;padding:0 2px;box-sizing:border-box;border-radius:9999px;background:${SLIDER_TRACK};cursor:pointer}`,
|
|
34
|
+
".a2ui-std-range:disabled{cursor:not-allowed;opacity:.5}",
|
|
35
|
+
".a2ui-std-range::-webkit-slider-runnable-track{height:24px;background:transparent;border:0}",
|
|
36
|
+
`.a2ui-std-range::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;margin-top:2px;${THUMB}}`,
|
|
37
|
+
".a2ui-std-range::-moz-range-track{height:24px;background:transparent;border:0}",
|
|
38
|
+
`.a2ui-std-range::-moz-range-thumb{${THUMB}}`,
|
|
39
|
+
`.a2ui-std-check{-webkit-appearance:none;appearance:none;flex-shrink:0;width:20px;height:20px;margin:0;box-sizing:border-box;border:1px solid ${require_tokens.borderColor("strong")};border-radius:9999px;background:${require_tokens.CONTROL_BG} center/14px 14px no-repeat;cursor:pointer}`,
|
|
40
|
+
".a2ui-std-check[data-shape=\"square\"]{border-radius:6px}",
|
|
41
|
+
`.a2ui-std-check:checked{background-color:${ACCENT};border-color:${ACCENT};background-image:${CHECK_SVG}}`,
|
|
42
|
+
`.a2ui-std-check[type="radio"]:checked{background-image:none;background-color:${require_tokens.CONTROL_BG};border:6px solid ${ACCENT}}`,
|
|
43
|
+
".a2ui-std-check:disabled{cursor:not-allowed}",
|
|
44
|
+
".a2ui-surface :is(h1,h2,h3,h4,h5,h6):not(.a2ui-markdown *){margin:var(--a2ui-heading-margin,0)}",
|
|
45
|
+
".a2ui-surface :is(p,table,figure,figcaption,blockquote,pre):not(.a2ui-markdown *){margin:var(--a2ui-block-margin,0)}",
|
|
46
|
+
".a2ui-markdown>:first-child{margin-top:0}",
|
|
47
|
+
".a2ui-markdown>:last-child{margin-bottom:0}",
|
|
48
|
+
".a2ui-surface :is(.a2ui-std-list,.a2ui-std-list>li){margin:0}",
|
|
49
|
+
".a2ui-surface .a2ui-std-table{font-size:inherit;line-height:inherit}",
|
|
50
|
+
".a2ui-std-table-wrap{width:100%;max-width:100%;min-width:0;overflow-x:auto}",
|
|
51
|
+
".a2ui-std-cell{padding:8px}",
|
|
52
|
+
".a2ui-std-cell:first-child{padding-inline-start:0}",
|
|
53
|
+
".a2ui-std-cell:last-child{padding-inline-end:0}",
|
|
54
|
+
`.a2ui-std-cell[data-divider]{border-bottom:1px solid ${require_tokens.borderColor("subtle")}}`,
|
|
55
|
+
".a2ui-std-table>tbody:last-child>tr:last-child>.a2ui-std-cell{border-bottom:0}"
|
|
56
|
+
].join("\n");
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
exports.ACCENT = ACCENT;
|
|
60
|
+
exports.STANDARD_CSS = STANDARD_CSS;
|
|
61
|
+
exports.STANDARD_STYLE_ID = STANDARD_STYLE_ID;
|
|
62
|
+
//# sourceMappingURL=styles.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.cjs","names":["CONTROL_BG","borderColor","SHADOW_XS","DARK_THEME_CSS","textColor"],"sources":["../../../src/generative-ui/standard/styles.ts"],"sourcesContent":["import { DARK_THEME_CSS } from \"./theme\";\nimport { borderColor, textColor, CONTROL_BG, SHADOW_XS } from \"./tokens\";\n\n/**\n * The stylesheet for what inline styles cannot do: pseudo-elements (slider\n * track and thumb, placeholder), `:checked` and `:first-child` states,\n * heading fallbacks, and resets for host prose styles. It is added once per\n * document.\n *\n * Typography is inherited: a surface takes the font, size, line height and\n * color of the text around it (the chat prose). Headings take the heading\n * styles of the host.\n */\n\nexport const STANDARD_STYLE_ID = \"a2ui-standard-catalog\";\nexport const ACCENT = \"var(--a2ui-color-accent, #0d0d0d)\";\n\nconst FOCUS_RING = \"2px solid var(--a2ui-color-focus, #0285ff)\";\n\nconst CHECK_SVG =\n \"url(\\\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E\\\")\";\n\nconst SLIDER_TRACK = \"var(--a2ui-color-slider-track, rgba(0, 0, 0, 0.04))\";\nconst THUMB = `width:20px;height:20px;box-sizing:border-box;border-radius:9999px;background:${CONTROL_BG};border:1px solid ${borderColor(\"default\")};box-shadow:${SHADOW_XS};cursor:pointer`;\n\nexport const STANDARD_CSS = [\n // The built-in dark values, under a `.dark` class. Every theme rule wins\n // over them.\n DARK_THEME_CSS,\n // The surface (and its root component) never gets wider than the chat column.\n \".a2ui-surface{min-width:0;max-width:100%;box-sizing:border-box}\",\n // The surface inherits the font, size, line height and ink of the host.\n \".a2ui-surface{font:inherit;color:inherit}\",\n // Heading sizes only for hosts without heading styles (zero specificity).\n \":where(.a2ui-surface) :where(h2){font-size:1.5em;font-weight:600;line-height:1.3}\",\n \":where(.a2ui-surface) :where(h3){font-size:1.25em;font-weight:600;line-height:1.3}\",\n \":where(.a2ui-surface) :where(h4){font-size:1em;font-weight:600;line-height:1.4}\",\n // Controls never fall back to the UA font.\n \"[data-a2ui-std] :is(button,input,select,textarea),[data-a2ui-input]{font:inherit;color:inherit}\",\n // Key/value rows: the last text of a space-between row sits flush right.\n '[data-a2ui-row=\"spaceBetween\"]>[data-a2ui-text]:last-child:not(:first-child){text-align:right;margin-inline-start:auto}',\n `[data-a2ui-input]:focus-visible{outline:${FOCUS_RING};outline-offset:1px}`,\n // A scrollable container can take keyboard focus, so it shows a focus ring.\n `[data-a2ui-scroll]:focus-visible{outline:${FOCUS_RING};outline-offset:2px}`,\n `[data-a2ui-input]::placeholder{color:${textColor(\"tertiary\")};opacity:1}`,\n // Slider: 24px pill track, 2px inset white thumb (no filled range).\n `.a2ui-std-range{-webkit-appearance:none;appearance:none;display:block;width:100%;height:24px;margin:0;padding:0 2px;box-sizing:border-box;border-radius:9999px;background:${SLIDER_TRACK};cursor:pointer}`,\n \".a2ui-std-range:disabled{cursor:not-allowed;opacity:.5}\",\n \".a2ui-std-range::-webkit-slider-runnable-track{height:24px;background:transparent;border:0}\",\n `.a2ui-std-range::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;margin-top:2px;${THUMB}}`,\n \".a2ui-std-range::-moz-range-track{height:24px;background:transparent;border:0}\",\n `.a2ui-std-range::-moz-range-thumb{${THUMB}}`,\n // Checkbox and radio: 20px round control, filled when checked.\n `.a2ui-std-check{-webkit-appearance:none;appearance:none;flex-shrink:0;width:20px;height:20px;margin:0;box-sizing:border-box;border:1px solid ${borderColor(\"strong\")};border-radius:9999px;background:${CONTROL_BG} center/14px 14px no-repeat;cursor:pointer}`,\n '.a2ui-std-check[data-shape=\"square\"]{border-radius:6px}',\n `.a2ui-std-check:checked{background-color:${ACCENT};border-color:${ACCENT};background-image:${CHECK_SVG}}`,\n `.a2ui-std-check[type=\"radio\"]:checked{background-image:none;background-color:${CONTROL_BG};border:6px solid ${ACCENT}}`,\n \".a2ui-std-check:disabled{cursor:not-allowed}\",\n // Hosts often wrap chat markdown in a \"prose\" stylesheet (Tailwind\n // typography) that adds margins to headings, paragraphs, lists and tables.\n // A surface is an app panel spaced by gaps, so these rules remove those\n // margins. A Markdown component keeps them, because it reads like the chat\n // prose. The selector must be stronger than `.prose :where(h2)`. Hosts\n // change the margins with `--a2ui-heading-margin` and `--a2ui-block-margin`.\n \".a2ui-surface :is(h1,h2,h3,h4,h5,h6):not(.a2ui-markdown *){margin:var(--a2ui-heading-margin,0)}\",\n \".a2ui-surface :is(p,table,figure,figcaption,blockquote,pre):not(.a2ui-markdown *){margin:var(--a2ui-block-margin,0)}\",\n \".a2ui-markdown>:first-child{margin-top:0}\",\n \".a2ui-markdown>:last-child{margin-bottom:0}\",\n // Only the List component removes native bullets. Markdown keeps them.\n \".a2ui-surface :is(.a2ui-std-list,.a2ui-std-list>li){margin:0}\",\n \".a2ui-surface .a2ui-std-table{font-size:inherit;line-height:inherit}\",\n // Table: 8px cells, flush outer edges, hairline row dividers, no outer border.\n \".a2ui-std-table-wrap{width:100%;max-width:100%;min-width:0;overflow-x:auto}\",\n \".a2ui-std-cell{padding:8px}\",\n \".a2ui-std-cell:first-child{padding-inline-start:0}\",\n \".a2ui-std-cell:last-child{padding-inline-end:0}\",\n `.a2ui-std-cell[data-divider]{border-bottom:1px solid ${borderColor(\"subtle\")}}`,\n \".a2ui-std-table>tbody:last-child>tr:last-child>.a2ui-std-cell{border-bottom:0}\",\n].join(\"\\n\");\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,oBAAoB;AACjC,MAAa,SAAS;AAEtB,MAAM,aAAa;AAEnB,MAAM,YACJ;AAEF,MAAM,eAAe;AACrB,MAAM,QAAQ,gFAAgFA,0BAAW,oBAAoBC,2BAAY,UAAU,CAAC,cAAcC,yBAAU;AAE5K,MAAa,eAAe;CAG1BC;CAEA;CAEA;CAEA;CACA;CACA;CAEA;CAEA;CACA,2CAA2C,WAAW;CAEtD,4CAA4C,WAAW;CACvD,wCAAwCC,yBAAU,WAAW,CAAC;CAE9D,6KAA6K,aAAa;CAC1L;CACA;CACA,gGAAgG,MAAM;CACtG;CACA,qCAAqC,MAAM;CAE3C,gJAAgJH,2BAAY,SAAS,CAAC,mCAAmCD,0BAAW;CACpN;CACA,4CAA4C,OAAO,gBAAgB,OAAO,oBAAoB,UAAU;CACxG,gFAAgFA,0BAAW,oBAAoB,OAAO;CACtH;CAOA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CACA,wDAAwDC,2BAAY,SAAS,CAAC;CAC9E;CACD,CAAC,KAAK,KAAK"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/generative-ui/standard/styles.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The stylesheet for what inline styles cannot do: pseudo-elements (slider
|
|
4
|
+
* track and thumb, placeholder), `:checked` and `:first-child` states,
|
|
5
|
+
* heading fallbacks, and resets for host prose styles. It is added once per
|
|
6
|
+
* document.
|
|
7
|
+
*
|
|
8
|
+
* Typography is inherited: a surface takes the font, size, line height and
|
|
9
|
+
* color of the text around it (the chat prose). Headings take the heading
|
|
10
|
+
* styles of the host.
|
|
11
|
+
*/
|
|
12
|
+
declare const STANDARD_STYLE_ID = "a2ui-standard-catalog";
|
|
13
|
+
declare const ACCENT = "var(--a2ui-color-accent, #0d0d0d)";
|
|
14
|
+
declare const STANDARD_CSS: string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { ACCENT, STANDARD_CSS, STANDARD_STYLE_ID };
|
|
17
|
+
//# sourceMappingURL=styles.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.cts","names":[],"sources":["../../../src/generative-ui/standard/styles.ts"],"mappings":";;AAcA;;;;;AACA;;;;cADa,iBAAA;AAAA,cACA,MAAA;AAAA,cAUA,YAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/generative-ui/standard/styles.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The stylesheet for what inline styles cannot do: pseudo-elements (slider
|
|
4
|
+
* track and thumb, placeholder), `:checked` and `:first-child` states,
|
|
5
|
+
* heading fallbacks, and resets for host prose styles. It is added once per
|
|
6
|
+
* document.
|
|
7
|
+
*
|
|
8
|
+
* Typography is inherited: a surface takes the font, size, line height and
|
|
9
|
+
* color of the text around it (the chat prose). Headings take the heading
|
|
10
|
+
* styles of the host.
|
|
11
|
+
*/
|
|
12
|
+
declare const STANDARD_STYLE_ID = "a2ui-standard-catalog";
|
|
13
|
+
declare const ACCENT = "var(--a2ui-color-accent, #0d0d0d)";
|
|
14
|
+
declare const STANDARD_CSS: string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { ACCENT, STANDARD_CSS, STANDARD_STYLE_ID };
|
|
17
|
+
//# sourceMappingURL=styles.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.mts","names":[],"sources":["../../../src/generative-ui/standard/styles.ts"],"mappings":";;AAcA;;;;;AACA;;;;cADa,iBAAA;AAAA,cACA,MAAA;AAAA,cAUA,YAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CONTROL_BG, SHADOW_XS, borderColor, textColor } from "./tokens.mjs";
|
|
2
|
+
import { DARK_THEME_CSS } from "./theme.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/generative-ui/standard/styles.ts
|
|
5
|
+
/**
|
|
6
|
+
* The stylesheet for what inline styles cannot do: pseudo-elements (slider
|
|
7
|
+
* track and thumb, placeholder), `:checked` and `:first-child` states,
|
|
8
|
+
* heading fallbacks, and resets for host prose styles. It is added once per
|
|
9
|
+
* document.
|
|
10
|
+
*
|
|
11
|
+
* Typography is inherited: a surface takes the font, size, line height and
|
|
12
|
+
* color of the text around it (the chat prose). Headings take the heading
|
|
13
|
+
* styles of the host.
|
|
14
|
+
*/
|
|
15
|
+
const STANDARD_STYLE_ID = "a2ui-standard-catalog";
|
|
16
|
+
const ACCENT = "var(--a2ui-color-accent, #0d0d0d)";
|
|
17
|
+
const FOCUS_RING = "2px solid var(--a2ui-color-focus, #0285ff)";
|
|
18
|
+
const CHECK_SVG = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E\")";
|
|
19
|
+
const SLIDER_TRACK = "var(--a2ui-color-slider-track, rgba(0, 0, 0, 0.04))";
|
|
20
|
+
const THUMB = `width:20px;height:20px;box-sizing:border-box;border-radius:9999px;background:${CONTROL_BG};border:1px solid ${borderColor("default")};box-shadow:${SHADOW_XS};cursor:pointer`;
|
|
21
|
+
const STANDARD_CSS = [
|
|
22
|
+
DARK_THEME_CSS,
|
|
23
|
+
".a2ui-surface{min-width:0;max-width:100%;box-sizing:border-box}",
|
|
24
|
+
".a2ui-surface{font:inherit;color:inherit}",
|
|
25
|
+
":where(.a2ui-surface) :where(h2){font-size:1.5em;font-weight:600;line-height:1.3}",
|
|
26
|
+
":where(.a2ui-surface) :where(h3){font-size:1.25em;font-weight:600;line-height:1.3}",
|
|
27
|
+
":where(.a2ui-surface) :where(h4){font-size:1em;font-weight:600;line-height:1.4}",
|
|
28
|
+
"[data-a2ui-std] :is(button,input,select,textarea),[data-a2ui-input]{font:inherit;color:inherit}",
|
|
29
|
+
"[data-a2ui-row=\"spaceBetween\"]>[data-a2ui-text]:last-child:not(:first-child){text-align:right;margin-inline-start:auto}",
|
|
30
|
+
`[data-a2ui-input]:focus-visible{outline:${FOCUS_RING};outline-offset:1px}`,
|
|
31
|
+
`[data-a2ui-scroll]:focus-visible{outline:${FOCUS_RING};outline-offset:2px}`,
|
|
32
|
+
`[data-a2ui-input]::placeholder{color:${textColor("tertiary")};opacity:1}`,
|
|
33
|
+
`.a2ui-std-range{-webkit-appearance:none;appearance:none;display:block;width:100%;height:24px;margin:0;padding:0 2px;box-sizing:border-box;border-radius:9999px;background:${SLIDER_TRACK};cursor:pointer}`,
|
|
34
|
+
".a2ui-std-range:disabled{cursor:not-allowed;opacity:.5}",
|
|
35
|
+
".a2ui-std-range::-webkit-slider-runnable-track{height:24px;background:transparent;border:0}",
|
|
36
|
+
`.a2ui-std-range::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;margin-top:2px;${THUMB}}`,
|
|
37
|
+
".a2ui-std-range::-moz-range-track{height:24px;background:transparent;border:0}",
|
|
38
|
+
`.a2ui-std-range::-moz-range-thumb{${THUMB}}`,
|
|
39
|
+
`.a2ui-std-check{-webkit-appearance:none;appearance:none;flex-shrink:0;width:20px;height:20px;margin:0;box-sizing:border-box;border:1px solid ${borderColor("strong")};border-radius:9999px;background:${CONTROL_BG} center/14px 14px no-repeat;cursor:pointer}`,
|
|
40
|
+
".a2ui-std-check[data-shape=\"square\"]{border-radius:6px}",
|
|
41
|
+
`.a2ui-std-check:checked{background-color:${ACCENT};border-color:${ACCENT};background-image:${CHECK_SVG}}`,
|
|
42
|
+
`.a2ui-std-check[type="radio"]:checked{background-image:none;background-color:${CONTROL_BG};border:6px solid ${ACCENT}}`,
|
|
43
|
+
".a2ui-std-check:disabled{cursor:not-allowed}",
|
|
44
|
+
".a2ui-surface :is(h1,h2,h3,h4,h5,h6):not(.a2ui-markdown *){margin:var(--a2ui-heading-margin,0)}",
|
|
45
|
+
".a2ui-surface :is(p,table,figure,figcaption,blockquote,pre):not(.a2ui-markdown *){margin:var(--a2ui-block-margin,0)}",
|
|
46
|
+
".a2ui-markdown>:first-child{margin-top:0}",
|
|
47
|
+
".a2ui-markdown>:last-child{margin-bottom:0}",
|
|
48
|
+
".a2ui-surface :is(.a2ui-std-list,.a2ui-std-list>li){margin:0}",
|
|
49
|
+
".a2ui-surface .a2ui-std-table{font-size:inherit;line-height:inherit}",
|
|
50
|
+
".a2ui-std-table-wrap{width:100%;max-width:100%;min-width:0;overflow-x:auto}",
|
|
51
|
+
".a2ui-std-cell{padding:8px}",
|
|
52
|
+
".a2ui-std-cell:first-child{padding-inline-start:0}",
|
|
53
|
+
".a2ui-std-cell:last-child{padding-inline-end:0}",
|
|
54
|
+
`.a2ui-std-cell[data-divider]{border-bottom:1px solid ${borderColor("subtle")}}`,
|
|
55
|
+
".a2ui-std-table>tbody:last-child>tr:last-child>.a2ui-std-cell{border-bottom:0}"
|
|
56
|
+
].join("\n");
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
export { ACCENT, STANDARD_CSS, STANDARD_STYLE_ID };
|
|
60
|
+
//# sourceMappingURL=styles.mjs.map
|