@puzzle-ui/ui 0.0.0-stage → 0.1.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 +16 -2
- package/dist/LICENSE +21 -0
- package/dist/components/actions/button/button-content.cjs +41 -0
- package/dist/components/actions/button/button-content.cjs.map +1 -0
- package/dist/components/actions/button/button-content.js +41 -0
- package/dist/components/actions/button/button-content.js.map +1 -0
- package/dist/components/actions/button/button.css +191 -0
- package/dist/components/actions/button/button.types.d.cts +30 -0
- package/dist/components/actions/button/button.types.d.ts +30 -0
- package/dist/components/actions/button/index.cjs +80 -0
- package/dist/components/actions/button/index.cjs.map +1 -0
- package/dist/components/actions/button/index.d.cts +3 -0
- package/dist/components/actions/button/index.d.ts +3 -0
- package/dist/components/actions/button/index.js +80 -0
- package/dist/components/actions/button/index.js.map +1 -0
- package/dist/components/actions/button-group/button-group.css +64 -0
- package/dist/components/actions/button-group/index.cjs +25 -0
- package/dist/components/actions/button-group/index.cjs.map +1 -0
- package/dist/components/actions/button-group/index.d.cts +14 -0
- package/dist/components/actions/button-group/index.d.ts +14 -0
- package/dist/components/actions/button-group/index.js +25 -0
- package/dist/components/actions/button-group/index.js.map +1 -0
- package/dist/components/actions/toggle-group/index.cjs +124 -0
- package/dist/components/actions/toggle-group/index.cjs.map +1 -0
- package/dist/components/actions/toggle-group/index.d.cts +10 -0
- package/dist/components/actions/toggle-group/index.d.ts +10 -0
- package/dist/components/actions/toggle-group/index.js +124 -0
- package/dist/components/actions/toggle-group/index.js.map +1 -0
- package/dist/components/actions/toggle-group/toggle-group.css +67 -0
- package/dist/components/actions/toggle-group/toggle-group.types.d.cts +54 -0
- package/dist/components/actions/toggle-group/toggle-group.types.d.ts +54 -0
- package/dist/components/data-display/alert/alert.css +128 -0
- package/dist/components/data-display/alert/alert.types.d.cts +14 -0
- package/dist/components/data-display/alert/alert.types.d.ts +14 -0
- package/dist/components/data-display/alert/alert.utils.cjs +11 -0
- package/dist/components/data-display/alert/alert.utils.cjs.map +1 -0
- package/dist/components/data-display/alert/alert.utils.js +11 -0
- package/dist/components/data-display/alert/alert.utils.js.map +1 -0
- package/dist/components/data-display/alert/index.cjs +103 -0
- package/dist/components/data-display/alert/index.cjs.map +1 -0
- package/dist/components/data-display/alert/index.d.cts +3 -0
- package/dist/components/data-display/alert/index.d.ts +3 -0
- package/dist/components/data-display/alert/index.js +103 -0
- package/dist/components/data-display/alert/index.js.map +1 -0
- package/dist/components/data-display/avatar/avatar.css +30 -0
- package/dist/components/data-display/avatar/index.cjs +42 -0
- package/dist/components/data-display/avatar/index.cjs.map +1 -0
- package/dist/components/data-display/avatar/index.d.cts +10 -0
- package/dist/components/data-display/avatar/index.d.ts +10 -0
- package/dist/components/data-display/avatar/index.js +42 -0
- package/dist/components/data-display/avatar/index.js.map +1 -0
- package/dist/components/data-display/badge/badge.css +91 -0
- package/dist/components/data-display/badge/index.cjs +31 -0
- package/dist/components/data-display/badge/index.cjs.map +1 -0
- package/dist/components/data-display/badge/index.d.cts +18 -0
- package/dist/components/data-display/badge/index.d.ts +18 -0
- package/dist/components/data-display/badge/index.js +31 -0
- package/dist/components/data-display/badge/index.js.map +1 -0
- package/dist/components/data-display/card/card.css +164 -0
- package/dist/components/data-display/card/index.cjs +42 -0
- package/dist/components/data-display/card/index.cjs.map +1 -0
- package/dist/components/data-display/card/index.d.cts +29 -0
- package/dist/components/data-display/card/index.d.ts +29 -0
- package/dist/components/data-display/card/index.js +35 -0
- package/dist/components/data-display/card/index.js.map +1 -0
- package/dist/components/data-display/image/image.css +80 -0
- package/dist/components/data-display/image/image.types.d.cts +154 -0
- package/dist/components/data-display/image/image.types.d.ts +154 -0
- package/dist/components/data-display/image/image.utils.cjs +55 -0
- package/dist/components/data-display/image/image.utils.cjs.map +1 -0
- package/dist/components/data-display/image/image.utils.js +51 -0
- package/dist/components/data-display/image/image.utils.js.map +1 -0
- package/dist/components/data-display/image/index.cjs +176 -0
- package/dist/components/data-display/image/index.cjs.map +1 -0
- package/dist/components/data-display/image/index.d.cts +3 -0
- package/dist/components/data-display/image/index.d.ts +3 -0
- package/dist/components/data-display/image/index.js +176 -0
- package/dist/components/data-display/image/index.js.map +1 -0
- package/dist/components/data-display/image/use-image-state.cjs +54 -0
- package/dist/components/data-display/image/use-image-state.cjs.map +1 -0
- package/dist/components/data-display/image/use-image-state.js +54 -0
- package/dist/components/data-display/image/use-image-state.js.map +1 -0
- package/dist/components/data-display/paper/index.cjs +16 -0
- package/dist/components/data-display/paper/index.cjs.map +1 -0
- package/dist/components/data-display/paper/index.d.cts +8 -0
- package/dist/components/data-display/paper/index.d.ts +8 -0
- package/dist/components/data-display/paper/index.js +16 -0
- package/dist/components/data-display/paper/index.js.map +1 -0
- package/dist/components/data-display/paper/paper.css +40 -0
- package/dist/components/data-display/progress/circular-progress.cjs +75 -0
- package/dist/components/data-display/progress/circular-progress.cjs.map +1 -0
- package/dist/components/data-display/progress/circular-progress.css +21 -0
- package/dist/components/data-display/progress/circular-progress.d.cts +9 -0
- package/dist/components/data-display/progress/circular-progress.d.ts +9 -0
- package/dist/components/data-display/progress/circular-progress.js +75 -0
- package/dist/components/data-display/progress/circular-progress.js.map +1 -0
- package/dist/components/data-display/progress/linear-progress.cjs +32 -0
- package/dist/components/data-display/progress/linear-progress.cjs.map +1 -0
- package/dist/components/data-display/progress/linear-progress.css +39 -0
- package/dist/components/data-display/progress/linear-progress.d.cts +5 -0
- package/dist/components/data-display/progress/linear-progress.d.ts +5 -0
- package/dist/components/data-display/progress/linear-progress.js +32 -0
- package/dist/components/data-display/progress/linear-progress.js.map +1 -0
- package/dist/components/data-display/progress/types.d.cts +5 -0
- package/dist/components/data-display/progress/types.d.ts +5 -0
- package/dist/components/data-display/progress/utils.cjs +16 -0
- package/dist/components/data-display/progress/utils.cjs.map +1 -0
- package/dist/components/data-display/progress/utils.js +15 -0
- package/dist/components/data-display/progress/utils.js.map +1 -0
- package/dist/components/data-display/skeleton/index.cjs +18 -0
- package/dist/components/data-display/skeleton/index.cjs.map +1 -0
- package/dist/components/data-display/skeleton/index.d.cts +10 -0
- package/dist/components/data-display/skeleton/index.d.ts +10 -0
- package/dist/components/data-display/skeleton/index.js +18 -0
- package/dist/components/data-display/skeleton/index.js.map +1 -0
- package/dist/components/data-display/skeleton/skeleton.css +47 -0
- package/dist/components/editors/text-editor/editor.cjs +620 -0
- package/dist/components/editors/text-editor/editor.cjs.map +1 -0
- package/dist/components/editors/text-editor/editor.d.cts +1 -0
- package/dist/components/editors/text-editor/editor.d.ts +1 -0
- package/dist/components/editors/text-editor/editor.js +620 -0
- package/dist/components/editors/text-editor/editor.js.map +1 -0
- package/dist/components/editors/text-editor/index.cjs +39 -0
- package/dist/components/editors/text-editor/index.cjs.map +1 -0
- package/dist/components/editors/text-editor/index.d.cts +13 -0
- package/dist/components/editors/text-editor/index.d.ts +13 -0
- package/dist/components/editors/text-editor/index.js +38 -0
- package/dist/components/editors/text-editor/index.js.map +1 -0
- package/dist/components/editors/text-editor/text-document.cjs +406 -0
- package/dist/components/editors/text-editor/text-document.cjs.map +1 -0
- package/dist/components/editors/text-editor/text-document.js +391 -0
- package/dist/components/editors/text-editor/text-document.js.map +1 -0
- package/dist/components/editors/text-editor/text-editor-toolbar.cjs +251 -0
- package/dist/components/editors/text-editor/text-editor-toolbar.cjs.map +1 -0
- package/dist/components/editors/text-editor/text-editor-toolbar.css +16 -0
- package/dist/components/editors/text-editor/text-editor-toolbar.d.cts +7 -0
- package/dist/components/editors/text-editor/text-editor-toolbar.d.ts +7 -0
- package/dist/components/editors/text-editor/text-editor-toolbar.js +251 -0
- package/dist/components/editors/text-editor/text-editor-toolbar.js.map +1 -0
- package/dist/components/editors/text-editor/text-editor.css +116 -0
- package/dist/components/editors/text-editor/text-editor.types.d.cts +37 -0
- package/dist/components/editors/text-editor/text-editor.types.d.ts +37 -0
- package/dist/components/editors/text-editor/text-parser.cjs +262 -0
- package/dist/components/editors/text-editor/text-parser.cjs.map +1 -0
- package/dist/components/editors/text-editor/text-parser.js +261 -0
- package/dist/components/editors/text-editor/text-parser.js.map +1 -0
- package/dist/components/editors/text-editor/text-renderer.cjs +85 -0
- package/dist/components/editors/text-editor/text-renderer.cjs.map +1 -0
- package/dist/components/editors/text-editor/text-renderer.d.cts +7 -0
- package/dist/components/editors/text-editor/text-renderer.d.ts +7 -0
- package/dist/components/editors/text-editor/text-renderer.js +85 -0
- package/dist/components/editors/text-editor/text-renderer.js.map +1 -0
- package/dist/components/forms/autocomplete/autocomplete.css +384 -0
- package/dist/components/forms/autocomplete/autocomplete.types.d.cts +86 -0
- package/dist/components/forms/autocomplete/autocomplete.types.d.ts +86 -0
- package/dist/components/forms/autocomplete/autocomplete.utils.cjs +47 -0
- package/dist/components/forms/autocomplete/autocomplete.utils.cjs.map +1 -0
- package/dist/components/forms/autocomplete/autocomplete.utils.js +44 -0
- package/dist/components/forms/autocomplete/autocomplete.utils.js.map +1 -0
- package/dist/components/forms/autocomplete/index.cjs +532 -0
- package/dist/components/forms/autocomplete/index.cjs.map +1 -0
- package/dist/components/forms/autocomplete/index.d.cts +3 -0
- package/dist/components/forms/autocomplete/index.d.ts +3 -0
- package/dist/components/forms/autocomplete/index.js +532 -0
- package/dist/components/forms/autocomplete/index.js.map +1 -0
- package/dist/components/forms/checkbox/checkbox.css +146 -0
- package/dist/components/forms/checkbox/index.cjs +80 -0
- package/dist/components/forms/checkbox/index.cjs.map +1 -0
- package/dist/components/forms/checkbox/index.d.cts +20 -0
- package/dist/components/forms/checkbox/index.d.ts +20 -0
- package/dist/components/forms/checkbox/index.js +80 -0
- package/dist/components/forms/checkbox/index.js.map +1 -0
- package/dist/components/forms/date-picker/date-picker.css +478 -0
- package/dist/components/forms/date-picker/date-picker.types.d.cts +75 -0
- package/dist/components/forms/date-picker/date-picker.types.d.ts +75 -0
- package/dist/components/forms/date-picker/date-picker.utils.cjs +76 -0
- package/dist/components/forms/date-picker/date-picker.utils.cjs.map +1 -0
- package/dist/components/forms/date-picker/date-picker.utils.js +64 -0
- package/dist/components/forms/date-picker/date-picker.utils.js.map +1 -0
- package/dist/components/forms/date-picker/index.cjs +572 -0
- package/dist/components/forms/date-picker/index.cjs.map +1 -0
- package/dist/components/forms/date-picker/index.d.cts +3 -0
- package/dist/components/forms/date-picker/index.d.ts +3 -0
- package/dist/components/forms/date-picker/index.js +572 -0
- package/dist/components/forms/date-picker/index.js.map +1 -0
- package/dist/components/forms/file-upload/file-upload.css +290 -0
- package/dist/components/forms/file-upload/file-upload.types.d.cts +51 -0
- package/dist/components/forms/file-upload/file-upload.types.d.ts +51 -0
- package/dist/components/forms/file-upload/file-upload.utils.cjs +76 -0
- package/dist/components/forms/file-upload/file-upload.utils.cjs.map +1 -0
- package/dist/components/forms/file-upload/file-upload.utils.js +72 -0
- package/dist/components/forms/file-upload/file-upload.utils.js.map +1 -0
- package/dist/components/forms/file-upload/index.cjs +346 -0
- package/dist/components/forms/file-upload/index.cjs.map +1 -0
- package/dist/components/forms/file-upload/index.d.cts +3 -0
- package/dist/components/forms/file-upload/index.d.ts +3 -0
- package/dist/components/forms/file-upload/index.js +346 -0
- package/dist/components/forms/file-upload/index.js.map +1 -0
- package/dist/components/forms/form-field/form-field-state.cjs +25 -0
- package/dist/components/forms/form-field/form-field-state.cjs.map +1 -0
- package/dist/components/forms/form-field/form-field-state.js +25 -0
- package/dist/components/forms/form-field/form-field-state.js.map +1 -0
- package/dist/components/forms/form-field/form-field.css +44 -0
- package/dist/components/forms/form-field/index.cjs +61 -0
- package/dist/components/forms/form-field/index.cjs.map +1 -0
- package/dist/components/forms/form-field/index.d.cts +23 -0
- package/dist/components/forms/form-field/index.d.ts +23 -0
- package/dist/components/forms/form-field/index.js +61 -0
- package/dist/components/forms/form-field/index.js.map +1 -0
- package/dist/components/forms/input/index.d.cts +4 -0
- package/dist/components/forms/input/index.d.ts +4 -0
- package/dist/components/forms/input/input.css +153 -0
- package/dist/components/forms/input/number-input.cjs +192 -0
- package/dist/components/forms/input/number-input.cjs.map +1 -0
- package/dist/components/forms/input/number-input.d.cts +20 -0
- package/dist/components/forms/input/number-input.d.ts +20 -0
- package/dist/components/forms/input/number-input.js +192 -0
- package/dist/components/forms/input/number-input.js.map +1 -0
- package/dist/components/forms/input/text-area-input.cjs +47 -0
- package/dist/components/forms/input/text-area-input.cjs.map +1 -0
- package/dist/components/forms/input/text-area-input.d.cts +8 -0
- package/dist/components/forms/input/text-area-input.d.ts +8 -0
- package/dist/components/forms/input/text-area-input.js +47 -0
- package/dist/components/forms/input/text-area-input.js.map +1 -0
- package/dist/components/forms/input/text-input.cjs +47 -0
- package/dist/components/forms/input/text-input.cjs.map +1 -0
- package/dist/components/forms/input/text-input.d.cts +9 -0
- package/dist/components/forms/input/text-input.d.ts +9 -0
- package/dist/components/forms/input/text-input.js +47 -0
- package/dist/components/forms/input/text-input.js.map +1 -0
- package/dist/components/forms/label/index.cjs +26 -0
- package/dist/components/forms/label/index.cjs.map +1 -0
- package/dist/components/forms/label/index.d.cts +8 -0
- package/dist/components/forms/label/index.d.ts +8 -0
- package/dist/components/forms/label/index.js +26 -0
- package/dist/components/forms/label/index.js.map +1 -0
- package/dist/components/forms/label/label.css +22 -0
- package/dist/components/forms/radio-group/index.cjs +226 -0
- package/dist/components/forms/radio-group/index.cjs.map +1 -0
- package/dist/components/forms/radio-group/index.d.cts +5 -0
- package/dist/components/forms/radio-group/index.d.ts +5 -0
- package/dist/components/forms/radio-group/index.js +225 -0
- package/dist/components/forms/radio-group/index.js.map +1 -0
- package/dist/components/forms/radio-group/radio-group.css +222 -0
- package/dist/components/forms/radio-group/radio-group.types.d.cts +51 -0
- package/dist/components/forms/radio-group/radio-group.types.d.ts +51 -0
- package/dist/components/forms/radio-group/radio-group.utils.cjs +22 -0
- package/dist/components/forms/radio-group/radio-group.utils.cjs.map +1 -0
- package/dist/components/forms/radio-group/radio-group.utils.js +21 -0
- package/dist/components/forms/radio-group/radio-group.utils.js.map +1 -0
- package/dist/components/forms/select/index.cjs +468 -0
- package/dist/components/forms/select/index.cjs.map +1 -0
- package/dist/components/forms/select/index.d.cts +112 -0
- package/dist/components/forms/select/index.d.ts +112 -0
- package/dist/components/forms/select/index.js +468 -0
- package/dist/components/forms/select/index.js.map +1 -0
- package/dist/components/forms/select/select.css +363 -0
- package/dist/components/forms/slider/index.cjs +93 -0
- package/dist/components/forms/slider/index.cjs.map +1 -0
- package/dist/components/forms/slider/index.d.cts +37 -0
- package/dist/components/forms/slider/index.d.ts +37 -0
- package/dist/components/forms/slider/index.js +93 -0
- package/dist/components/forms/slider/index.js.map +1 -0
- package/dist/components/forms/slider/slider.css +202 -0
- package/dist/components/forms/stepper/index.cjs +113 -0
- package/dist/components/forms/stepper/index.cjs.map +1 -0
- package/dist/components/forms/stepper/index.d.cts +48 -0
- package/dist/components/forms/stepper/index.d.ts +48 -0
- package/dist/components/forms/stepper/index.js +113 -0
- package/dist/components/forms/stepper/index.js.map +1 -0
- package/dist/components/forms/stepper/stepper.css +241 -0
- package/dist/components/forms/switch/index.cjs +45 -0
- package/dist/components/forms/switch/index.cjs.map +1 -0
- package/dist/components/forms/switch/index.d.cts +11 -0
- package/dist/components/forms/switch/index.d.ts +11 -0
- package/dist/components/forms/switch/index.js +45 -0
- package/dist/components/forms/switch/index.js.map +1 -0
- package/dist/components/forms/switch/switch.css +142 -0
- package/dist/components/layout/app-bar/app-bar.css +197 -0
- package/dist/components/layout/app-bar/index.cjs +150 -0
- package/dist/components/layout/app-bar/index.cjs.map +1 -0
- package/dist/components/layout/app-bar/index.d.cts +21 -0
- package/dist/components/layout/app-bar/index.d.ts +21 -0
- package/dist/components/layout/app-bar/index.js +150 -0
- package/dist/components/layout/app-bar/index.js.map +1 -0
- package/dist/components/layout/background/background.css +160 -0
- package/dist/components/layout/background/index.cjs +34 -0
- package/dist/components/layout/background/index.cjs.map +1 -0
- package/dist/components/layout/background/index.d.cts +23 -0
- package/dist/components/layout/background/index.d.ts +23 -0
- package/dist/components/layout/background/index.js +34 -0
- package/dist/components/layout/background/index.js.map +1 -0
- package/dist/components/layout/bottom-navigation/bottom-navigation.css +108 -0
- package/dist/components/layout/bottom-navigation/index.cjs +51 -0
- package/dist/components/layout/bottom-navigation/index.cjs.map +1 -0
- package/dist/components/layout/bottom-navigation/index.d.cts +19 -0
- package/dist/components/layout/bottom-navigation/index.d.ts +19 -0
- package/dist/components/layout/bottom-navigation/index.js +50 -0
- package/dist/components/layout/bottom-navigation/index.js.map +1 -0
- package/dist/components/layout/breadcrumbs/breadcrumbs.css +80 -0
- package/dist/components/layout/breadcrumbs/index.cjs +38 -0
- package/dist/components/layout/breadcrumbs/index.cjs.map +1 -0
- package/dist/components/layout/breadcrumbs/index.d.cts +18 -0
- package/dist/components/layout/breadcrumbs/index.d.ts +18 -0
- package/dist/components/layout/breadcrumbs/index.js +38 -0
- package/dist/components/layout/breadcrumbs/index.js.map +1 -0
- package/dist/components/layout/collapsable-sidebar/collapsable-sidebar.css +240 -0
- package/dist/components/layout/collapsable-sidebar/index.cjs +107 -0
- package/dist/components/layout/collapsable-sidebar/index.cjs.map +1 -0
- package/dist/components/layout/collapsable-sidebar/index.d.cts +35 -0
- package/dist/components/layout/collapsable-sidebar/index.d.ts +35 -0
- package/dist/components/layout/collapsable-sidebar/index.js +107 -0
- package/dist/components/layout/collapsable-sidebar/index.js.map +1 -0
- package/dist/components/layout/container/container.css +24 -0
- package/dist/components/layout/container/container.utils.cjs +11 -0
- package/dist/components/layout/container/container.utils.cjs.map +1 -0
- package/dist/components/layout/container/container.utils.d.cts +1 -0
- package/dist/components/layout/container/container.utils.d.ts +1 -0
- package/dist/components/layout/container/container.utils.js +11 -0
- package/dist/components/layout/container/container.utils.js.map +1 -0
- package/dist/components/layout/container/index.cjs +17 -0
- package/dist/components/layout/container/index.cjs.map +1 -0
- package/dist/components/layout/container/index.d.cts +11 -0
- package/dist/components/layout/container/index.d.ts +11 -0
- package/dist/components/layout/container/index.js +17 -0
- package/dist/components/layout/container/index.js.map +1 -0
- package/dist/components/layout/page-layout/index.cjs +80 -0
- package/dist/components/layout/page-layout/index.cjs.map +1 -0
- package/dist/components/layout/page-layout/index.d.cts +61 -0
- package/dist/components/layout/page-layout/index.d.ts +61 -0
- package/dist/components/layout/page-layout/index.js +80 -0
- package/dist/components/layout/page-layout/index.js.map +1 -0
- package/dist/components/layout/page-layout/page-layout.css +88 -0
- package/dist/components/layout/section/index.cjs +15 -0
- package/dist/components/layout/section/index.cjs.map +1 -0
- package/dist/components/layout/section/index.d.cts +2 -0
- package/dist/components/layout/section/index.d.ts +2 -0
- package/dist/components/layout/section/index.js +15 -0
- package/dist/components/layout/section/index.js.map +1 -0
- package/dist/components/layout/section/section.css +71 -0
- package/dist/components/layout/section/types.d.cts +13 -0
- package/dist/components/layout/section/types.d.ts +13 -0
- package/dist/components/layout/section-stack/index.cjs +29 -0
- package/dist/components/layout/section-stack/index.cjs.map +1 -0
- package/dist/components/layout/section-stack/index.d.cts +8 -0
- package/dist/components/layout/section-stack/index.d.ts +8 -0
- package/dist/components/layout/section-stack/index.js +29 -0
- package/dist/components/layout/section-stack/index.js.map +1 -0
- package/dist/components/layout/sidebar/index.cjs +16 -0
- package/dist/components/layout/sidebar/index.cjs.map +1 -0
- package/dist/components/layout/sidebar/index.d.cts +7 -0
- package/dist/components/layout/sidebar/index.d.ts +7 -0
- package/dist/components/layout/sidebar/index.js +16 -0
- package/dist/components/layout/sidebar/index.js.map +1 -0
- package/dist/components/layout/sidebar/sidebar.css +21 -0
- package/dist/components/layout/stack/index.cjs +30 -0
- package/dist/components/layout/stack/index.cjs.map +1 -0
- package/dist/components/layout/stack/index.d.cts +31 -0
- package/dist/components/layout/stack/index.d.ts +31 -0
- package/dist/components/layout/stack/index.js +30 -0
- package/dist/components/layout/stack/index.js.map +1 -0
- package/dist/components/layout/stack/stack.css +303 -0
- package/dist/components/navigation/accordion/accordion.css +97 -0
- package/dist/components/navigation/accordion/index.cjs +107 -0
- package/dist/components/navigation/accordion/index.cjs.map +1 -0
- package/dist/components/navigation/accordion/index.d.cts +48 -0
- package/dist/components/navigation/accordion/index.d.ts +48 -0
- package/dist/components/navigation/accordion/index.js +107 -0
- package/dist/components/navigation/accordion/index.js.map +1 -0
- package/dist/components/navigation/carousel/carousel.css +283 -0
- package/dist/components/navigation/carousel/controller.cjs +46 -0
- package/dist/components/navigation/carousel/controller.cjs.map +1 -0
- package/dist/components/navigation/carousel/controller.d.cts +16 -0
- package/dist/components/navigation/carousel/controller.d.ts +16 -0
- package/dist/components/navigation/carousel/controller.js +45 -0
- package/dist/components/navigation/carousel/controller.js.map +1 -0
- package/dist/components/navigation/carousel/index.cjs +494 -0
- package/dist/components/navigation/carousel/index.cjs.map +1 -0
- package/dist/components/navigation/carousel/index.d.cts +27 -0
- package/dist/components/navigation/carousel/index.d.ts +27 -0
- package/dist/components/navigation/carousel/index.js +494 -0
- package/dist/components/navigation/carousel/index.js.map +1 -0
- package/dist/components/navigation/link/index.cjs +40 -0
- package/dist/components/navigation/link/index.cjs.map +1 -0
- package/dist/components/navigation/link/index.d.cts +3 -0
- package/dist/components/navigation/link/index.d.ts +3 -0
- package/dist/components/navigation/link/index.js +40 -0
- package/dist/components/navigation/link/index.js.map +1 -0
- package/dist/components/navigation/link/link.css +31 -0
- package/dist/components/navigation/link/types.d.cts +12 -0
- package/dist/components/navigation/link/types.d.ts +12 -0
- package/dist/components/navigation/tabs/index.cjs +111 -0
- package/dist/components/navigation/tabs/index.cjs.map +1 -0
- package/dist/components/navigation/tabs/index.d.cts +30 -0
- package/dist/components/navigation/tabs/index.d.ts +30 -0
- package/dist/components/navigation/tabs/index.js +110 -0
- package/dist/components/navigation/tabs/index.js.map +1 -0
- package/dist/components/navigation/tabs/tabs.css +216 -0
- package/dist/components/navigation/tree-view/index.cjs +455 -0
- package/dist/components/navigation/tree-view/index.cjs.map +1 -0
- package/dist/components/navigation/tree-view/index.d.cts +96 -0
- package/dist/components/navigation/tree-view/index.d.ts +96 -0
- package/dist/components/navigation/tree-view/index.js +455 -0
- package/dist/components/navigation/tree-view/index.js.map +1 -0
- package/dist/components/navigation/tree-view/tree-view.css +258 -0
- package/dist/components/overlays/backdrop/backdrop.css +10 -0
- package/dist/components/overlays/backdrop/index.cjs +70 -0
- package/dist/components/overlays/backdrop/index.cjs.map +1 -0
- package/dist/components/overlays/backdrop/index.d.cts +12 -0
- package/dist/components/overlays/backdrop/index.d.ts +12 -0
- package/dist/components/overlays/backdrop/index.js +70 -0
- package/dist/components/overlays/backdrop/index.js.map +1 -0
- package/dist/components/overlays/command/command.css +154 -0
- package/dist/components/overlays/command/command.types.d.cts +36 -0
- package/dist/components/overlays/command/command.types.d.ts +36 -0
- package/dist/components/overlays/command/command.utils.cjs +39 -0
- package/dist/components/overlays/command/command.utils.cjs.map +1 -0
- package/dist/components/overlays/command/command.utils.js +35 -0
- package/dist/components/overlays/command/command.utils.js.map +1 -0
- package/dist/components/overlays/command/index.cjs +274 -0
- package/dist/components/overlays/command/index.cjs.map +1 -0
- package/dist/components/overlays/command/index.d.cts +4 -0
- package/dist/components/overlays/command/index.d.ts +4 -0
- package/dist/components/overlays/command/index.js +273 -0
- package/dist/components/overlays/command/index.js.map +1 -0
- package/dist/components/overlays/dialog/dialog.css +121 -0
- package/dist/components/overlays/dialog/index.cjs +80 -0
- package/dist/components/overlays/dialog/index.cjs.map +1 -0
- package/dist/components/overlays/dialog/index.d.cts +35 -0
- package/dist/components/overlays/dialog/index.d.ts +35 -0
- package/dist/components/overlays/dialog/index.js +80 -0
- package/dist/components/overlays/dialog/index.js.map +1 -0
- package/dist/components/overlays/drawer/drawer.css +133 -0
- package/dist/components/overlays/drawer/index.cjs +90 -0
- package/dist/components/overlays/drawer/index.cjs.map +1 -0
- package/dist/components/overlays/drawer/index.d.cts +11 -0
- package/dist/components/overlays/drawer/index.d.ts +11 -0
- package/dist/components/overlays/drawer/index.js +90 -0
- package/dist/components/overlays/drawer/index.js.map +1 -0
- package/dist/components/overlays/drawer/use-resize-bar.cjs +152 -0
- package/dist/components/overlays/drawer/use-resize-bar.cjs.map +1 -0
- package/dist/components/overlays/drawer/use-resize-bar.js +152 -0
- package/dist/components/overlays/drawer/use-resize-bar.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-content.cjs +120 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-content.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-content.d.cts +3 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-content.d.ts +3 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-content.js +120 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-content.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-items.cjs +136 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-items.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-items.d.cts +7 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-items.d.ts +7 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-items.js +132 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-items.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-radio.cjs +76 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-radio.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-radio.d.cts +4 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-radio.d.ts +4 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-radio.js +75 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-radio.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-trigger.cjs +96 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-trigger.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-trigger.d.cts +3 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-trigger.d.ts +3 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-trigger.js +96 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-trigger.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.cjs +111 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.context.cjs +21 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.context.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.context.js +18 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.context.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.css +127 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.d.cts +3 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.d.ts +3 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.js +111 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.types.d.cts +66 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.types.d.ts +66 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.utils.cjs +44 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.utils.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.utils.js +39 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.utils.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/index.cjs +31 -0
- package/dist/components/overlays/dropdown-menu/index.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/index.d.cts +19 -0
- package/dist/components/overlays/dropdown-menu/index.d.ts +19 -0
- package/dist/components/overlays/dropdown-menu/index.js +22 -0
- package/dist/components/overlays/dropdown-menu/index.js.map +1 -0
- package/dist/components/overlays/floating-position/calculate-position.cjs +94 -0
- package/dist/components/overlays/floating-position/calculate-position.cjs.map +1 -0
- package/dist/components/overlays/floating-position/calculate-position.js +89 -0
- package/dist/components/overlays/floating-position/calculate-position.js.map +1 -0
- package/dist/components/overlays/floating-position/use-floating-position.cjs +89 -0
- package/dist/components/overlays/floating-position/use-floating-position.cjs.map +1 -0
- package/dist/components/overlays/floating-position/use-floating-position.js +89 -0
- package/dist/components/overlays/floating-position/use-floating-position.js.map +1 -0
- package/dist/components/overlays/notification/index.cjs +142 -0
- package/dist/components/overlays/notification/index.cjs.map +1 -0
- package/dist/components/overlays/notification/index.d.cts +16 -0
- package/dist/components/overlays/notification/index.d.ts +16 -0
- package/dist/components/overlays/notification/index.js +139 -0
- package/dist/components/overlays/notification/index.js.map +1 -0
- package/dist/components/overlays/notification/notification-provider.cjs +69 -0
- package/dist/components/overlays/notification/notification-provider.cjs.map +1 -0
- package/dist/components/overlays/notification/notification-provider.d.cts +3 -0
- package/dist/components/overlays/notification/notification-provider.d.ts +3 -0
- package/dist/components/overlays/notification/notification-provider.js +68 -0
- package/dist/components/overlays/notification/notification-provider.js.map +1 -0
- package/dist/components/overlays/notification/notification.css +172 -0
- package/dist/components/overlays/notification/notification.types.d.cts +41 -0
- package/dist/components/overlays/notification/notification.types.d.ts +41 -0
- package/dist/components/overlays/notification/notification.utils.cjs +23 -0
- package/dist/components/overlays/notification/notification.utils.cjs.map +1 -0
- package/dist/components/overlays/notification/notification.utils.js +22 -0
- package/dist/components/overlays/notification/notification.utils.js.map +1 -0
- package/dist/components/overlays/notification/use-notification.cjs +12 -0
- package/dist/components/overlays/notification/use-notification.cjs.map +1 -0
- package/dist/components/overlays/notification/use-notification.d.cts +3 -0
- package/dist/components/overlays/notification/use-notification.d.ts +3 -0
- package/dist/components/overlays/notification/use-notification.js +12 -0
- package/dist/components/overlays/notification/use-notification.js.map +1 -0
- package/dist/components/overlays/overlay-stack/index.cjs +195 -0
- package/dist/components/overlays/overlay-stack/index.cjs.map +1 -0
- package/dist/components/overlays/overlay-stack/index.js +193 -0
- package/dist/components/overlays/overlay-stack/index.js.map +1 -0
- package/dist/components/overlays/popout/index.cjs +190 -0
- package/dist/components/overlays/popout/index.cjs.map +1 -0
- package/dist/components/overlays/popout/index.d.cts +26 -0
- package/dist/components/overlays/popout/index.d.ts +26 -0
- package/dist/components/overlays/popout/index.js +190 -0
- package/dist/components/overlays/popout/index.js.map +1 -0
- package/dist/components/overlays/popout/popout.css +15 -0
- package/dist/components/overlays/popover/index.cjs +163 -0
- package/dist/components/overlays/popover/index.cjs.map +1 -0
- package/dist/components/overlays/popover/index.d.cts +28 -0
- package/dist/components/overlays/popover/index.d.ts +28 -0
- package/dist/components/overlays/popover/index.js +163 -0
- package/dist/components/overlays/popover/index.js.map +1 -0
- package/dist/components/overlays/popover/popover.css +56 -0
- package/dist/components/overlays/portal/index.cjs +33 -0
- package/dist/components/overlays/portal/index.cjs.map +1 -0
- package/dist/components/overlays/portal/index.d.cts +15 -0
- package/dist/components/overlays/portal/index.d.ts +15 -0
- package/dist/components/overlays/portal/index.js +33 -0
- package/dist/components/overlays/portal/index.js.map +1 -0
- package/dist/components/overlays/portal/target.cjs +17 -0
- package/dist/components/overlays/portal/target.cjs.map +1 -0
- package/dist/components/overlays/portal/target.css +3 -0
- package/dist/components/overlays/portal/target.d.cts +7 -0
- package/dist/components/overlays/portal/target.d.ts +7 -0
- package/dist/components/overlays/portal/target.js +17 -0
- package/dist/components/overlays/portal/target.js.map +1 -0
- package/dist/components/overlays/tooltip/index.cjs +71 -0
- package/dist/components/overlays/tooltip/index.cjs.map +1 -0
- package/dist/components/overlays/tooltip/index.d.cts +24 -0
- package/dist/components/overlays/tooltip/index.d.ts +24 -0
- package/dist/components/overlays/tooltip/index.js +71 -0
- package/dist/components/overlays/tooltip/index.js.map +1 -0
- package/dist/components/overlays/tooltip/tooltip.css +67 -0
- package/dist/components/typography/heading.cjs +14 -0
- package/dist/components/typography/heading.cjs.map +1 -0
- package/dist/components/typography/heading.d.cts +11 -0
- package/dist/components/typography/heading.d.ts +11 -0
- package/dist/components/typography/heading.js +14 -0
- package/dist/components/typography/heading.js.map +1 -0
- package/dist/components/typography/text.cjs +14 -0
- package/dist/components/typography/text.cjs.map +1 -0
- package/dist/components/typography/text.d.cts +12 -0
- package/dist/components/typography/text.d.ts +12 -0
- package/dist/components/typography/text.js +14 -0
- package/dist/components/typography/text.js.map +1 -0
- package/dist/components/utilities/preview/highlight.cjs +79 -0
- package/dist/components/utilities/preview/highlight.cjs.map +1 -0
- package/dist/components/utilities/preview/highlight.js +79 -0
- package/dist/components/utilities/preview/highlight.js.map +1 -0
- package/dist/components/utilities/preview/index.cjs +391 -0
- package/dist/components/utilities/preview/index.cjs.map +1 -0
- package/dist/components/utilities/preview/index.d.cts +20 -0
- package/dist/components/utilities/preview/index.d.ts +20 -0
- package/dist/components/utilities/preview/index.js +391 -0
- package/dist/components/utilities/preview/index.js.map +1 -0
- package/dist/components/utilities/preview/preview.css +268 -0
- package/dist/components/utilities/scroll-lock/index.cjs +124 -0
- package/dist/components/utilities/scroll-lock/index.cjs.map +1 -0
- package/dist/components/utilities/scroll-lock/index.d.cts +6 -0
- package/dist/components/utilities/scroll-lock/index.d.ts +6 -0
- package/dist/components/utilities/scroll-lock/index.js +124 -0
- package/dist/components/utilities/scroll-lock/index.js.map +1 -0
- package/dist/components/utilities/transition/index.cjs +171 -0
- package/dist/components/utilities/transition/index.cjs.map +1 -0
- package/dist/components/utilities/transition/index.d.cts +27 -0
- package/dist/components/utilities/transition/index.d.ts +27 -0
- package/dist/components/utilities/transition/index.js +171 -0
- package/dist/components/utilities/transition/index.js.map +1 -0
- package/dist/components/utilities/transition/transition.css +130 -0
- package/dist/index.cjs +155 -0
- package/dist/index.d.cts +85 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +69 -0
- package/package.json +65 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.cjs","names":["cn"],"sources":["../../../src/components/typography/text.tsx"],"sourcesContent":["import { cn } from \"@puzzle-ui/core\";\nimport type { TypographyStyle } from \"@puzzle-ui/theme\";\nimport type { ComponentPropsWithRef, ElementType } from \"react\";\n\ntype TextType = Omit<\n TypographyStyle,\n \"headline1\" | \"headline2\" | \"headline3\" | \"headline4\"\n>;\n\ntype PolymorphicProps<E extends ElementType, OwnProps> = OwnProps & {\n as?: E;\n} & Omit<ComponentPropsWithRef<E>, keyof OwnProps | \"as\">;\n\ntype TextOwnProps = {\n type?: TextType;\n};\n\ntype TextProps<E extends ElementType = \"span\"> = PolymorphicProps<\n E,\n TextOwnProps\n>;\n\nconst Text = <E extends ElementType = \"span\">({\n as,\n type = \"body1\",\n className,\n ...props\n}: TextProps<E>) => {\n const Component = as ?? \"span\";\n const classes = cn(\"puzzle-text\", `puzzle-typography-${type}`, className);\n return <Component {...props} className={classes}></Component>;\n};\n\nexport { Text, type TextProps, type TextType };\n"],"mappings":";;;AAsBA,MAAM,QAAwC,EAC5C,IACA,OAAO,SACP,WACA,GAAG,YACe;CAClB,MAAM,YAAY,MAAM;CACxB,MAAM,WAAA,GAAUA,gBAAAA,GAAAA,CAAG,eAAe,qBAAqB,QAAQ,SAAS;CACxE,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;EAAW,GAAI;EAAO,WAAW;CAAoB,CAAA;AAC9D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ElementType } from "react";
|
|
2
|
+
import { TypographyStyle } from "@puzzle-ui/theme";
|
|
3
|
+
type TextType = Omit<TypographyStyle, "headline1" | "headline2" | "headline3" | "headline4">;
|
|
4
|
+
type PolymorphicProps<E extends ElementType, OwnProps> = OwnProps & {
|
|
5
|
+
as?: E;
|
|
6
|
+
} & Omit<ComponentPropsWithRef<E>, keyof OwnProps | "as">;
|
|
7
|
+
type TextOwnProps = {
|
|
8
|
+
type?: TextType;
|
|
9
|
+
};
|
|
10
|
+
type TextProps<E extends ElementType = "span"> = PolymorphicProps<E, TextOwnProps>;
|
|
11
|
+
declare const Text: <E extends ElementType = "span">({ as, type, className, ...props }: TextProps<E>) => import("react").JSX.Element;
|
|
12
|
+
export { Text, type TextProps, type TextType };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ElementType } from "react";
|
|
2
|
+
import { TypographyStyle } from "@puzzle-ui/theme";
|
|
3
|
+
type TextType = Omit<TypographyStyle, "headline1" | "headline2" | "headline3" | "headline4">;
|
|
4
|
+
type PolymorphicProps<E extends ElementType, OwnProps> = OwnProps & {
|
|
5
|
+
as?: E;
|
|
6
|
+
} & Omit<ComponentPropsWithRef<E>, keyof OwnProps | "as">;
|
|
7
|
+
type TextOwnProps = {
|
|
8
|
+
type?: TextType;
|
|
9
|
+
};
|
|
10
|
+
type TextProps<E extends ElementType = "span"> = PolymorphicProps<E, TextOwnProps>;
|
|
11
|
+
declare const Text: <E extends ElementType = "span">({ as, type, className, ...props }: TextProps<E>) => import("react").JSX.Element;
|
|
12
|
+
export { Text, type TextProps, type TextType };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cn } from "@puzzle-ui/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/typography/text.tsx
|
|
4
|
+
const Text = ({ as, type = "body1", className, ...props }) => {
|
|
5
|
+
const Component = as ?? "span";
|
|
6
|
+
const classes = cn("puzzle-text", `puzzle-typography-${type}`, className);
|
|
7
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
8
|
+
...props,
|
|
9
|
+
className: classes
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export { Text };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","names":[],"sources":["../../../src/components/typography/text.tsx"],"sourcesContent":["import { cn } from \"@puzzle-ui/core\";\nimport type { TypographyStyle } from \"@puzzle-ui/theme\";\nimport type { ComponentPropsWithRef, ElementType } from \"react\";\n\ntype TextType = Omit<\n TypographyStyle,\n \"headline1\" | \"headline2\" | \"headline3\" | \"headline4\"\n>;\n\ntype PolymorphicProps<E extends ElementType, OwnProps> = OwnProps & {\n as?: E;\n} & Omit<ComponentPropsWithRef<E>, keyof OwnProps | \"as\">;\n\ntype TextOwnProps = {\n type?: TextType;\n};\n\ntype TextProps<E extends ElementType = \"span\"> = PolymorphicProps<\n E,\n TextOwnProps\n>;\n\nconst Text = <E extends ElementType = \"span\">({\n as,\n type = \"body1\",\n className,\n ...props\n}: TextProps<E>) => {\n const Component = as ?? \"span\";\n const classes = cn(\"puzzle-text\", `puzzle-typography-${type}`, className);\n return <Component {...props} className={classes}></Component>;\n};\n\nexport { Text, type TextProps, type TextType };\n"],"mappings":";;;AAsBA,MAAM,QAAwC,EAC5C,IACA,OAAO,SACP,WACA,GAAG,YACe;CAClB,MAAM,YAAY,MAAM;CACxB,MAAM,UAAU,GAAG,eAAe,qBAAqB,QAAQ,SAAS;CACxE,OAAO,oBAAC,WAAD;EAAW,GAAI;EAAO,WAAW;CAAoB,CAAA;AAC9D"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
2
|
+
// src/components/utilities/preview/highlight.tsx
|
|
3
|
+
const TOKEN_PATTERN = new RegExp([
|
|
4
|
+
"(?<comment>\\/\\/[^\\n]*|\\/\\*[\\s\\S]*?\\*\\/)",
|
|
5
|
+
"(?<string>\"(?:[^\"\\\\\\n]|\\\\.)*\"|'(?:[^'\\\\\\n]|\\\\.)*'|`(?:[^`\\\\]|\\\\.)*`)",
|
|
6
|
+
`(?<keyword>\\b(?:${[
|
|
7
|
+
"as",
|
|
8
|
+
"async",
|
|
9
|
+
"await",
|
|
10
|
+
"break",
|
|
11
|
+
"case",
|
|
12
|
+
"class",
|
|
13
|
+
"const",
|
|
14
|
+
"continue",
|
|
15
|
+
"default",
|
|
16
|
+
"else",
|
|
17
|
+
"enum",
|
|
18
|
+
"export",
|
|
19
|
+
"extends",
|
|
20
|
+
"false",
|
|
21
|
+
"finally",
|
|
22
|
+
"for",
|
|
23
|
+
"from",
|
|
24
|
+
"function",
|
|
25
|
+
"if",
|
|
26
|
+
"implements",
|
|
27
|
+
"import",
|
|
28
|
+
"in",
|
|
29
|
+
"interface",
|
|
30
|
+
"let",
|
|
31
|
+
"new",
|
|
32
|
+
"null",
|
|
33
|
+
"of",
|
|
34
|
+
"return",
|
|
35
|
+
"switch",
|
|
36
|
+
"this",
|
|
37
|
+
"throw",
|
|
38
|
+
"true",
|
|
39
|
+
"try",
|
|
40
|
+
"type",
|
|
41
|
+
"typeof",
|
|
42
|
+
"undefined",
|
|
43
|
+
"var",
|
|
44
|
+
"void",
|
|
45
|
+
"while"
|
|
46
|
+
].join("|")})\\b)`,
|
|
47
|
+
"(?<number>\\b\\d+(?:\\.\\d+)?\\b)",
|
|
48
|
+
"(?<type>\\b[A-Z][A-Za-z0-9_]*\\b)"
|
|
49
|
+
].join("|"), "g");
|
|
50
|
+
const TOKEN_TYPES = [
|
|
51
|
+
"comment",
|
|
52
|
+
"string",
|
|
53
|
+
"keyword",
|
|
54
|
+
"number",
|
|
55
|
+
"type"
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* Splits TypeScript/TSX source into plain text and highlighted spans.
|
|
59
|
+
* This is a lightweight lexical pass, not a parser.
|
|
60
|
+
*/
|
|
61
|
+
const highlightCode = (code) => {
|
|
62
|
+
const nodes = [];
|
|
63
|
+
let lastIndex = 0;
|
|
64
|
+
for (const match of code.matchAll(TOKEN_PATTERN)) {
|
|
65
|
+
const type = TOKEN_TYPES.find((name) => match.groups?.[name] !== void 0);
|
|
66
|
+
if (!type) continue;
|
|
67
|
+
if (match.index > lastIndex) nodes.push(code.slice(lastIndex, match.index));
|
|
68
|
+
nodes.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
69
|
+
className: `puzzle-preview__token--${type}`,
|
|
70
|
+
children: match[0]
|
|
71
|
+
}, match.index));
|
|
72
|
+
lastIndex = match.index + match[0].length;
|
|
73
|
+
}
|
|
74
|
+
if (lastIndex < code.length) nodes.push(code.slice(lastIndex));
|
|
75
|
+
return nodes;
|
|
76
|
+
};
|
|
77
|
+
exports.highlightCode = highlightCode;
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=highlight.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight.cjs","names":[],"sources":["../../../../src/components/utilities/preview/highlight.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\ntype TokenType = \"comment\" | \"string\" | \"keyword\" | \"number\" | \"type\";\n\nconst KEYWORDS = [\n \"as\",\n \"async\",\n \"await\",\n \"break\",\n \"case\",\n \"class\",\n \"const\",\n \"continue\",\n \"default\",\n \"else\",\n \"enum\",\n \"export\",\n \"extends\",\n \"false\",\n \"finally\",\n \"for\",\n \"from\",\n \"function\",\n \"if\",\n \"implements\",\n \"import\",\n \"in\",\n \"interface\",\n \"let\",\n \"new\",\n \"null\",\n \"of\",\n \"return\",\n \"switch\",\n \"this\",\n \"throw\",\n \"true\",\n \"try\",\n \"type\",\n \"typeof\",\n \"undefined\",\n \"var\",\n \"void\",\n \"while\",\n];\n\n// Order matters: earlier groups win at the same position.\nconst TOKEN_PATTERN = new RegExp(\n [\n \"(?<comment>\\\\/\\\\/[^\\\\n]*|\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)\",\n \"(?<string>\\\"(?:[^\\\"\\\\\\\\\\\\n]|\\\\\\\\.)*\\\"|'(?:[^'\\\\\\\\\\\\n]|\\\\\\\\.)*'|`(?:[^`\\\\\\\\]|\\\\\\\\.)*`)\",\n `(?<keyword>\\\\b(?:${KEYWORDS.join(\"|\")})\\\\b)`,\n \"(?<number>\\\\b\\\\d+(?:\\\\.\\\\d+)?\\\\b)\",\n \"(?<type>\\\\b[A-Z][A-Za-z0-9_]*\\\\b)\",\n ].join(\"|\"),\n \"g\",\n);\n\nconst TOKEN_TYPES: TokenType[] = [\n \"comment\",\n \"string\",\n \"keyword\",\n \"number\",\n \"type\",\n];\n\n/**\n * Splits TypeScript/TSX source into plain text and highlighted spans.\n * This is a lightweight lexical pass, not a parser.\n */\nconst highlightCode = (code: string): ReactNode[] => {\n const nodes: ReactNode[] = [];\n let lastIndex = 0;\n\n for (const match of code.matchAll(TOKEN_PATTERN)) {\n const type = TOKEN_TYPES.find((name) => match.groups?.[name] !== undefined);\n\n if (!type) continue;\n\n if (match.index > lastIndex) {\n nodes.push(code.slice(lastIndex, match.index));\n }\n\n nodes.push(\n <span key={match.index} className={`puzzle-preview__token--${type}`}>\n {match[0]}\n </span>,\n );\n\n lastIndex = match.index + match[0].length;\n }\n\n if (lastIndex < code.length) {\n nodes.push(code.slice(lastIndex));\n }\n\n return nodes;\n};\n\nexport { highlightCode };\n"],"mappings":";;AA+CA,MAAM,gBAAgB,IAAI,OACxB;CACE;CACA;CACA,oBAAoB;EA9CtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAQ6B,CAAC,CAAC,KAAK,GAAG,EAAE;CACvC;CACA;AACF,CAAC,CAAC,KAAK,GAAG,GACV,GACF;AAEA,MAAM,cAA2B;CAC/B;CACA;CACA;CACA;CACA;AACF;;;;;AAMA,MAAM,iBAAiB,SAA8B;CACnD,MAAM,QAAqB,CAAC;CAC5B,IAAI,YAAY;CAEhB,KAAK,MAAM,SAAS,KAAK,SAAS,aAAa,GAAG;EAChD,MAAM,OAAO,YAAY,MAAM,SAAS,MAAM,SAAS,UAAU,KAAA,CAAS;EAE1E,IAAI,CAAC,MAAM;EAEX,IAAI,MAAM,QAAQ,WAChB,MAAM,KAAK,KAAK,MAAM,WAAW,MAAM,KAAK,CAAC;EAG/C,MAAM,KACJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAwB,WAAW,0BAA0B;GAC1D,UAAA,MAAM;EACH,GAFK,MAAM,KAEX,CACR;EAEA,YAAY,MAAM,QAAQ,MAAM,EAAE,CAAC;CACrC;CAEA,IAAI,YAAY,KAAK,QACnB,MAAM,KAAK,KAAK,MAAM,SAAS,CAAC;CAGlC,OAAO;AACT"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
// src/components/utilities/preview/highlight.tsx
|
|
3
|
+
const TOKEN_PATTERN = new RegExp([
|
|
4
|
+
"(?<comment>\\/\\/[^\\n]*|\\/\\*[\\s\\S]*?\\*\\/)",
|
|
5
|
+
"(?<string>\"(?:[^\"\\\\\\n]|\\\\.)*\"|'(?:[^'\\\\\\n]|\\\\.)*'|`(?:[^`\\\\]|\\\\.)*`)",
|
|
6
|
+
`(?<keyword>\\b(?:${[
|
|
7
|
+
"as",
|
|
8
|
+
"async",
|
|
9
|
+
"await",
|
|
10
|
+
"break",
|
|
11
|
+
"case",
|
|
12
|
+
"class",
|
|
13
|
+
"const",
|
|
14
|
+
"continue",
|
|
15
|
+
"default",
|
|
16
|
+
"else",
|
|
17
|
+
"enum",
|
|
18
|
+
"export",
|
|
19
|
+
"extends",
|
|
20
|
+
"false",
|
|
21
|
+
"finally",
|
|
22
|
+
"for",
|
|
23
|
+
"from",
|
|
24
|
+
"function",
|
|
25
|
+
"if",
|
|
26
|
+
"implements",
|
|
27
|
+
"import",
|
|
28
|
+
"in",
|
|
29
|
+
"interface",
|
|
30
|
+
"let",
|
|
31
|
+
"new",
|
|
32
|
+
"null",
|
|
33
|
+
"of",
|
|
34
|
+
"return",
|
|
35
|
+
"switch",
|
|
36
|
+
"this",
|
|
37
|
+
"throw",
|
|
38
|
+
"true",
|
|
39
|
+
"try",
|
|
40
|
+
"type",
|
|
41
|
+
"typeof",
|
|
42
|
+
"undefined",
|
|
43
|
+
"var",
|
|
44
|
+
"void",
|
|
45
|
+
"while"
|
|
46
|
+
].join("|")})\\b)`,
|
|
47
|
+
"(?<number>\\b\\d+(?:\\.\\d+)?\\b)",
|
|
48
|
+
"(?<type>\\b[A-Z][A-Za-z0-9_]*\\b)"
|
|
49
|
+
].join("|"), "g");
|
|
50
|
+
const TOKEN_TYPES = [
|
|
51
|
+
"comment",
|
|
52
|
+
"string",
|
|
53
|
+
"keyword",
|
|
54
|
+
"number",
|
|
55
|
+
"type"
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* Splits TypeScript/TSX source into plain text and highlighted spans.
|
|
59
|
+
* This is a lightweight lexical pass, not a parser.
|
|
60
|
+
*/
|
|
61
|
+
const highlightCode = (code) => {
|
|
62
|
+
const nodes = [];
|
|
63
|
+
let lastIndex = 0;
|
|
64
|
+
for (const match of code.matchAll(TOKEN_PATTERN)) {
|
|
65
|
+
const type = TOKEN_TYPES.find((name) => match.groups?.[name] !== void 0);
|
|
66
|
+
if (!type) continue;
|
|
67
|
+
if (match.index > lastIndex) nodes.push(code.slice(lastIndex, match.index));
|
|
68
|
+
nodes.push(/* @__PURE__ */ jsx("span", {
|
|
69
|
+
className: `puzzle-preview__token--${type}`,
|
|
70
|
+
children: match[0]
|
|
71
|
+
}, match.index));
|
|
72
|
+
lastIndex = match.index + match[0].length;
|
|
73
|
+
}
|
|
74
|
+
if (lastIndex < code.length) nodes.push(code.slice(lastIndex));
|
|
75
|
+
return nodes;
|
|
76
|
+
};
|
|
77
|
+
export { highlightCode };
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=highlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight.js","names":[],"sources":["../../../../src/components/utilities/preview/highlight.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\ntype TokenType = \"comment\" | \"string\" | \"keyword\" | \"number\" | \"type\";\n\nconst KEYWORDS = [\n \"as\",\n \"async\",\n \"await\",\n \"break\",\n \"case\",\n \"class\",\n \"const\",\n \"continue\",\n \"default\",\n \"else\",\n \"enum\",\n \"export\",\n \"extends\",\n \"false\",\n \"finally\",\n \"for\",\n \"from\",\n \"function\",\n \"if\",\n \"implements\",\n \"import\",\n \"in\",\n \"interface\",\n \"let\",\n \"new\",\n \"null\",\n \"of\",\n \"return\",\n \"switch\",\n \"this\",\n \"throw\",\n \"true\",\n \"try\",\n \"type\",\n \"typeof\",\n \"undefined\",\n \"var\",\n \"void\",\n \"while\",\n];\n\n// Order matters: earlier groups win at the same position.\nconst TOKEN_PATTERN = new RegExp(\n [\n \"(?<comment>\\\\/\\\\/[^\\\\n]*|\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)\",\n \"(?<string>\\\"(?:[^\\\"\\\\\\\\\\\\n]|\\\\\\\\.)*\\\"|'(?:[^'\\\\\\\\\\\\n]|\\\\\\\\.)*'|`(?:[^`\\\\\\\\]|\\\\\\\\.)*`)\",\n `(?<keyword>\\\\b(?:${KEYWORDS.join(\"|\")})\\\\b)`,\n \"(?<number>\\\\b\\\\d+(?:\\\\.\\\\d+)?\\\\b)\",\n \"(?<type>\\\\b[A-Z][A-Za-z0-9_]*\\\\b)\",\n ].join(\"|\"),\n \"g\",\n);\n\nconst TOKEN_TYPES: TokenType[] = [\n \"comment\",\n \"string\",\n \"keyword\",\n \"number\",\n \"type\",\n];\n\n/**\n * Splits TypeScript/TSX source into plain text and highlighted spans.\n * This is a lightweight lexical pass, not a parser.\n */\nconst highlightCode = (code: string): ReactNode[] => {\n const nodes: ReactNode[] = [];\n let lastIndex = 0;\n\n for (const match of code.matchAll(TOKEN_PATTERN)) {\n const type = TOKEN_TYPES.find((name) => match.groups?.[name] !== undefined);\n\n if (!type) continue;\n\n if (match.index > lastIndex) {\n nodes.push(code.slice(lastIndex, match.index));\n }\n\n nodes.push(\n <span key={match.index} className={`puzzle-preview__token--${type}`}>\n {match[0]}\n </span>,\n );\n\n lastIndex = match.index + match[0].length;\n }\n\n if (lastIndex < code.length) {\n nodes.push(code.slice(lastIndex));\n }\n\n return nodes;\n};\n\nexport { highlightCode };\n"],"mappings":";;AA+CA,MAAM,gBAAgB,IAAI,OACxB;CACE;CACA;CACA,oBAAoB;EA9CtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAQ6B,CAAC,CAAC,KAAK,GAAG,EAAE;CACvC;CACA;AACF,CAAC,CAAC,KAAK,GAAG,GACV,GACF;AAEA,MAAM,cAA2B;CAC/B;CACA;CACA;CACA;CACA;AACF;;;;;AAMA,MAAM,iBAAiB,SAA8B;CACnD,MAAM,QAAqB,CAAC;CAC5B,IAAI,YAAY;CAEhB,KAAK,MAAM,SAAS,KAAK,SAAS,aAAa,GAAG;EAChD,MAAM,OAAO,YAAY,MAAM,SAAS,MAAM,SAAS,UAAU,KAAA,CAAS;EAE1E,IAAI,CAAC,MAAM;EAEX,IAAI,MAAM,QAAQ,WAChB,MAAM,KAAK,KAAK,MAAM,WAAW,MAAM,KAAK,CAAC;EAG/C,MAAM,KACJ,oBAAC,QAAD;GAAwB,WAAW,0BAA0B;GAC1D,UAAA,MAAM;EACH,GAFK,MAAM,KAEX,CACR;EAEA,YAAY,MAAM,QAAQ,MAAM,EAAE,CAAC;CACrC;CAEA,IAAI,YAAY,KAAK,QACnB,MAAM,KAAK,KAAK,MAAM,SAAS,CAAC;CAGlC,OAAO;AACT"}
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_index = require("../../layout/background/index.cjs");
|
|
3
|
+
const require_highlight = require("./highlight.cjs");
|
|
4
|
+
;/* empty css */
|
|
5
|
+
let _puzzle_ui_core = require("@puzzle-ui/core");
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let _puzzle_ui_hooks = require("@puzzle-ui/hooks");
|
|
9
|
+
let react_dom = require("react-dom");
|
|
10
|
+
let _puzzle_ui_icons = require("@puzzle-ui/icons");
|
|
11
|
+
let _puzzle_ui_theme_scope_context = require("@puzzle-ui/theme/scope-context");
|
|
12
|
+
// src/components/utilities/preview/index.tsx
|
|
13
|
+
const PREVIEW_DEVICES = {
|
|
14
|
+
mobile: {
|
|
15
|
+
label: "Mobile",
|
|
16
|
+
width: 390,
|
|
17
|
+
height: 844
|
|
18
|
+
},
|
|
19
|
+
tablet: {
|
|
20
|
+
label: "Tablet",
|
|
21
|
+
width: 768,
|
|
22
|
+
height: 1024
|
|
23
|
+
},
|
|
24
|
+
desktop: {
|
|
25
|
+
label: "Desktop",
|
|
26
|
+
width: 1024,
|
|
27
|
+
height: 768
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const PREVIEW_DEVICE_ITEMS = Object.keys(PREVIEW_DEVICES).map((id) => ({ id }));
|
|
31
|
+
const ALIGN_VALUES = {
|
|
32
|
+
start: "flex-start",
|
|
33
|
+
center: "center",
|
|
34
|
+
end: "flex-end",
|
|
35
|
+
stretch: "stretch"
|
|
36
|
+
};
|
|
37
|
+
const JUSTIFY_VALUES = {
|
|
38
|
+
start: "flex-start",
|
|
39
|
+
center: "center",
|
|
40
|
+
end: "flex-end",
|
|
41
|
+
between: "space-between",
|
|
42
|
+
around: "space-around",
|
|
43
|
+
evenly: "space-evenly"
|
|
44
|
+
};
|
|
45
|
+
const createPreviewDocument = (rootId) => `<!doctype html>
|
|
46
|
+
<html lang="en">
|
|
47
|
+
<head>
|
|
48
|
+
<meta charset="UTF-8" />
|
|
49
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
50
|
+
</head>
|
|
51
|
+
<body>
|
|
52
|
+
<div id="${rootId}"></div>
|
|
53
|
+
</body>
|
|
54
|
+
</html>`;
|
|
55
|
+
const useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
56
|
+
const PreviewBackground = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.Background, {
|
|
57
|
+
pattern: "blueprint",
|
|
58
|
+
size: 20,
|
|
59
|
+
majorSize: 100,
|
|
60
|
+
lineWidth: 1,
|
|
61
|
+
patternOpacity: .25,
|
|
62
|
+
...props
|
|
63
|
+
});
|
|
64
|
+
const Preview = ({ children, className, defaultDevice = "mobile", code, height, align, justify, hideDevices = false }) => {
|
|
65
|
+
const generatedId = (0, react.useId)();
|
|
66
|
+
const frameRootId = `${generatedId}-root`;
|
|
67
|
+
const previewTabId = `${generatedId}-tab-preview`;
|
|
68
|
+
const codeTabId = `${generatedId}-tab-code`;
|
|
69
|
+
const panelId = `${generatedId}-panel`;
|
|
70
|
+
const themeScope = (0, _puzzle_ui_theme_scope_context.useThemeScope)();
|
|
71
|
+
const [device, setDevice] = (0, react.useState)(defaultDevice);
|
|
72
|
+
const [activeTab, setActiveTab] = (0, react.useState)("preview");
|
|
73
|
+
const [frameRoot, setFrameRoot] = (0, react.useState)(null);
|
|
74
|
+
const [scale, setScale] = (0, react.useState)(1);
|
|
75
|
+
const [copied, setCopied] = (0, react.useState)(false);
|
|
76
|
+
const containerRef = (0, react.useRef)(null);
|
|
77
|
+
const iframeRef = (0, react.useRef)(null);
|
|
78
|
+
const copyTimeoutRef = (0, react.useRef)(null);
|
|
79
|
+
const config = PREVIEW_DEVICES[device];
|
|
80
|
+
const frameHeight = height ?? config.height;
|
|
81
|
+
const hasCode = code !== void 0;
|
|
82
|
+
const [direction, setDirection] = (0, react.useState)("ltr");
|
|
83
|
+
const sectionRef = (0, react.useRef)(null);
|
|
84
|
+
const isKeyboardNavigation = (0, react.useRef)(false);
|
|
85
|
+
(0, react.useLayoutEffect)(() => {
|
|
86
|
+
const section = sectionRef.current;
|
|
87
|
+
if (section) {
|
|
88
|
+
const isRtl = getComputedStyle(section).direction === "rtl" || section.closest("[dir]")?.getAttribute("dir")?.toLowerCase() === "rtl";
|
|
89
|
+
setDirection(isRtl ? "rtl" : "ltr");
|
|
90
|
+
}
|
|
91
|
+
}, []);
|
|
92
|
+
const rovingFocus = (0, _puzzle_ui_hooks.useRovingFocus)({
|
|
93
|
+
items: hasCode ? [{ id: "preview" }, { id: "code" }] : [{ id: "preview" }],
|
|
94
|
+
dir: direction,
|
|
95
|
+
initialActiveId: activeTab
|
|
96
|
+
});
|
|
97
|
+
const deviceFocus = (0, _puzzle_ui_hooks.useRovingFocus)({
|
|
98
|
+
items: PREVIEW_DEVICE_ITEMS,
|
|
99
|
+
dir: direction,
|
|
100
|
+
initialActiveId: device
|
|
101
|
+
});
|
|
102
|
+
const handleTabKeyDown = (event, tab) => {
|
|
103
|
+
isKeyboardNavigation.current = true;
|
|
104
|
+
try {
|
|
105
|
+
rovingFocus.onItemKeyDown(event, tab);
|
|
106
|
+
} finally {
|
|
107
|
+
isKeyboardNavigation.current = false;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const handleTabFocus = (tab) => {
|
|
111
|
+
rovingFocus.onItemFocus(tab);
|
|
112
|
+
if (isKeyboardNavigation.current) setActiveTab(tab);
|
|
113
|
+
};
|
|
114
|
+
const syncStyles = (0, react.useCallback)(() => {
|
|
115
|
+
const frameDocument = iframeRef.current?.contentDocument;
|
|
116
|
+
if (!frameDocument) return;
|
|
117
|
+
const frameHead = frameDocument.head;
|
|
118
|
+
frameHead.querySelectorAll("[data-puzzle-preview-style]").forEach((element) => element.remove());
|
|
119
|
+
document.querySelectorAll([
|
|
120
|
+
"head link[rel='stylesheet']",
|
|
121
|
+
"head style",
|
|
122
|
+
"style[data-puzzle-theme]",
|
|
123
|
+
"style[data-puzzle-theme-scope-style]"
|
|
124
|
+
].join(", ")).forEach((element) => {
|
|
125
|
+
const clone = element.cloneNode(true);
|
|
126
|
+
clone.setAttribute("data-puzzle-preview-style", "");
|
|
127
|
+
frameHead.appendChild(clone);
|
|
128
|
+
});
|
|
129
|
+
const sourceRoot = document.documentElement;
|
|
130
|
+
const targetRoot = frameDocument.documentElement;
|
|
131
|
+
targetRoot.style.cssText = sourceRoot.style.cssText;
|
|
132
|
+
targetRoot.className = sourceRoot.className;
|
|
133
|
+
Array.from(sourceRoot.attributes).forEach((attribute) => {
|
|
134
|
+
if (attribute.name === "style" || attribute.name === "class") return;
|
|
135
|
+
targetRoot.setAttribute(attribute.name, attribute.value);
|
|
136
|
+
});
|
|
137
|
+
const body = frameDocument.body;
|
|
138
|
+
body.className = document.body.className;
|
|
139
|
+
body.style.cssText = document.body.style.cssText;
|
|
140
|
+
targetRoot.style.setProperty("box-sizing", "border-box", "important");
|
|
141
|
+
targetRoot.style.setProperty("width", "100%", "important");
|
|
142
|
+
targetRoot.style.setProperty("height", "100%", "important");
|
|
143
|
+
targetRoot.style.setProperty("min-height", "100%", "important");
|
|
144
|
+
targetRoot.style.setProperty("margin", "0", "important");
|
|
145
|
+
targetRoot.style.setProperty("overflow-x", "hidden", "important");
|
|
146
|
+
targetRoot.style.setProperty("overflow-y", "auto", "important");
|
|
147
|
+
targetRoot.style.setProperty("scrollbar-width", "none", "important");
|
|
148
|
+
targetRoot.style.setProperty("-ms-overflow-style", "none", "important");
|
|
149
|
+
body.style.setProperty("display", "block", "important");
|
|
150
|
+
body.style.setProperty("position", "static", "important");
|
|
151
|
+
body.style.setProperty("box-sizing", "border-box", "important");
|
|
152
|
+
body.style.setProperty("width", "100%", "important");
|
|
153
|
+
body.style.setProperty("height", "auto", "important");
|
|
154
|
+
body.style.setProperty("min-height", "100%", "important");
|
|
155
|
+
body.style.setProperty("margin", "0", "important");
|
|
156
|
+
body.style.setProperty("overflow", "visible", "important");
|
|
157
|
+
frameDocument.getElementById(frameRootId)?.style.removeProperty("min-height");
|
|
158
|
+
const scrollbarStyle = frameDocument.createElement("style");
|
|
159
|
+
scrollbarStyle.setAttribute("data-puzzle-preview-style", "");
|
|
160
|
+
scrollbarStyle.textContent = `
|
|
161
|
+
html,
|
|
162
|
+
body {
|
|
163
|
+
scrollbar-width: none !important;
|
|
164
|
+
-ms-overflow-style: none !important;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
html::-webkit-scrollbar,
|
|
168
|
+
body::-webkit-scrollbar {
|
|
169
|
+
display: none !important;
|
|
170
|
+
width: 0 !important;
|
|
171
|
+
height: 0 !important;
|
|
172
|
+
}
|
|
173
|
+
`;
|
|
174
|
+
frameHead.appendChild(scrollbarStyle);
|
|
175
|
+
}, [frameRootId]);
|
|
176
|
+
const updateScale = (0, react.useCallback)((availableWidth) => {
|
|
177
|
+
const nextScale = Math.min(1, Math.max(0, availableWidth) / config.width);
|
|
178
|
+
setScale((current) => Math.abs(current - nextScale) < .001 ? current : nextScale);
|
|
179
|
+
}, [config.width]);
|
|
180
|
+
useIsomorphicLayoutEffect(() => {
|
|
181
|
+
const container = containerRef.current;
|
|
182
|
+
if (!container) return;
|
|
183
|
+
const measure = () => {
|
|
184
|
+
const styles = window.getComputedStyle(container);
|
|
185
|
+
const horizontalPadding = parseFloat(styles.paddingLeft) + parseFloat(styles.paddingRight);
|
|
186
|
+
updateScale(container.clientWidth - horizontalPadding);
|
|
187
|
+
};
|
|
188
|
+
measure();
|
|
189
|
+
const observer = new ResizeObserver((entries) => {
|
|
190
|
+
const entry = entries[0];
|
|
191
|
+
if (entry) updateScale(entry.contentRect.width);
|
|
192
|
+
});
|
|
193
|
+
observer.observe(container);
|
|
194
|
+
return () => observer.disconnect();
|
|
195
|
+
}, [updateScale]);
|
|
196
|
+
(0, react.useEffect)(() => {
|
|
197
|
+
const isStyleNode = (node) => node instanceof Element && (node.matches("style, link[rel='stylesheet']") || node.querySelector("style, link[rel='stylesheet']") !== null);
|
|
198
|
+
const headObserver = new MutationObserver(syncStyles);
|
|
199
|
+
headObserver.observe(document.head, {
|
|
200
|
+
childList: true,
|
|
201
|
+
subtree: true,
|
|
202
|
+
characterData: true,
|
|
203
|
+
attributes: true
|
|
204
|
+
});
|
|
205
|
+
const bodyObserver = new MutationObserver((mutations) => {
|
|
206
|
+
if (mutations.some((mutation) => {
|
|
207
|
+
return (mutation.target instanceof Element ? mutation.target : mutation.target.parentElement)?.closest("style[data-puzzle-theme], style[data-puzzle-theme-scope-style]") != null || Array.from(mutation.addedNodes).some(isStyleNode) || Array.from(mutation.removedNodes).some(isStyleNode);
|
|
208
|
+
})) syncStyles();
|
|
209
|
+
});
|
|
210
|
+
bodyObserver.observe(document.body, {
|
|
211
|
+
childList: true,
|
|
212
|
+
subtree: true,
|
|
213
|
+
characterData: true,
|
|
214
|
+
attributes: true,
|
|
215
|
+
attributeFilter: ["data-theme"]
|
|
216
|
+
});
|
|
217
|
+
return () => {
|
|
218
|
+
headObserver.disconnect();
|
|
219
|
+
bodyObserver.disconnect();
|
|
220
|
+
};
|
|
221
|
+
}, [syncStyles]);
|
|
222
|
+
const initializeFrame = (0, react.useCallback)(() => {
|
|
223
|
+
const root = (iframeRef.current?.contentDocument)?.getElementById(frameRootId);
|
|
224
|
+
if (!root) return;
|
|
225
|
+
syncStyles();
|
|
226
|
+
setFrameRoot(root);
|
|
227
|
+
}, [frameRootId, syncStyles]);
|
|
228
|
+
(0, react.useEffect)(() => {
|
|
229
|
+
initializeFrame();
|
|
230
|
+
}, [initializeFrame]);
|
|
231
|
+
const handleCopyCode = (0, react.useCallback)(async () => {
|
|
232
|
+
if (code === void 0) return;
|
|
233
|
+
try {
|
|
234
|
+
await navigator.clipboard.writeText(code);
|
|
235
|
+
setCopied(true);
|
|
236
|
+
if (copyTimeoutRef.current) clearTimeout(copyTimeoutRef.current);
|
|
237
|
+
copyTimeoutRef.current = setTimeout(() => {
|
|
238
|
+
setCopied(false);
|
|
239
|
+
}, 2e3);
|
|
240
|
+
} catch {
|
|
241
|
+
setCopied(false);
|
|
242
|
+
}
|
|
243
|
+
}, [code]);
|
|
244
|
+
(0, react.useEffect)(() => () => {
|
|
245
|
+
if (copyTimeoutRef.current) clearTimeout(copyTimeoutRef.current);
|
|
246
|
+
}, []);
|
|
247
|
+
(0, react.useEffect)(() => {
|
|
248
|
+
if (!hasCode && activeTab === "code") setActiveTab("preview");
|
|
249
|
+
}, [activeTab, hasCode]);
|
|
250
|
+
const frameStyle = {
|
|
251
|
+
width: config.width,
|
|
252
|
+
height: frameHeight,
|
|
253
|
+
transform: `scale(${scale})`,
|
|
254
|
+
transformOrigin: "top left"
|
|
255
|
+
};
|
|
256
|
+
const contentStyle = {
|
|
257
|
+
display: "flex",
|
|
258
|
+
boxSizing: "border-box",
|
|
259
|
+
minHeight: "100vh",
|
|
260
|
+
alignItems: align ? ALIGN_VALUES[align] : void 0,
|
|
261
|
+
justifyContent: justify ? JUSTIFY_VALUES[justify] : void 0
|
|
262
|
+
};
|
|
263
|
+
const viewportStyle = {
|
|
264
|
+
width: config.width * scale,
|
|
265
|
+
aspectRatio: `${config.width} / ${frameHeight}`
|
|
266
|
+
};
|
|
267
|
+
const panelProps = {
|
|
268
|
+
id: panelId,
|
|
269
|
+
role: "tabpanel",
|
|
270
|
+
"aria-labelledby": activeTab === "preview" ? previewTabId : codeTabId
|
|
271
|
+
};
|
|
272
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
273
|
+
ref: sectionRef,
|
|
274
|
+
className: (0, _puzzle_ui_core.cn)("puzzle-preview", className),
|
|
275
|
+
children: [
|
|
276
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
277
|
+
className: "puzzle-preview__toolbar",
|
|
278
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
279
|
+
className: "puzzle-preview__tabs",
|
|
280
|
+
role: "tablist",
|
|
281
|
+
"aria-label": "Preview view",
|
|
282
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
283
|
+
type: "button",
|
|
284
|
+
role: "tab",
|
|
285
|
+
id: previewTabId,
|
|
286
|
+
ref: rovingFocus.getItemRef("preview"),
|
|
287
|
+
tabIndex: activeTab === "preview" ? 0 : -1,
|
|
288
|
+
onFocus: () => handleTabFocus("preview"),
|
|
289
|
+
onKeyDown: (event) => handleTabKeyDown(event, "preview"),
|
|
290
|
+
"aria-selected": activeTab === "preview",
|
|
291
|
+
"aria-controls": panelId,
|
|
292
|
+
className: (0, _puzzle_ui_core.cn)("puzzle-preview__tab", activeTab === "preview" && "puzzle-preview__tab--active"),
|
|
293
|
+
onClick: () => setActiveTab("preview"),
|
|
294
|
+
children: "Preview"
|
|
295
|
+
}), hasCode && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
296
|
+
type: "button",
|
|
297
|
+
role: "tab",
|
|
298
|
+
id: codeTabId,
|
|
299
|
+
ref: rovingFocus.getItemRef("code"),
|
|
300
|
+
tabIndex: activeTab === "code" ? 0 : -1,
|
|
301
|
+
onFocus: () => handleTabFocus("code"),
|
|
302
|
+
onKeyDown: (event) => handleTabKeyDown(event, "code"),
|
|
303
|
+
"aria-selected": activeTab === "code",
|
|
304
|
+
"aria-controls": panelId,
|
|
305
|
+
className: (0, _puzzle_ui_core.cn)("puzzle-preview__tab", activeTab === "code" && "puzzle-preview__tab--active"),
|
|
306
|
+
onClick: () => setActiveTab("code"),
|
|
307
|
+
children: "Code"
|
|
308
|
+
})]
|
|
309
|
+
}), activeTab === "preview" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
310
|
+
className: "puzzle-preview__toolbar-actions",
|
|
311
|
+
children: [!hideDevices && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
312
|
+
className: "puzzle-preview__devices",
|
|
313
|
+
role: "group",
|
|
314
|
+
"aria-label": "Device size",
|
|
315
|
+
children: Object.keys(PREVIEW_DEVICES).map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
316
|
+
ref: deviceFocus.getItemRef(item),
|
|
317
|
+
type: "button",
|
|
318
|
+
className: (0, _puzzle_ui_core.cn)("puzzle-preview__device", device === item && "puzzle-preview__device--active"),
|
|
319
|
+
"aria-pressed": device === item,
|
|
320
|
+
tabIndex: deviceFocus.getItemTabIndex(item),
|
|
321
|
+
onFocus: () => deviceFocus.onItemFocus(item),
|
|
322
|
+
onKeyDown: (event) => deviceFocus.onItemKeyDown(event, item),
|
|
323
|
+
onClick: () => setDevice(item),
|
|
324
|
+
children: PREVIEW_DEVICES[item].label
|
|
325
|
+
}, item))
|
|
326
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
327
|
+
className: "puzzle-preview__dimensions",
|
|
328
|
+
children: [
|
|
329
|
+
config.width,
|
|
330
|
+
" × ",
|
|
331
|
+
frameHeight
|
|
332
|
+
]
|
|
333
|
+
})]
|
|
334
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
335
|
+
type: "button",
|
|
336
|
+
className: "puzzle-preview__copy",
|
|
337
|
+
onClick: handleCopyCode,
|
|
338
|
+
"aria-label": copied ? "Code copied" : "Copy code",
|
|
339
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_puzzle_ui_icons.Icon, {
|
|
340
|
+
name: copied ? "tabler:check" : "tabler:copy",
|
|
341
|
+
size: 16,
|
|
342
|
+
"aria-hidden": "true"
|
|
343
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: copied ? "Copied" : "Copy code" })]
|
|
344
|
+
})]
|
|
345
|
+
}),
|
|
346
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PreviewBackground, {
|
|
347
|
+
...panelProps,
|
|
348
|
+
className: "puzzle-preview__panel",
|
|
349
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
350
|
+
ref: containerRef,
|
|
351
|
+
className: "puzzle-preview__stage",
|
|
352
|
+
hidden: activeTab !== "preview",
|
|
353
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
354
|
+
className: "puzzle-preview__viewport",
|
|
355
|
+
style: viewportStyle,
|
|
356
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
|
|
357
|
+
ref: iframeRef,
|
|
358
|
+
className: "puzzle-preview__frame",
|
|
359
|
+
srcDoc: createPreviewDocument(frameRootId),
|
|
360
|
+
title: `${config.label} component preview`,
|
|
361
|
+
onLoad: initializeFrame,
|
|
362
|
+
style: frameStyle
|
|
363
|
+
}), frameRoot && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_puzzle_ui_theme_scope_context.ThemeScopeProvider, {
|
|
364
|
+
scopeId: themeScope?.scopeId ?? null,
|
|
365
|
+
theme: themeScope?.theme ?? "system",
|
|
366
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
367
|
+
style: contentStyle,
|
|
368
|
+
children
|
|
369
|
+
})
|
|
370
|
+
}), frameRoot)]
|
|
371
|
+
})
|
|
372
|
+
}), activeTab === "code" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
373
|
+
className: "puzzle-preview__code",
|
|
374
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
375
|
+
className: "language-tsx",
|
|
376
|
+
children: code === void 0 ? null : require_highlight.highlightCode(code)
|
|
377
|
+
}) })
|
|
378
|
+
})]
|
|
379
|
+
}),
|
|
380
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
381
|
+
className: "puzzle-preview__copy-status",
|
|
382
|
+
role: "status",
|
|
383
|
+
"aria-live": "polite",
|
|
384
|
+
children: copied ? "Code copied to clipboard." : ""
|
|
385
|
+
})
|
|
386
|
+
]
|
|
387
|
+
});
|
|
388
|
+
};
|
|
389
|
+
exports.Preview = Preview;
|
|
390
|
+
|
|
391
|
+
//# sourceMappingURL=index.cjs.map
|