@accelint/design-system 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -7
- package/dist/chunk-PZ5AY32C.js +9 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/components/aria/aria.d.ts +32 -0
- package/dist/components/aria/aria.js +39 -0
- package/dist/components/aria/aria.js.map +1 -0
- package/dist/components/aria/index.d.ts +3 -0
- package/dist/components/aria/index.js +4 -0
- package/dist/components/aria/index.js.map +1 -0
- package/dist/components/button/button.css.d.ts +41 -0
- package/dist/components/button/button.css.js +12 -0
- package/dist/components/button/button.css.js.map +1 -0
- package/dist/components/button/button.d.ts +47 -0
- package/dist/components/button/button.js +104 -0
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/button/index.d.ts +8 -0
- package/dist/components/button/index.js +6 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/button/types.d.ts +32 -0
- package/dist/components/button/types.js +3 -0
- package/dist/components/button/types.js.map +1 -0
- package/dist/components/checkbox/checkbox.css.d.ts +44 -0
- package/dist/components/checkbox/checkbox.css.js +14 -0
- package/dist/components/checkbox/checkbox.css.js.map +1 -0
- package/dist/components/checkbox/checkbox.d.ts +30 -0
- package/dist/components/checkbox/checkbox.js +123 -0
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/checkbox/index.d.ts +9 -0
- package/dist/components/checkbox/index.js +6 -0
- package/dist/components/checkbox/index.js.map +1 -0
- package/dist/components/checkbox/types.d.ts +41 -0
- package/dist/components/checkbox/types.js +3 -0
- package/dist/components/checkbox/types.js.map +1 -0
- package/dist/components/chip/chip.css.d.ts +41 -0
- package/dist/components/chip/chip.css.js +12 -0
- package/dist/components/chip/chip.css.js.map +1 -0
- package/dist/components/chip/chip.d.ts +41 -0
- package/dist/components/chip/chip.js +171 -0
- package/dist/components/chip/chip.js.map +1 -0
- package/dist/components/chip/index.d.ts +11 -0
- package/dist/components/chip/index.js +6 -0
- package/dist/components/chip/index.js.map +1 -0
- package/dist/components/chip/types.d.ts +37 -0
- package/dist/components/chip/types.js +3 -0
- package/dist/components/chip/types.js.map +1 -0
- package/dist/components/collection/collection.d.ts +17 -0
- package/dist/components/collection/collection.js +22 -0
- package/dist/components/collection/collection.js.map +1 -0
- package/dist/components/collection/index.d.ts +6 -0
- package/dist/components/collection/index.js +4 -0
- package/dist/components/collection/index.js.map +1 -0
- package/dist/components/combo-box/combo-box.css.d.ts +35 -0
- package/dist/components/combo-box/combo-box.css.js +12 -0
- package/dist/components/combo-box/combo-box.css.js.map +1 -0
- package/dist/components/combo-box/combo-box.d.ts +21 -0
- package/dist/components/combo-box/combo-box.js +116 -0
- package/dist/components/combo-box/combo-box.js.map +1 -0
- package/dist/components/combo-box/index.d.ts +13 -0
- package/dist/components/combo-box/index.js +6 -0
- package/dist/components/combo-box/index.js.map +1 -0
- package/dist/components/combo-box/types.d.ts +38 -0
- package/dist/components/combo-box/types.js +3 -0
- package/dist/components/combo-box/types.js.map +1 -0
- package/dist/components/dialog/dialog.css.d.ts +45 -0
- package/dist/components/dialog/dialog.css.js +12 -0
- package/dist/components/dialog/dialog.css.js.map +1 -0
- package/dist/components/dialog/dialog.d.ts +29 -0
- package/dist/components/dialog/dialog.js +186 -0
- package/dist/components/dialog/dialog.js.map +1 -0
- package/dist/components/dialog/index.d.ts +11 -0
- package/dist/components/dialog/index.js +6 -0
- package/dist/components/dialog/index.js.map +1 -0
- package/dist/components/dialog/types.d.ts +53 -0
- package/dist/components/dialog/types.js +3 -0
- package/dist/components/dialog/types.js.map +1 -0
- package/dist/components/drawer/drawer.css.d.ts +48 -0
- package/dist/components/drawer/drawer.css.js +14 -0
- package/dist/components/drawer/drawer.css.js.map +1 -0
- package/dist/components/drawer/drawer.d.ts +28 -0
- package/dist/components/drawer/drawer.js +304 -0
- package/dist/components/drawer/drawer.js.map +1 -0
- package/dist/components/drawer/index.d.ts +16 -0
- package/dist/components/drawer/index.js +6 -0
- package/dist/components/drawer/index.js.map +1 -0
- package/dist/components/drawer/types.d.ts +77 -0
- package/dist/components/drawer/types.js +3 -0
- package/dist/components/drawer/types.js.map +1 -0
- package/dist/components/element/element.d.ts +16 -0
- package/dist/components/element/element.js +24 -0
- package/dist/components/element/element.js.map +1 -0
- package/dist/components/element/index.d.ts +5 -0
- package/dist/components/element/index.js +5 -0
- package/dist/components/element/index.js.map +1 -0
- package/dist/components/element/types.d.ts +24 -0
- package/dist/components/element/types.js +3 -0
- package/dist/components/element/types.js.map +1 -0
- package/dist/components/group/group.css.d.ts +20 -0
- package/dist/components/group/group.css.js +11 -0
- package/dist/components/group/group.css.js.map +1 -0
- package/dist/components/group/group.d.ts +16 -0
- package/dist/components/group/group.js +61 -0
- package/dist/components/group/group.js.map +1 -0
- package/dist/components/group/index.d.ts +6 -0
- package/dist/components/group/index.js +6 -0
- package/dist/components/group/index.js.map +1 -0
- package/dist/components/group/types.d.ts +38 -0
- package/dist/components/group/types.js +3 -0
- package/dist/components/group/types.js.map +1 -0
- package/dist/components/icon/icon.css.d.ts +23 -0
- package/dist/components/icon/icon.css.js +12 -0
- package/dist/components/icon/icon.css.js.map +1 -0
- package/dist/components/icon/icon.d.ts +17 -0
- package/dist/components/icon/icon.js +39 -0
- package/dist/components/icon/icon.js.map +1 -0
- package/dist/components/icon/index.d.ts +5 -0
- package/dist/components/icon/index.js +6 -0
- package/dist/components/icon/index.js.map +1 -0
- package/dist/components/icon/types.d.ts +16 -0
- package/dist/components/icon/types.js +3 -0
- package/dist/components/icon/types.js.map +1 -0
- package/dist/components/index.d.ts +93 -0
- package/dist/components/index.js +31 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/input/index.d.ts +6 -0
- package/dist/components/input/index.js +6 -0
- package/dist/components/input/index.js.map +1 -0
- package/dist/components/input/input.css.d.ts +34 -0
- package/dist/components/input/input.css.js +12 -0
- package/dist/components/input/input.css.js.map +1 -0
- package/dist/components/input/input.d.ts +13 -0
- package/dist/components/input/input.js +141 -0
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/input/types.d.ts +47 -0
- package/dist/components/input/types.js +3 -0
- package/dist/components/input/types.js.map +1 -0
- package/dist/components/menu/index.d.ts +8 -0
- package/dist/components/menu/index.js +6 -0
- package/dist/components/menu/index.js.map +1 -0
- package/dist/components/menu/menu.css.d.ts +83 -0
- package/dist/components/menu/menu.css.js +13 -0
- package/dist/components/menu/menu.css.js.map +1 -0
- package/dist/components/menu/menu.d.ts +32 -0
- package/dist/components/menu/menu.js +252 -0
- package/dist/components/menu/menu.js.map +1 -0
- package/dist/components/menu/types.d.ts +51 -0
- package/dist/components/menu/types.js +3 -0
- package/dist/components/menu/types.js.map +1 -0
- package/dist/components/merge-provider/index.d.ts +5 -0
- package/dist/components/merge-provider/index.js +5 -0
- package/dist/components/merge-provider/index.js.map +1 -0
- package/dist/components/merge-provider/merge-provider.d.ts +20 -0
- package/dist/components/merge-provider/merge-provider.js +46 -0
- package/dist/components/merge-provider/merge-provider.js.map +1 -0
- package/dist/components/merge-provider/types.d.ts +8 -0
- package/dist/components/merge-provider/types.js +3 -0
- package/dist/components/merge-provider/types.js.map +1 -0
- package/dist/components/number-field/index.d.ts +12 -0
- package/dist/components/number-field/index.js +5 -0
- package/dist/components/number-field/index.js.map +1 -0
- package/dist/components/number-field/number-field.css.d.ts +40 -0
- package/dist/components/number-field/number-field.css.js +12 -0
- package/dist/components/number-field/number-field.css.js.map +1 -0
- package/dist/components/number-field/number-field.d.ts +20 -0
- package/dist/components/number-field/number-field.js +125 -0
- package/dist/components/number-field/number-field.js.map +1 -0
- package/dist/components/number-field/types.d.ts +38 -0
- package/dist/components/number-field/types.js +3 -0
- package/dist/components/number-field/types.js.map +1 -0
- package/dist/components/options/index.d.ts +8 -0
- package/dist/components/options/index.js +6 -0
- package/dist/components/options/index.js.map +1 -0
- package/dist/components/options/options.css.d.ts +87 -0
- package/dist/components/options/options.css.js +14 -0
- package/dist/components/options/options.css.js.map +1 -0
- package/dist/components/options/options.d.ts +28 -0
- package/dist/components/options/options.js +253 -0
- package/dist/components/options/options.js.map +1 -0
- package/dist/components/options/types.d.ts +52 -0
- package/dist/components/options/types.js +3 -0
- package/dist/components/options/types.js.map +1 -0
- package/dist/components/picker/index.d.ts +6 -0
- package/dist/components/picker/index.js +6 -0
- package/dist/components/picker/index.js.map +1 -0
- package/dist/components/picker/picker.css.d.ts +37 -0
- package/dist/components/picker/picker.css.js +13 -0
- package/dist/components/picker/picker.css.js.map +1 -0
- package/dist/components/picker/picker.d.ts +24 -0
- package/dist/components/picker/picker.js +113 -0
- package/dist/components/picker/picker.js.map +1 -0
- package/dist/components/picker/picker.stories.css.d.ts +5 -0
- package/dist/components/picker/picker.stories.css.js +10 -0
- package/dist/components/picker/picker.stories.css.js.map +1 -0
- package/dist/components/picker/types.d.ts +30 -0
- package/dist/components/picker/types.js +3 -0
- package/dist/components/picker/types.js.map +1 -0
- package/dist/components/popover/index.d.ts +14 -0
- package/dist/components/popover/index.js +6 -0
- package/dist/components/popover/index.js.map +1 -0
- package/dist/components/popover/popover.css.d.ts +45 -0
- package/dist/components/popover/popover.css.js +12 -0
- package/dist/components/popover/popover.css.js.map +1 -0
- package/dist/components/popover/popover.d.ts +22 -0
- package/dist/components/popover/popover.js +139 -0
- package/dist/components/popover/popover.js.map +1 -0
- package/dist/components/popover/types.d.ts +39 -0
- package/dist/components/popover/types.js +3 -0
- package/dist/components/popover/types.js.map +1 -0
- package/dist/components/query-builder/action-element.d.ts +23 -0
- package/dist/components/query-builder/action-element.js +26 -0
- package/dist/components/query-builder/action-element.js.map +1 -0
- package/dist/components/query-builder/constants.d.ts +25 -0
- package/dist/components/query-builder/constants.js +25 -0
- package/dist/components/query-builder/constants.js.map +1 -0
- package/dist/components/query-builder/dataset-sample.d.ts +95 -0
- package/dist/components/query-builder/dataset-sample.js +288 -0
- package/dist/components/query-builder/dataset-sample.js.map +1 -0
- package/dist/components/query-builder/group.d.ts +9 -0
- package/dist/components/query-builder/group.js +396 -0
- package/dist/components/query-builder/group.js.map +1 -0
- package/dist/components/query-builder/index.d.ts +23 -0
- package/dist/components/query-builder/index.js +8 -0
- package/dist/components/query-builder/index.js.map +1 -0
- package/dist/components/query-builder/query-builder.css.d.ts +116 -0
- package/dist/components/query-builder/query-builder.css.js +14 -0
- package/dist/components/query-builder/query-builder.css.js.map +1 -0
- package/dist/components/query-builder/query-builder.d.ts +23 -0
- package/dist/components/query-builder/query-builder.js +196 -0
- package/dist/components/query-builder/query-builder.js.map +1 -0
- package/dist/components/query-builder/rule.d.ts +7 -0
- package/dist/components/query-builder/rule.js +401 -0
- package/dist/components/query-builder/rule.js.map +1 -0
- package/dist/components/query-builder/types.d.ts +146 -0
- package/dist/components/query-builder/types.js +3 -0
- package/dist/components/query-builder/types.js.map +1 -0
- package/dist/components/query-builder/utils.d.ts +32 -0
- package/dist/components/query-builder/utils.js +25 -0
- package/dist/components/query-builder/utils.js.map +1 -0
- package/dist/components/query-builder/value-editor.d.ts +24 -0
- package/dist/components/query-builder/value-editor.js +207 -0
- package/dist/components/query-builder/value-editor.js.map +1 -0
- package/dist/components/query-builder/value-selector.d.ts +6 -0
- package/dist/components/query-builder/value-selector.js +77 -0
- package/dist/components/query-builder/value-selector.js.map +1 -0
- package/dist/components/radio/index.d.ts +7 -0
- package/dist/components/radio/index.js +6 -0
- package/dist/components/radio/index.js.map +1 -0
- package/dist/components/radio/radio.css.d.ts +41 -0
- package/dist/components/radio/radio.css.js +14 -0
- package/dist/components/radio/radio.css.js.map +1 -0
- package/dist/components/radio/radio.d.ts +23 -0
- package/dist/components/radio/radio.js +114 -0
- package/dist/components/radio/radio.js.map +1 -0
- package/dist/components/radio/types.d.ts +32 -0
- package/dist/components/radio/types.js +3 -0
- package/dist/components/radio/types.js.map +1 -0
- package/dist/components/search-field/index.d.ts +12 -0
- package/dist/components/search-field/index.js +6 -0
- package/dist/components/search-field/index.js.map +1 -0
- package/dist/components/search-field/search-field.css.d.ts +28 -0
- package/dist/components/search-field/search-field.css.js +11 -0
- package/dist/components/search-field/search-field.css.js.map +1 -0
- package/dist/components/search-field/search-field.d.ts +21 -0
- package/dist/components/search-field/search-field.js +92 -0
- package/dist/components/search-field/search-field.js.map +1 -0
- package/dist/components/search-field/types.d.ts +34 -0
- package/dist/components/search-field/types.js +3 -0
- package/dist/components/search-field/types.js.map +1 -0
- package/dist/components/select/index.d.ts +12 -0
- package/dist/components/select/index.js +6 -0
- package/dist/components/select/index.js.map +1 -0
- package/dist/components/select/select.css.d.ts +37 -0
- package/dist/components/select/select.css.js +12 -0
- package/dist/components/select/select.css.js.map +1 -0
- package/dist/components/select/select.d.ts +20 -0
- package/dist/components/select/select.js +109 -0
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/select/types.d.ts +36 -0
- package/dist/components/select/types.js +3 -0
- package/dist/components/select/types.js.map +1 -0
- package/dist/components/switch/index.d.ts +6 -0
- package/dist/components/switch/index.js +6 -0
- package/dist/components/switch/index.js.map +1 -0
- package/dist/components/switch/switch.css.d.ts +31 -0
- package/dist/components/switch/switch.css.js +12 -0
- package/dist/components/switch/switch.css.js.map +1 -0
- package/dist/components/switch/switch.d.ts +10 -0
- package/dist/components/switch/switch.js +60 -0
- package/dist/components/switch/switch.js.map +1 -0
- package/dist/components/switch/types.d.ts +21 -0
- package/dist/components/switch/types.js +3 -0
- package/dist/components/switch/types.js.map +1 -0
- package/dist/components/tabs/index.d.ts +8 -0
- package/dist/components/tabs/index.js +6 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/tabs/tabs.css.d.ts +57 -0
- package/dist/components/tabs/tabs.css.js +15 -0
- package/dist/components/tabs/tabs.css.js.map +1 -0
- package/dist/components/tabs/tabs.d.ts +75 -0
- package/dist/components/tabs/tabs.js +258 -0
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/tabs/types.d.ts +84 -0
- package/dist/components/tabs/types.js +3 -0
- package/dist/components/tabs/types.js.map +1 -0
- package/dist/components/text-field/index.d.ts +9 -0
- package/dist/components/text-field/index.js +5 -0
- package/dist/components/text-field/index.js.map +1 -0
- package/dist/components/text-field/text-field.css.d.ts +28 -0
- package/dist/components/text-field/text-field.css.js +12 -0
- package/dist/components/text-field/text-field.css.js.map +1 -0
- package/dist/components/text-field/text-field.d.ts +62 -0
- package/dist/components/text-field/text-field.js +91 -0
- package/dist/components/text-field/text-field.js.map +1 -0
- package/dist/components/text-field/types.d.ts +28 -0
- package/dist/components/text-field/types.js +3 -0
- package/dist/components/text-field/types.js.map +1 -0
- package/dist/components/textarea/index.d.ts +6 -0
- package/dist/components/textarea/index.js +6 -0
- package/dist/components/textarea/index.js.map +1 -0
- package/dist/components/textarea/textarea.css.d.ts +37 -0
- package/dist/components/textarea/textarea.css.js +12 -0
- package/dist/components/textarea/textarea.css.js.map +1 -0
- package/dist/components/textarea/textarea.d.ts +19 -0
- package/dist/components/textarea/textarea.js +134 -0
- package/dist/components/textarea/textarea.js.map +1 -0
- package/dist/components/textarea/types.d.ts +42 -0
- package/dist/components/textarea/types.js +3 -0
- package/dist/components/textarea/types.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +7 -0
- package/dist/components/tooltip/index.js +6 -0
- package/dist/components/tooltip/index.js.map +1 -0
- package/dist/components/tooltip/tooltip.css.d.ts +30 -0
- package/dist/components/tooltip/tooltip.css.js +12 -0
- package/dist/components/tooltip/tooltip.css.js.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +30 -0
- package/dist/components/tooltip/tooltip.js +112 -0
- package/dist/components/tooltip/tooltip.js.map +1 -0
- package/dist/components/tooltip/types.d.ts +41 -0
- package/dist/components/tooltip/types.js +3 -0
- package/dist/components/tooltip/types.js.map +1 -0
- package/dist/components/tree/index.d.ts +17 -0
- package/dist/components/tree/index.js +6 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/components/tree/tree.css.d.ts +89 -0
- package/dist/components/tree/tree.css.js +15 -0
- package/dist/components/tree/tree.css.js.map +1 -0
- package/dist/components/tree/tree.d.ts +29 -0
- package/dist/components/tree/tree.js +488 -0
- package/dist/components/tree/tree.js.map +1 -0
- package/dist/components/tree/types.d.ts +121 -0
- package/dist/components/tree/types.js +3 -0
- package/dist/components/tree/types.js.map +1 -0
- package/dist/components/tree/utils.d.ts +12 -0
- package/dist/components/tree/utils.js +89 -0
- package/dist/components/tree/utils.js.map +1 -0
- package/dist/hooks/index.d.ts +52 -0
- package/dist/hooks/index.js +11 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use-collection-render/index.d.ts +3 -0
- package/dist/hooks/use-collection-render/index.js +4 -0
- package/dist/hooks/use-collection-render/index.js.map +1 -0
- package/dist/hooks/use-collection-render/use-collection-render.d.ts +11 -0
- package/dist/hooks/use-collection-render/use-collection-render.js +27 -0
- package/dist/hooks/use-collection-render/use-collection-render.js.map +1 -0
- package/dist/hooks/use-context-props/index.d.ts +3 -0
- package/dist/hooks/use-context-props/index.js +4 -0
- package/dist/hooks/use-context-props/index.js.map +1 -0
- package/dist/hooks/use-context-props/use-context-props.d.ts +10 -0
- package/dist/hooks/use-context-props/use-context-props.js +18 -0
- package/dist/hooks/use-context-props/use-context-props.js.map +1 -0
- package/dist/hooks/use-defaults/index.d.ts +37 -0
- package/dist/hooks/use-defaults/index.js +5 -0
- package/dist/hooks/use-defaults/index.js.map +1 -0
- package/dist/hooks/use-defaults/types.d.ts +83 -0
- package/dist/hooks/use-defaults/types.js +3 -0
- package/dist/hooks/use-defaults/types.js.map +1 -0
- package/dist/hooks/use-defaults/use-defaults.d.ts +96 -0
- package/dist/hooks/use-defaults/use-defaults.js +36 -0
- package/dist/hooks/use-defaults/use-defaults.js.map +1 -0
- package/dist/hooks/use-propagating-press/index.d.ts +2 -0
- package/dist/hooks/use-propagating-press/index.js +4 -0
- package/dist/hooks/use-propagating-press/index.js.map +1 -0
- package/dist/hooks/use-propagating-press/use-propagating-press.d.ts +13 -0
- package/dist/hooks/use-propagating-press/use-propagating-press.js +21 -0
- package/dist/hooks/use-propagating-press/use-propagating-press.js.map +1 -0
- package/dist/hooks/use-slot/index.d.ts +2 -0
- package/dist/hooks/use-slot/index.js +4 -0
- package/dist/hooks/use-slot/index.js.map +1 -0
- package/dist/hooks/use-slot/use-slot.d.ts +16 -0
- package/dist/hooks/use-slot/use-slot.js +21 -0
- package/dist/hooks/use-slot/use-slot.js.map +1 -0
- package/dist/hooks/use-theme/index.d.ts +43 -0
- package/dist/hooks/use-theme/index.js +5 -0
- package/dist/hooks/use-theme/index.js.map +1 -0
- package/dist/hooks/use-theme/types.d.ts +104 -0
- package/dist/hooks/use-theme/types.js +3 -0
- package/dist/hooks/use-theme/types.js.map +1 -0
- package/dist/hooks/use-theme/use-theme.css.d.ts +3 -0
- package/dist/hooks/use-theme/use-theme.css.js +8 -0
- package/dist/hooks/use-theme/use-theme.css.js.map +1 -0
- package/dist/hooks/use-theme/use-theme.d.ts +55 -0
- package/dist/hooks/use-theme/use-theme.js +108 -0
- package/dist/hooks/use-theme/use-theme.js.map +1 -0
- package/dist/hooks/use-tree/index.d.ts +4 -0
- package/dist/hooks/use-tree/index.js +4 -0
- package/dist/hooks/use-tree/index.js.map +1 -0
- package/dist/hooks/use-tree/use-tree.d.ts +7 -0
- package/dist/hooks/use-tree/use-tree.js +257 -0
- package/dist/hooks/use-tree/use-tree.js.map +1 -0
- package/dist/hooks/use-tree/utils.d.ts +10 -0
- package/dist/hooks/use-tree/utils.js +84 -0
- package/dist/hooks/use-tree/utils.js.map +1 -0
- package/dist/hooks/use-update-effect/index.d.ts +1 -0
- package/dist/hooks/use-update-effect/index.js +4 -0
- package/dist/hooks/use-update-effect/index.js.map +1 -0
- package/dist/hooks/use-update-effect/use-update-effect.d.ts +3 -0
- package/dist/hooks/use-update-effect/use-update-effect.js +23 -0
- package/dist/hooks/use-update-effect/use-update-effect.js.map +1 -0
- package/dist/index.css +90 -53
- package/dist/index.d.ts +113 -757
- package/dist/index.js +5 -5278
- package/dist/index.js.map +1 -1
- package/dist/ladle/actions.d.ts +3 -0
- package/dist/ladle/actions.js +26 -0
- package/dist/ladle/actions.js.map +1 -0
- package/dist/ladle/index.d.ts +1 -0
- package/dist/ladle/index.js +4 -0
- package/dist/ladle/index.js.map +1 -0
- package/dist/styles/index.d.ts +6 -0
- package/dist/styles/index.js +9 -0
- package/dist/styles/index.js.map +1 -0
- package/dist/styles/layers.css.d.ts +18 -0
- package/dist/styles/layers.css.js +8 -0
- package/dist/styles/layers.css.js.map +1 -0
- package/dist/styles/reset.css.d.ts +2 -0
- package/dist/styles/reset.css.js +3 -0
- package/dist/styles/reset.css.js.map +1 -0
- package/dist/styles/space.css.d.ts +2 -0
- package/dist/styles/space.css.js +3 -0
- package/dist/styles/space.css.js.map +1 -0
- package/dist/styles/surfaces.css.d.ts +6 -0
- package/dist/styles/surfaces.css.js +8 -0
- package/dist/styles/surfaces.css.js.map +1 -0
- package/dist/styles/theme.css.d.ts +337 -0
- package/dist/styles/theme.css.js +35 -0
- package/dist/styles/theme.css.js.map +1 -0
- package/dist/styles/typography.css.d.ts +21 -0
- package/dist/styles/typography.css.js +12 -0
- package/dist/styles/typography.css.js.map +1 -0
- package/dist/test/setup.d.ts +2 -0
- package/dist/test/setup.js +6879 -0
- package/dist/test/setup.js.map +1 -0
- package/dist/types/deckgl.d.ts +3 -0
- package/dist/types/deckgl.js +3 -0
- package/dist/types/deckgl.js.map +1 -0
- package/dist/types/generic.d.ts +5 -0
- package/dist/types/generic.js +3 -0
- package/dist/types/generic.js.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/props.d.ts +6 -0
- package/dist/types/props.js +3 -0
- package/dist/types/props.js.map +1 -0
- package/dist/types/react-aria.d.ts +94 -0
- package/dist/types/react-aria.js +3 -0
- package/dist/types/react-aria.js.map +1 -0
- package/dist/types/react.d.d.ts +6 -0
- package/dist/types/react.d.js +3 -0
- package/dist/types/react.d.js.map +1 -0
- package/dist/types/use-tree.d.ts +55 -0
- package/dist/types/use-tree.js +3 -0
- package/dist/types/use-tree.js.map +1 -0
- package/dist/types/vanilla-extract.d.ts +18 -0
- package/dist/types/vanilla-extract.js +3 -0
- package/dist/types/vanilla-extract.js.map +1 -0
- package/dist/utils/css.d.ts +142 -0
- package/dist/utils/css.js +165 -0
- package/dist/utils/css.js.map +1 -0
- package/dist/utils/events.d.ts +11 -0
- package/dist/utils/events.js +10 -0
- package/dist/utils/events.js.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/props.d.ts +32 -0
- package/dist/utils/props.js +145 -0
- package/dist/utils/props.js.map +1 -0
- package/dist/utils/validators.d.ts +52 -0
- package/dist/utils/validators.js +42 -0
- package/dist/utils/validators.js.map +1 -0
- package/dist/vanilla.d.ts +66 -5
- package/dist/vanilla.js +27 -1
- package/dist/vanilla.js.map +1 -1
- package/package.json +30 -21
- package/dist/chunk-4ZUGQMUD.js +0 -419
- package/dist/chunk-4ZUGQMUD.js.map +0 -1
- package/dist/index.css.map +0 -1
- package/dist/vanilla-Ibcop5d3.d.ts +0 -2627
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"deckgl.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"generic.js"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { RGBA } from './deckgl.js';
|
|
2
|
+
export { AsType } from './generic.js';
|
|
3
|
+
export { ClassNames, OmitProtectedProps } from './props.js';
|
|
4
|
+
export { ChildrenRenderProps, ClassNameRenderProps, ProviderValue, ProviderValues, RenderProps, RenderPropsChildren, RenderPropsClassName, RenderPropsStyle, StylePropRenderProps, StyleRenderProps } from './react-aria.js';
|
|
5
|
+
export { TreeActions, TreeGroupNode, TreeItemNode, TreeNode, TreeNodes, UseTreeOptions, UseTreeResult } from './use-tree.js';
|
|
6
|
+
export { Contract, CssVarFunction, MapLeafNodes, PartialMapLeafNodes, Primitive } from './vanilla-extract.js';
|
|
7
|
+
import 'react';
|
|
8
|
+
import '@react-types/shared';
|
|
9
|
+
import '@react-stately/data';
|
|
10
|
+
import '@vanilla-extract/css';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"props.js"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode, Context } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Re-export due to not being exported by library
|
|
5
|
+
*/
|
|
6
|
+
type ClassNameRenderProps<T extends object> = T & {
|
|
7
|
+
defaultClassName?: string;
|
|
8
|
+
};
|
|
9
|
+
type RenderPropsClassName<T extends object> = string | ((values: ClassNameRenderProps<T>) => string);
|
|
10
|
+
type StylePropRenderProps<T extends object> = T & {
|
|
11
|
+
defaultStyle?: CSSProperties;
|
|
12
|
+
};
|
|
13
|
+
type RenderPropsStyle<T extends object> = CSSProperties | ((values: StylePropRenderProps<T>) => CSSProperties);
|
|
14
|
+
type ChildrenRenderProps<T extends object> = T & {
|
|
15
|
+
defaultChildren?: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
type RenderPropsChildren<T extends object> = ReactNode | ((values: ChildrenRenderProps<T>) => ReactNode);
|
|
18
|
+
type StyleRenderProps<T extends object> = {
|
|
19
|
+
/** The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state. */
|
|
20
|
+
className?: RenderPropsClassName<T>;
|
|
21
|
+
/** The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the element. A function may be provided to compute the style based on component state. */
|
|
22
|
+
style?: RenderPropsStyle<T>;
|
|
23
|
+
};
|
|
24
|
+
type RenderProps<T extends object> = StyleRenderProps<T> & {
|
|
25
|
+
/** The children of the component. A function may be provided to alter the children based on component state. */
|
|
26
|
+
children?: RenderPropsChildren<T>;
|
|
27
|
+
};
|
|
28
|
+
type ProviderValue<T> = [Context<T>, T];
|
|
29
|
+
type ProviderValues<A, B, C, D, E, F, G, H, I, J, K> = [ProviderValue<A>] | [ProviderValue<A>, ProviderValue<B>] | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>] | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>] | [
|
|
30
|
+
ProviderValue<A>,
|
|
31
|
+
ProviderValue<B>,
|
|
32
|
+
ProviderValue<C>,
|
|
33
|
+
ProviderValue<D>,
|
|
34
|
+
ProviderValue<E>
|
|
35
|
+
] | [
|
|
36
|
+
ProviderValue<A>,
|
|
37
|
+
ProviderValue<B>,
|
|
38
|
+
ProviderValue<C>,
|
|
39
|
+
ProviderValue<D>,
|
|
40
|
+
ProviderValue<E>,
|
|
41
|
+
ProviderValue<F>
|
|
42
|
+
] | [
|
|
43
|
+
ProviderValue<A>,
|
|
44
|
+
ProviderValue<B>,
|
|
45
|
+
ProviderValue<C>,
|
|
46
|
+
ProviderValue<D>,
|
|
47
|
+
ProviderValue<E>,
|
|
48
|
+
ProviderValue<F>,
|
|
49
|
+
ProviderValue<G>
|
|
50
|
+
] | [
|
|
51
|
+
ProviderValue<A>,
|
|
52
|
+
ProviderValue<B>,
|
|
53
|
+
ProviderValue<C>,
|
|
54
|
+
ProviderValue<D>,
|
|
55
|
+
ProviderValue<E>,
|
|
56
|
+
ProviderValue<F>,
|
|
57
|
+
ProviderValue<G>,
|
|
58
|
+
ProviderValue<H>
|
|
59
|
+
] | [
|
|
60
|
+
ProviderValue<A>,
|
|
61
|
+
ProviderValue<B>,
|
|
62
|
+
ProviderValue<C>,
|
|
63
|
+
ProviderValue<D>,
|
|
64
|
+
ProviderValue<E>,
|
|
65
|
+
ProviderValue<F>,
|
|
66
|
+
ProviderValue<G>,
|
|
67
|
+
ProviderValue<H>,
|
|
68
|
+
ProviderValue<I>
|
|
69
|
+
] | [
|
|
70
|
+
ProviderValue<A>,
|
|
71
|
+
ProviderValue<B>,
|
|
72
|
+
ProviderValue<C>,
|
|
73
|
+
ProviderValue<D>,
|
|
74
|
+
ProviderValue<E>,
|
|
75
|
+
ProviderValue<F>,
|
|
76
|
+
ProviderValue<G>,
|
|
77
|
+
ProviderValue<H>,
|
|
78
|
+
ProviderValue<I>,
|
|
79
|
+
ProviderValue<J>
|
|
80
|
+
] | [
|
|
81
|
+
ProviderValue<A>,
|
|
82
|
+
ProviderValue<B>,
|
|
83
|
+
ProviderValue<C>,
|
|
84
|
+
ProviderValue<D>,
|
|
85
|
+
ProviderValue<E>,
|
|
86
|
+
ProviderValue<F>,
|
|
87
|
+
ProviderValue<G>,
|
|
88
|
+
ProviderValue<H>,
|
|
89
|
+
ProviderValue<I>,
|
|
90
|
+
ProviderValue<J>,
|
|
91
|
+
ProviderValue<K>
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
export type { ChildrenRenderProps, ClassNameRenderProps, ProviderValue, ProviderValues, RenderProps, RenderPropsChildren, RenderPropsClassName, RenderPropsStyle, StylePropRenderProps, StyleRenderProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"react-aria.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"react.d.js","sourcesContent":[]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Key, Selection, SelectionMode } from '@react-types/shared';
|
|
2
|
+
import { TreeData } from '@react-stately/data';
|
|
3
|
+
|
|
4
|
+
type TreeItemNode<T> = {
|
|
5
|
+
id: Key;
|
|
6
|
+
label: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
value?: T;
|
|
9
|
+
isViewable?: boolean;
|
|
10
|
+
isVisible?: boolean;
|
|
11
|
+
};
|
|
12
|
+
type TreeGroupNode<T> = TreeItemNode<T> & {
|
|
13
|
+
nodes: TreeNodes<T>[];
|
|
14
|
+
types?: string[];
|
|
15
|
+
isExpanded?: boolean;
|
|
16
|
+
};
|
|
17
|
+
type TreeNodes<T> = TreeGroupNode<T> | TreeItemNode<T>;
|
|
18
|
+
type TreeNode<T, N extends TreeNodes<T> = TreeNodes<T>> = {
|
|
19
|
+
key: Key;
|
|
20
|
+
parentKey: Key;
|
|
21
|
+
value: N;
|
|
22
|
+
children: TreeNode<T, N>[];
|
|
23
|
+
};
|
|
24
|
+
type TreeActions<T> = Omit<TreeData<TreeNodes<T>>, 'items' | 'selectedKeys' | 'update'> & {
|
|
25
|
+
revertIsExpanded: () => void;
|
|
26
|
+
toggleIsExpanded: (selection?: Selection, isExpanded?: boolean, isRevertable?: boolean) => void;
|
|
27
|
+
toggleIsSelected: (selection?: Selection, isSelected?: boolean) => void;
|
|
28
|
+
toggleIsViewable: (selection?: Selection, isViewable?: boolean) => void;
|
|
29
|
+
update: (key: Key, node: Partial<TreeNodes<T>>) => void;
|
|
30
|
+
};
|
|
31
|
+
type UseTreeOptions<T> = {
|
|
32
|
+
allowsExpansion?: boolean;
|
|
33
|
+
allowsVisibility?: boolean;
|
|
34
|
+
nodes: TreeNodes<T>[];
|
|
35
|
+
selectionMode?: SelectionMode;
|
|
36
|
+
onSelectionChange?: (keys: Selection) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Due to being triggered during the render cycle, this event
|
|
39
|
+
* handler should not be tied to any state change updates
|
|
40
|
+
*/
|
|
41
|
+
onUpdate?: (nodes: TreeNodes<T>[]) => void;
|
|
42
|
+
};
|
|
43
|
+
type UseTreeResult<T> = Required<Omit<UseTreeOptions<T>, 'nodes' | 'onSelectionChange' | 'onUpdate'>> & Pick<TreeData<TreeNodes<T>>, 'selectedKeys'> & {
|
|
44
|
+
lookup: Record<Key, TreeNode<T>>;
|
|
45
|
+
tree: TreeNode<T>;
|
|
46
|
+
/**
|
|
47
|
+
* DO NOT DESTRUCTURE THIS PROPERTY
|
|
48
|
+
*
|
|
49
|
+
* The underlying useTreeData hook relies on "this" within certain methods
|
|
50
|
+
* and destructuring the actions will cause errors to be thrown
|
|
51
|
+
*/
|
|
52
|
+
actions: TreeActions<T>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type { TreeActions, TreeGroupNode, TreeItemNode, TreeNode, TreeNodes, UseTreeOptions, UseTreeResult };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"use-tree.js"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createVar } from '@vanilla-extract/css';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Re-export due to not being exported by library
|
|
5
|
+
*/
|
|
6
|
+
type CssVarFunction = ReturnType<typeof createVar>;
|
|
7
|
+
type Contract = {
|
|
8
|
+
[key: string]: CssVarFunction | null | Contract;
|
|
9
|
+
};
|
|
10
|
+
type Primitive = string | boolean | number | null | undefined;
|
|
11
|
+
type MapLeafNodes<Obj, LeafType> = {
|
|
12
|
+
[Prop in keyof Obj]: Obj[Prop] extends Primitive ? LeafType : Obj[Prop] extends Record<string | number, unknown> ? MapLeafNodes<Obj[Prop], LeafType> : never;
|
|
13
|
+
};
|
|
14
|
+
type PartialMapLeafNodes<Obj, LeafType> = {
|
|
15
|
+
[Prop in keyof Obj]?: Obj[Prop] extends Primitive ? LeafType : Obj[Prop] extends Record<string | number, unknown> ? PartialMapLeafNodes<Obj[Prop], LeafType> : never;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type { Contract, CssVarFunction, MapLeafNodes, PartialMapLeafNodes, Primitive };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"vanilla-extract.js"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { StyleRule, GlobalStyleRule } from '@vanilla-extract/css';
|
|
2
|
+
import { RGBA } from '../types/deckgl.js';
|
|
3
|
+
import { Contract, PartialMapLeafNodes, Primitive, MapLeafNodes, CssVarFunction } from '../types/vanilla-extract.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Parse out CSS var name from CSS var implementation
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* unwrapCssVar('var(--foo)')
|
|
10
|
+
* // returns '--foo'
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* unwrapCssVar('var(--foo, blue)')
|
|
14
|
+
* // returns '--foo'
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* unwrapCssVar('var(--foo, var(--bar))')
|
|
18
|
+
* // returns '--foo'
|
|
19
|
+
*/
|
|
20
|
+
declare function unwrapCssVar(cssVar: string): string;
|
|
21
|
+
type FulfilledContract<T> = MapLeafNodes<T, null | number | string | RGBA>;
|
|
22
|
+
/**
|
|
23
|
+
* Convert contract to nested object of identical shape with computed CSS values
|
|
24
|
+
* Pixel values are converted to numbers
|
|
25
|
+
* RGB(A) values are converted to DeckGL compatible tuples
|
|
26
|
+
* All other values are left unconverted
|
|
27
|
+
*/
|
|
28
|
+
declare function computeContract<T extends Contract>(contract: T, css: CSSStyleDeclaration): FulfilledContract<T>;
|
|
29
|
+
/**
|
|
30
|
+
* Convert potentially nested contract and values pair into flattened CSS var record
|
|
31
|
+
* The contract provides a lookup for CSS vars
|
|
32
|
+
* The values are expected to partially match the contract shapeForm
|
|
33
|
+
*/
|
|
34
|
+
declare function reduceContract<T extends Contract, U>(contract: T, values: PartialMapLeafNodes<T, U>): Record<`var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`, U>;
|
|
35
|
+
/**
|
|
36
|
+
* Reduce contract and values into Vanilla Extract friendly CSS vars
|
|
37
|
+
*/
|
|
38
|
+
declare function assignPartialVars<T extends Contract>(contract: T, values: PartialMapLeafNodes<T, Primitive>): {
|
|
39
|
+
[k: string]: string;
|
|
40
|
+
};
|
|
41
|
+
type CssVarValues = {
|
|
42
|
+
[key: string]: CssVarValues | Primitive;
|
|
43
|
+
};
|
|
44
|
+
type CssVarValueOptions<T extends object> = {
|
|
45
|
+
[P in keyof T]?: T[P] extends object ? CssVarValueOptions<T[P]> : T[P] | T[P][];
|
|
46
|
+
};
|
|
47
|
+
type Operators = 'and' | 'or';
|
|
48
|
+
type ContainerQueryOptions = {
|
|
49
|
+
container?: string;
|
|
50
|
+
operator?: Operators;
|
|
51
|
+
maxHeight?: string;
|
|
52
|
+
minHeight?: string;
|
|
53
|
+
maxWidth?: string;
|
|
54
|
+
minWidth?: string;
|
|
55
|
+
};
|
|
56
|
+
type ContainerQueryValues<T extends CssVarValues> = CssVarValueOptions<T> & ContainerQueryOptions;
|
|
57
|
+
type MultiContainerQuery<T extends CssVarValues> = {
|
|
58
|
+
operator?: Operators;
|
|
59
|
+
groups: ContainerQueryValues<T>[];
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Create simple or complex container queries with and/or operators.
|
|
63
|
+
*
|
|
64
|
+
* To provide type safety and ease of use, this function accepts a generic and a contract
|
|
65
|
+
* The generic type defines the possible values for the parameters defined within the contract
|
|
66
|
+
*
|
|
67
|
+
* Ex: containerQuery<{ foo: boolean }>({ foo: 'var(--foo)' }, { foo: true })
|
|
68
|
+
*
|
|
69
|
+
* By providing the type constraint and contract, the query parameters will have intellisense
|
|
70
|
+
* on which parameters exist and what their possible values can be
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* containerQuery(contract, { a: true })
|
|
74
|
+
* // returns (a: true)
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* containerQuery(contract, { a: true, b: true })
|
|
78
|
+
* // returns (a: true) and (b: true)
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* containerQuery(contract, { operator: 'or', a: true, b: true })
|
|
82
|
+
* // returns (a: true) or (b: true)
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* containerQuery(contract, { groups: [{ a: true }, { b: true }] })
|
|
86
|
+
* // returns (a: true) or (b: true)
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* containerQuery(contract, { a: ['foo', 'bar'] })
|
|
90
|
+
* // returns (a: 'foo') or (a: 'bar')
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* containerQuery(contract, { a: ['foo', 'bar'], b: true })
|
|
94
|
+
* // returns ((a: 'foo') or (a: 'bar')) and (b: true)
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* containerQuery(contract, { operator: 'or', a: ['foo', 'bar'], b: true })
|
|
98
|
+
* // returns ((a: 'foo') or (a: 'bar')) or (b: true)
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* containerQuery(contract, { groups: [{ a: true, b: true }, { c: true, d: true }] })
|
|
102
|
+
* // returns ((a: true) and (b: true)) or ((c: true) and (d: true))
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* containerQuery(contract, { operator: 'and', groups: [{ operator: 'or', a: true, b: true }, { c: true, d: true }] })
|
|
106
|
+
* // returns ((a: true) or (b: true)) and ((c: true) and (d: true))
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* containerQuery(contract, { operator: 'and', groups: [{ operator: 'or', a: true, b: true }, { operator: 'or', c: true, d: true }] })
|
|
110
|
+
* // returns ((a: true) or (b: true)) and ((c: true) or (d: true))
|
|
111
|
+
*/
|
|
112
|
+
declare function containerQuery<T extends CssVarValues = CssVarValues>(contract: MapLeafNodes<Omit<T, keyof ContainerQueryOptions>, CssVarFunction>, query: ContainerQueryValues<T> | MultiContainerQuery<T>): string;
|
|
113
|
+
type ContainerStyle = Exclude<StyleRule['@container'], undefined>[string];
|
|
114
|
+
type ContainerQuery<T extends CssVarValues> = {
|
|
115
|
+
query: ContainerQueryValues<T> | MultiContainerQuery<T>;
|
|
116
|
+
};
|
|
117
|
+
type ContainerQueries<T extends CssVarValues> = ContainerStyle & ContainerQuery<T>;
|
|
118
|
+
type GlobalContainerStyle = Exclude<GlobalStyleRule['@container'], undefined>[string];
|
|
119
|
+
type GlobalContainerQueries<T extends CssVarValues> = GlobalContainerStyle & ContainerQuery<T>;
|
|
120
|
+
/**
|
|
121
|
+
* Bulk container query creation based on the same contract
|
|
122
|
+
*/
|
|
123
|
+
declare function containerQueries<T extends CssVarValues = CssVarValues>(contract: MapLeafNodes<Omit<T, keyof ContainerQueryOptions>, CssVarFunction>, ...styles: ContainerQueries<T>[]): Record<string, ContainerStyle>;
|
|
124
|
+
declare function containerQueries<T extends CssVarValues = CssVarValues>(contract: MapLeafNodes<Omit<T, keyof ContainerQueryOptions>, CssVarFunction>, ...styles: GlobalContainerQueries<T>[]): Record<string, GlobalContainerStyle>;
|
|
125
|
+
type VarsOnlyContainerQuery<T extends CssVarValues> = Required<Pick<ContainerQueries<T>, 'query' | 'vars'>>;
|
|
126
|
+
type QueryOptionalVarsOnlyContainerQuery<T extends CssVarValues> = Partial<Pick<VarsOnlyContainerQuery<T>, 'query'>> & Pick<VarsOnlyContainerQuery<T>, 'vars'>;
|
|
127
|
+
/**
|
|
128
|
+
* Helper for establishing global theme variables with the restriction that
|
|
129
|
+
* only variables may be set (and are required). All other styles must be
|
|
130
|
+
* established using alternative utils
|
|
131
|
+
*
|
|
132
|
+
* The first style rule has an optional query. If the query is missing, the vars
|
|
133
|
+
* are set outside of a container query
|
|
134
|
+
*/
|
|
135
|
+
declare function applyThemeVars<T extends CssVarValues = CssVarValues>(contract: MapLeafNodes<Omit<T, keyof ContainerQueryOptions>, CssVarFunction>, styles: [QueryOptionalVarsOnlyContainerQuery<T>, ...VarsOnlyContainerQuery<T>[]] | VarsOnlyContainerQuery<T>[], layer?: string): StyleRule;
|
|
136
|
+
/**
|
|
137
|
+
* Runtime creation of inline style CSS vars that enable CSS container queries
|
|
138
|
+
*/
|
|
139
|
+
declare function inlineVars(vars: Record<string, Primitive>): Record<string, string>;
|
|
140
|
+
declare function inlineVars<T extends Contract>(contract: T, values: PartialMapLeafNodes<T, Primitive>): Record<string, string>;
|
|
141
|
+
|
|
142
|
+
export { applyThemeVars, assignPartialVars, computeContract, containerQueries, containerQuery, inlineVars, reduceContract, unwrapCssVar };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import '../chunk-PZ5AY32C.js';
|
|
2
|
+
import { assignInlineVars } from '@vanilla-extract/dynamic';
|
|
3
|
+
import kebabCase from 'lodash/kebabCase';
|
|
4
|
+
import { layers } from '../styles/index.js';
|
|
5
|
+
import { pixelValueAsStringValidator, rgbaAsStringValidator } from './validators.js';
|
|
6
|
+
|
|
7
|
+
function unwrapCssVar(cssVar) {
|
|
8
|
+
return cssVar.replace(/^var\((--[\w-]+)[^\w-]+.*/i, "$1");
|
|
9
|
+
}
|
|
10
|
+
function computeContract(contract, css) {
|
|
11
|
+
return Object.entries(contract).reduce(
|
|
12
|
+
(acc, [key, cssVarOrContract]) => {
|
|
13
|
+
if (cssVarOrContract == null) {
|
|
14
|
+
acc[key] = null;
|
|
15
|
+
return acc;
|
|
16
|
+
}
|
|
17
|
+
if (typeof cssVarOrContract === "object") {
|
|
18
|
+
acc[key] = computeContract(cssVarOrContract, css);
|
|
19
|
+
return acc;
|
|
20
|
+
}
|
|
21
|
+
const cssVar = unwrapCssVar(cssVarOrContract);
|
|
22
|
+
const value = css.getPropertyValue(cssVar);
|
|
23
|
+
const pixel = pixelValueAsStringValidator.safeParse(value);
|
|
24
|
+
if (pixel.success) {
|
|
25
|
+
acc[key] = pixel.data;
|
|
26
|
+
return acc;
|
|
27
|
+
}
|
|
28
|
+
const rgba = rgbaAsStringValidator.safeParse(value);
|
|
29
|
+
if (rgba.success) {
|
|
30
|
+
acc[key] = rgba.data;
|
|
31
|
+
return acc;
|
|
32
|
+
}
|
|
33
|
+
acc[key] = value ?? null;
|
|
34
|
+
return acc;
|
|
35
|
+
},
|
|
36
|
+
{}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function reduceContract(contract, values) {
|
|
40
|
+
const nodes = [
|
|
41
|
+
{ contract, values }
|
|
42
|
+
];
|
|
43
|
+
const vars = {};
|
|
44
|
+
for (let node of nodes) {
|
|
45
|
+
Object.entries(node.values).forEach(([key, value]) => {
|
|
46
|
+
const cssVarOrSubContract = node.contract[key];
|
|
47
|
+
if (cssVarOrSubContract == null || value == null) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (typeof cssVarOrSubContract === "string" && (typeof value !== "object" || Array.isArray(value))) {
|
|
51
|
+
vars[cssVarOrSubContract] = value;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (typeof cssVarOrSubContract === "object" && typeof value === "object") {
|
|
55
|
+
nodes.push({ contract: cssVarOrSubContract, values: value });
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return vars;
|
|
60
|
+
}
|
|
61
|
+
function assignPartialVars(contract, values) {
|
|
62
|
+
return Object.fromEntries(
|
|
63
|
+
Object.entries(reduceContract(contract, values)).map(([key, value]) => [
|
|
64
|
+
key,
|
|
65
|
+
`${value}`
|
|
66
|
+
])
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
function processConditions(contract, values) {
|
|
70
|
+
return Object.entries(
|
|
71
|
+
reduceContract(
|
|
72
|
+
{
|
|
73
|
+
...contract,
|
|
74
|
+
maxHeight: "maxHeight",
|
|
75
|
+
// NOTE: Passthrough these values not as CSS vars
|
|
76
|
+
minHeight: "minHeight",
|
|
77
|
+
maxWidth: "maxWidth",
|
|
78
|
+
minWidth: "minWidth"
|
|
79
|
+
},
|
|
80
|
+
values
|
|
81
|
+
)
|
|
82
|
+
).reduce((acc, [key, value]) => {
|
|
83
|
+
if (key === "container" || key === "operator" || value == null) {
|
|
84
|
+
return acc;
|
|
85
|
+
}
|
|
86
|
+
const isStyle = !/^(?:max|min)(?:Height|Width)$/.test(key);
|
|
87
|
+
const prefix = isStyle ? "style" : "";
|
|
88
|
+
const prop = isStyle ? unwrapCssVar(key) : kebabCase(key);
|
|
89
|
+
if (Array.isArray(value)) {
|
|
90
|
+
const group = value.reduce((ac, val) => {
|
|
91
|
+
if (val != null) {
|
|
92
|
+
ac.push(`${prefix}(${prop}: ${val})`);
|
|
93
|
+
}
|
|
94
|
+
return ac;
|
|
95
|
+
}, []);
|
|
96
|
+
acc.push(`(${group.join(" or ")})`);
|
|
97
|
+
} else {
|
|
98
|
+
acc.push(`${prefix}(${prop}: ${value})`);
|
|
99
|
+
}
|
|
100
|
+
return acc;
|
|
101
|
+
}, []);
|
|
102
|
+
}
|
|
103
|
+
function isMultiQuery(value) {
|
|
104
|
+
return value != null && typeof value === "object" && (!("operator" in value) || "operator" in value && (value.operator === "and" || value.operator === "or")) && "groups" in value && Array.isArray(value.groups) && value.groups.every((group) => group != null && typeof group === "object");
|
|
105
|
+
}
|
|
106
|
+
function containerQuery(contract, query) {
|
|
107
|
+
const isMultiGroup = isMultiQuery(query);
|
|
108
|
+
const groups = isMultiGroup ? query.groups : [query];
|
|
109
|
+
const groupsOperator = ` ${(isMultiGroup ? query.operator : null) ?? "or"} `;
|
|
110
|
+
return groups.map((group, index) => {
|
|
111
|
+
const operator = ` ${group.operator ?? "and"} `;
|
|
112
|
+
let container = group.container ?? "";
|
|
113
|
+
if (index) {
|
|
114
|
+
container = "";
|
|
115
|
+
}
|
|
116
|
+
const conditions = processConditions(contract, group);
|
|
117
|
+
const isMultiCondition = groups.length > 1 && conditions.length > 1;
|
|
118
|
+
return [
|
|
119
|
+
container,
|
|
120
|
+
container && " ",
|
|
121
|
+
isMultiCondition ? "(" : "",
|
|
122
|
+
conditions.join(operator),
|
|
123
|
+
isMultiCondition ? ")" : ""
|
|
124
|
+
].join("");
|
|
125
|
+
}).join(groupsOperator);
|
|
126
|
+
}
|
|
127
|
+
function containerQueries(contract, ...styles) {
|
|
128
|
+
return Object.fromEntries(
|
|
129
|
+
styles.map(({ query, ...style }) => [
|
|
130
|
+
containerQuery(contract, query),
|
|
131
|
+
style
|
|
132
|
+
])
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
function applyThemeVars(contract, styles, layer = layers.variables.l1) {
|
|
136
|
+
const [style, ...rest] = styles;
|
|
137
|
+
const stylesWithQueries = !style.query ? rest : styles;
|
|
138
|
+
return {
|
|
139
|
+
"@layer": {
|
|
140
|
+
[layer]: {
|
|
141
|
+
...!style.query ? { vars: style.vars } : {},
|
|
142
|
+
...stylesWithQueries.length ? {
|
|
143
|
+
"@container": containerQueries(contract, ...stylesWithQueries)
|
|
144
|
+
} : {}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function inlineVars(varsOrContract, values) {
|
|
150
|
+
return assignInlineVars(
|
|
151
|
+
!values ? Object.entries(varsOrContract).reduce(
|
|
152
|
+
(acc, [key, value]) => {
|
|
153
|
+
if (value != null) {
|
|
154
|
+
acc[key] = `${value}`;
|
|
155
|
+
}
|
|
156
|
+
return acc;
|
|
157
|
+
},
|
|
158
|
+
{}
|
|
159
|
+
) : assignPartialVars(varsOrContract, values)
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export { applyThemeVars, assignPartialVars, computeContract, containerQueries, containerQuery, inlineVars, reduceContract, unwrapCssVar };
|
|
164
|
+
//# sourceMappingURL=css.js.map
|
|
165
|
+
//# sourceMappingURL=css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/css.ts"],"names":[],"mappings":";;;;;;AAgCO,SAAS,aAAa,MAAgB,EAAA;AAC3C,EAAO,OAAA,MAAA,CAAO,OAAQ,CAAA,4BAAA,EAA8B,IAAI,CAAA;AAC1D;AAgBO,SAAS,eAAA,CACd,UACA,GACsB,EAAA;AACtB,EAAO,OAAA,MAAA,CAAO,OAAQ,CAAA,QAAQ,CAAE,CAAA,MAAA;AAAA,IAC9B,CAAC,GAAA,EAAK,CAAC,GAAA,EAAK,gBAAgB,CAAM,KAAA;AAChC,MAAA,IAAI,oBAAoB,IAA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A,CAAkB,UAAU,KAAK,CAAA;AAAA,MACjC;AAAA,KACD;AAAA,GACH;AACF;AAmBO,SAAS,eACd,QACA,EAAA,MAAA,EAGA,KAAQ,GAAA,MAAA,CAAO,UAAU,EACd,EAAA;AACX,EAAA,MAAM,CAAC,KAAA,EAAO,GAAG,IAAI,CAAI,GAAA,MAAA;AAEzB,EAAA,MAAM,iBACJ,GAAA,CAAC,KAAM,CAAA,KAAA,GAAQ,IAAO,GAAA,MAAA;AAGxB,EAAO,OAAA;AAAA,IACL,QAAU,EAAA;AAAA,MACR,CAAC,KAAK,GAAG;AAAA,QACP,GAAI,CAAC,KAAM,CAAA,KAAA,GAAQ,EAAE,IAAM,EAAA,KAAA,CAAM,IAAK,EAAA,GAAI,EAAC;AAAA,QAC3C,GAAI,kBAAkB,MAClB,GAAA;AAAA,UACE,YAAc,EAAA,gBAAA,CAAoB,QAAU,EAAA,GAAG,iBAAiB;AAAA,YAElE;AAAC;AACP;AACF,GACF;AACF;AAcO,SAAS,UAAA,CACd,gBACA,MACwB,EAAA;AACxB,EAAO,OAAA,gBAAA;AAAA,IACL,CAAC,MAAA,GACG,MAAO,CAAA,OAAA,CAAQ,cAAc,CAAE,CAAA,MAAA;AAAA,MAC7B,CAAC,GAAA,EAAK,CAAC,GAAA,EAAK,KAAK,CAAM,KAAA;AACrB,QAAA,IAAI,SAAS,IAAM,EAAA;AACjB,UAAI,GAAA,CAAA,GAAG,CAAI,GAAA,CAAA,EAAG,KAAK,CAAA,CAAA;AAAA;AAGrB,QAAO,OAAA,GAAA;AAAA,OACT;AAAA,MACA;AAAC,KACH,GACA,iBAAkB,CAAA,cAAA,EAAqB,MAAM;AAAA,GACnD;AACF","file":"css.js","sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport kebabCase from 'lodash/kebabCase';\nimport { layers } from '../styles';\nimport type { GlobalStyleRule, StyleRule } from '@vanilla-extract/css';\nimport type {\n Contract,\n CssVarFunction,\n MapLeafNodes,\n PartialMapLeafNodes,\n Primitive,\n RGBA,\n} from '../types';\nimport {\n pixelValueAsStringValidator,\n rgbaAsStringValidator,\n} from './validators';\n\n/**\n * Parse out CSS var name from CSS var implementation\n *\n * @example\n * unwrapCssVar('var(--foo)')\n * // returns '--foo'\n *\n * @example\n * unwrapCssVar('var(--foo, blue)')\n * // returns '--foo'\n *\n * @example\n * unwrapCssVar('var(--foo, var(--bar))')\n * // returns '--foo'\n */\nexport function unwrapCssVar(cssVar: string) {\n return cssVar.replace(/^var\\((--[\\w-]+)[^\\w-]+.*/i, '$1');\n}\n\ntype FulfilledContract<T> = MapLeafNodes<T, null | number | string | RGBA>;\n\n// TODO: remove if possible\n// NOTE: had to create a generic version not bound to type of T because of type issues around setting values on accumulator\ntype GenericFulfilledContract = {\n [key: string]: GenericFulfilledContract | null | number | string | RGBA;\n};\n\n/**\n * Convert contract to nested object of identical shape with computed CSS values\n * Pixel values are converted to numbers\n * RGB(A) values are converted to DeckGL compatible tuples\n * All other values are left unconverted\n */\nexport function computeContract<T extends Contract>(\n contract: T,\n css: CSSStyleDeclaration,\n): FulfilledContract<T> {\n return Object.entries(contract).reduce<GenericFulfilledContract>(\n (acc, [key, cssVarOrContract]) => {\n if (cssVarOrContract == null) {\n acc[key] = null;\n\n return acc;\n }\n\n if (typeof cssVarOrContract === 'object') {\n acc[key] = computeContract(cssVarOrContract, css);\n\n return acc;\n }\n\n const cssVar = unwrapCssVar(cssVarOrContract);\n const value = css.getPropertyValue(cssVar);\n const pixel = pixelValueAsStringValidator.safeParse(value);\n\n if (pixel.success) {\n acc[key] = pixel.data;\n\n return acc;\n }\n\n const rgba = rgbaAsStringValidator.safeParse(value);\n\n if (rgba.success) {\n acc[key] = rgba.data;\n\n return acc;\n }\n\n acc[key] = value ?? null;\n\n return acc;\n },\n {},\n ) as FulfilledContract<T>;\n}\n\n/**\n * Convert potentially nested contract and values pair into flattened CSS var record\n * The contract provides a lookup for CSS vars\n * The values are expected to partially match the contract shapeForm\n */\nexport function reduceContract<T extends Contract, U>(\n contract: T,\n values: PartialMapLeafNodes<T, U>,\n) {\n const nodes: { contract: Contract; values: PartialMapLeafNodes<T, U> }[] = [\n { contract, values },\n ];\n\n const vars: Record<CssVarFunction, U> = {};\n\n for (let node of nodes) {\n Object.entries(node.values).forEach(([key, value]: [string, U]) => {\n const cssVarOrSubContract = node.contract[key];\n\n if (cssVarOrSubContract == null || value == null) {\n return;\n }\n\n if (\n typeof cssVarOrSubContract === 'string' &&\n (typeof value !== 'object' || Array.isArray(value))\n ) {\n vars[cssVarOrSubContract] = value;\n\n return;\n }\n\n if (\n typeof cssVarOrSubContract === 'object' &&\n typeof value === 'object'\n ) {\n nodes.push({ contract: cssVarOrSubContract, values: value });\n }\n });\n }\n\n return vars;\n}\n\n/**\n * Reduce contract and values into Vanilla Extract friendly CSS vars\n */\nexport function assignPartialVars<T extends Contract>(\n contract: T,\n values: PartialMapLeafNodes<T, Primitive>,\n) {\n return Object.fromEntries(\n Object.entries(reduceContract(contract, values)).map(([key, value]) => [\n key,\n `${value}`,\n ]),\n );\n}\n\ntype CssVarValues = {\n [key: string]: CssVarValues | Primitive;\n};\n\ntype CssVarValueOptions<T extends object> = {\n [P in keyof T]?: T[P] extends object\n ? CssVarValueOptions<T[P]>\n : T[P] | T[P][];\n};\n\ntype Operators = 'and' | 'or';\n\ntype ContainerQueryOptions = {\n container?: string;\n operator?: Operators;\n maxHeight?: string;\n minHeight?: string;\n maxWidth?: string;\n minWidth?: string;\n};\n\ntype ContainerQueryValues<T extends CssVarValues> = CssVarValueOptions<T> &\n ContainerQueryOptions;\n\ntype MultiContainerQuery<T extends CssVarValues> = {\n operator?: Operators;\n groups: ContainerQueryValues<T>[];\n};\n\n/**\n * Handle creation of query groups based on options and values\n * Internal to containerQueries\n */\nfunction processConditions<T extends CssVarValues>(\n contract: MapLeafNodes<Omit<T, keyof ContainerQueryOptions>, CssVarFunction>,\n values: ContainerQueryValues<T>,\n) {\n return Object.entries(\n reduceContract(\n {\n ...contract,\n maxHeight: 'maxHeight', // NOTE: Passthrough these values not as CSS vars\n minHeight: 'minHeight',\n maxWidth: 'maxWidth',\n minWidth: 'minWidth',\n },\n values as PartialMapLeafNodes<\n MapLeafNodes<Omit<T, keyof ContainerQueryOptions>, CssVarFunction>,\n ContainerQueryValues<T>[string]\n >,\n ),\n ).reduce<string[]>((acc, [key, value]) => {\n if (key === 'container' || key === 'operator' || value == null) {\n return acc;\n }\n\n const isStyle = !/^(?:max|min)(?:Height|Width)$/.test(key);\n const prefix = isStyle ? 'style' : '';\n const prop = isStyle ? unwrapCssVar(key) : kebabCase(key);\n\n if (Array.isArray(value)) {\n const group = value.reduce<string[]>((ac, val) => {\n if (val != null) {\n ac.push(`${prefix}(${prop}: ${val})`);\n }\n\n return ac;\n }, []);\n\n acc.push(`(${group.join(' or ')})`);\n } else {\n acc.push(`${prefix}(${prop}: ${value})`);\n }\n\n return acc;\n }, []);\n}\n\nfunction isMultiQuery<T extends CssVarValues>(\n value: unknown,\n): value is MultiContainerQuery<T> {\n return (\n value != null &&\n typeof value === 'object' &&\n (!('operator' in value) ||\n ('operator' in value &&\n (value.operator === 'and' || value.operator === 'or'))) &&\n 'groups' in value &&\n Array.isArray(value.groups) &&\n value.groups.every((group) => group != null && typeof group === 'object')\n );\n}\n\n/**\n * Create simple or complex container queries with and/or operators.\n *\n * To provide type safety and ease of use, this function accepts a generic and a contract\n * The generic type defines the possible values for the parameters defined within the contract\n *\n * Ex: containerQuery<{ foo: boolean }>({ foo: 'var(--foo)' }, { foo: true })\n *\n * By providing the type constraint and contract, the query parameters will have intellisense\n * on which parameters exist and what their possible values can be\n *\n * @example\n * containerQuery(contract, { a: true })\n * // returns (a: true)\n *\n * @example\n * containerQuery(contract, { a: true, b: true })\n * // returns (a: true) and (b: true)\n *\n * @example\n * containerQuery(contract, { operator: 'or', a: true, b: true })\n * // returns (a: true) or (b: true)\n *\n * @example\n * containerQuery(contract, { groups: [{ a: true }, { b: true }] })\n * // returns (a: true) or (b: true)\n *\n * @example\n * containerQuery(contract, { a: ['foo', 'bar'] })\n * // returns (a: 'foo') or (a: 'bar')\n *\n * @example\n * containerQuery(contract, { a: ['foo', 'bar'], b: true })\n * // returns ((a: 'foo') or (a: 'bar')) and (b: true)\n *\n * @example\n * containerQuery(contract, { operator: 'or', a: ['foo', 'bar'], b: true })\n * // returns ((a: 'foo') or (a: 'bar')) or (b: true)\n *\n * @example\n * containerQuery(contract, { groups: [{ a: true, b: true }, { c: true, d: true }] })\n * // returns ((a: true) and (b: true)) or ((c: true) and (d: true))\n *\n * @example\n * containerQuery(contract, { operator: 'and', groups: [{ operator: 'or', a: true, b: true }, { c: true, d: true }] })\n * // returns ((a: true) or (b: true)) and ((c: true) and (d: true))\n *\n * @example\n * containerQuery(contract, { operator: 'and', groups: [{ operator: 'or', a: true, b: true }, { operator: 'or', c: true, d: true }] })\n * // returns ((a: true) or (b: true)) and ((c: true) or (d: true))\n */\nexport function containerQuery<T extends CssVarValues = CssVarValues>(\n contract: MapLeafNodes<Omit<T, keyof ContainerQueryOptions>, CssVarFunction>,\n query: ContainerQueryValues<T> | MultiContainerQuery<T>,\n) {\n const isMultiGroup = isMultiQuery<T>(query);\n const groups = isMultiGroup ? query.groups : [query];\n const groupsOperator = ` ${(isMultiGroup ? query.operator : null) ?? 'or'} `;\n\n return groups\n .map((group, index) => {\n const operator = ` ${group.operator ?? 'and'} `;\n\n let container = group.container ?? '';\n\n if (index) {\n // Multiple container specifiers is not yet supported: https://github.com/w3c/csswg-drafts/issues/6876\n container = '';\n }\n\n const conditions = processConditions(contract, group);\n const isMultiCondition = groups.length > 1 && conditions.length > 1;\n\n return [\n container,\n container && ' ',\n isMultiCondition ? '(' : '',\n conditions.join(operator),\n isMultiCondition ? ')' : '',\n ].join('');\n })\n .join(groupsOperator);\n}\n\ntype ContainerStyle = Exclude<StyleRule['@container'], undefined>[string];\n\ntype ContainerQuery<T extends CssVarValues> = {\n query: ContainerQueryValues<T> | MultiContainerQuery<T>;\n};\n\ntype ContainerQueries<T extends CssVarValues> = ContainerStyle &\n ContainerQuery<T>;\n\ntype GlobalContainerStyle = Exclude<\n GlobalStyleRule['@container'],\n undefined\n>[string];\n\ntype GlobalContainerQueries<T extends CssVarValues> = GlobalContainerStyle &\n ContainerQuery<T>;\n\n/**\n * Bulk container query creation based on the same contract\n */\nexport function containerQueries<T extends CssVarValues = CssVarValues>(\n contract: MapLeafNodes<Omit<T, keyof ContainerQueryOptions>, CssVarFunction>,\n ...styles: ContainerQueries<T>[]\n): Record<string, ContainerStyle>;\n\nexport function containerQueries<T extends CssVarValues = CssVarValues>(\n contract: MapLeafNodes<Omit<T, keyof ContainerQueryOptions>, CssVarFunction>,\n ...styles: GlobalContainerQueries<T>[]\n): Record<string, GlobalContainerStyle>;\n\nexport function containerQueries<T extends CssVarValues = CssVarValues>(\n contract: MapLeafNodes<Omit<T, keyof ContainerQueryOptions>, CssVarFunction>,\n ...styles: ContainerQueries<T>[] | GlobalContainerQueries<T>[]\n): Record<string, ContainerStyle | GlobalContainerStyle> {\n return Object.fromEntries(\n styles.map(({ query, ...style }) => [\n containerQuery<T>(contract, query),\n style,\n ]),\n );\n}\n\ntype VarsOnlyContainerQuery<T extends CssVarValues> = Required<\n Pick<ContainerQueries<T>, 'query' | 'vars'>\n>;\n\ntype QueryOptionalVarsOnlyContainerQuery<T extends CssVarValues> = Partial<\n Pick<VarsOnlyContainerQuery<T>, 'query'>\n> &\n Pick<VarsOnlyContainerQuery<T>, 'vars'>;\n\n/**\n * Helper for establishing global theme variables with the restriction that\n * only variables may be set (and are required). All other styles must be\n * established using alternative utils\n *\n * The first style rule has an optional query. If the query is missing, the vars\n * are set outside of a container query\n */\nexport function applyThemeVars<T extends CssVarValues = CssVarValues>(\n contract: MapLeafNodes<Omit<T, keyof ContainerQueryOptions>, CssVarFunction>,\n styles:\n | [QueryOptionalVarsOnlyContainerQuery<T>, ...VarsOnlyContainerQuery<T>[]]\n | VarsOnlyContainerQuery<T>[],\n layer = layers.variables.l1,\n): StyleRule {\n const [style, ...rest] = styles;\n\n const stylesWithQueries = (\n !style.query ? rest : styles\n ) as VarsOnlyContainerQuery<T>[];\n\n return {\n '@layer': {\n [layer]: {\n ...(!style.query ? { vars: style.vars } : {}),\n ...(stylesWithQueries.length\n ? {\n '@container': containerQueries<T>(contract, ...stylesWithQueries),\n }\n : {}),\n },\n },\n };\n}\n\n/**\n * Runtime creation of inline style CSS vars that enable CSS container queries\n */\nexport function inlineVars(\n vars: Record<string, Primitive>,\n): Record<string, string>;\n\nexport function inlineVars<T extends Contract>(\n contract: T,\n values: PartialMapLeafNodes<T, Primitive>,\n): Record<string, string>;\n\nexport function inlineVars<T extends Contract>(\n varsOrContract: Record<string, Primitive> | T,\n values?: PartialMapLeafNodes<T, Primitive>,\n): Record<string, string> {\n return assignInlineVars(\n !values\n ? Object.entries(varsOrContract).reduce<Record<string, string>>(\n (acc, [key, value]) => {\n if (value != null) {\n acc[key] = `${value}`;\n }\n\n return acc;\n },\n {},\n )\n : assignPartialVars(varsOrContract as T, values),\n );\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type ContinuableEvent = {
|
|
2
|
+
continuePropagation: () => void;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* The default behavior of events within React Aria is to stop progagation
|
|
6
|
+
*
|
|
7
|
+
* To reenable propagation, continuePropagation must be called
|
|
8
|
+
*/
|
|
9
|
+
declare function continuePropagation(event: ContinuableEvent): void;
|
|
10
|
+
|
|
11
|
+
export { continuePropagation };
|