@developer_tribe/react-builder 1.0.3 → 1.0.4
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/dist/android.svg +43 -0
- package/dist/apple.svg +16 -0
- package/dist/attributes-editor/Field.d.ts +2 -1
- package/dist/attributes-editor/SizeField.d.ts +9 -0
- package/dist/build-components/BackgroundImage/BackgroundImageProps.generated.d.ts +1 -0
- package/dist/build-components/Button/ButtonProps.generated.d.ts +1 -0
- package/dist/build-components/Carousel/CarouselProps.generated.d.ts +1 -0
- package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +1 -0
- package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +1 -0
- package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +1 -0
- package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +1 -0
- package/dist/build-components/Image/ImageProps.generated.d.ts +1 -0
- package/dist/build-components/Onboard/OnboardProps.generated.d.ts +1 -0
- package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +1 -1
- package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +1 -0
- package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +2 -3
- package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +1 -0
- package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +2 -1
- package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +1 -0
- package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +1 -0
- package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +1 -0
- package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +1 -0
- package/dist/build-components/Text/TextProps.generated.d.ts +1 -0
- package/dist/build-components/View/ViewProps.generated.d.ts +1 -0
- package/dist/build-components/patterns.generated.d.ts +194 -57
- package/dist/components/JsonTextEditor.d.ts +9 -0
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +5 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/pages/tabs/SideTool.d.ts +2 -1
- package/dist/store.d.ts +2 -0
- package/dist/styles.css +1 -1
- package/dist/utils/extractImageStyle.d.ts +2 -1
- package/dist/utils/extractViewStyle.d.ts +1 -2
- package/dist/utils/selection.d.ts +7 -0
- package/dist/utils/useMergedStyle.d.ts +2 -0
- package/package.json +2 -5
- package/src/.DS_Store +0 -0
- package/src/AttributesEditor.tsx +7 -2
- package/src/RenderPage.tsx +10 -6
- package/src/attributes-editor/Field.tsx +48 -160
- package/src/attributes-editor/SizeField.tsx +184 -0
- package/src/attributes-editor/SpecialCategorySection.tsx +10 -3
- package/src/build-components/BackgroundImage/BackgroundImage.tsx +7 -17
- package/src/build-components/BackgroundImage/BackgroundImageProps.generated.ts +1 -0
- package/src/build-components/Button/Button.tsx +7 -9
- package/src/build-components/Button/ButtonProps.generated.ts +1 -0
- package/src/build-components/Carousel/Carousel.tsx +7 -9
- package/src/build-components/Carousel/CarouselProps.generated.ts +1 -0
- package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +1 -0
- package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +1 -0
- package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +1 -0
- package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +1 -0
- package/src/build-components/Image/Image.tsx +11 -18
- package/src/build-components/Image/ImageProps.generated.ts +1 -0
- package/src/build-components/Image/pattern.json +1 -9
- package/src/build-components/Onboard/OnboardProps.generated.ts +1 -0
- package/src/build-components/OnboardButton/OnboardButton.tsx +0 -3
- package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +1 -1
- package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +1 -0
- package/src/build-components/OnboardDot/OnboardDot.tsx +59 -39
- package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +2 -3
- package/src/build-components/OnboardDot/pattern.json +2 -18
- package/src/build-components/OnboardFooter/OnboardFooter.tsx +28 -15
- package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +1 -0
- package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +2 -1
- package/src/build-components/OnboardItem/OnboardItem.tsx +1 -11
- package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +1 -0
- package/src/build-components/OnboardProvider/OnboardProvider.tsx +1 -8
- package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +1 -0
- package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +1 -0
- package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +1 -0
- package/src/build-components/Text/Text.tsx +9 -15
- package/src/build-components/Text/TextProps.generated.ts +1 -0
- package/src/build-components/View/View.tsx +7 -9
- package/src/build-components/View/ViewProps.generated.ts +1 -0
- package/src/build-components/View/pattern.json +9 -1
- package/src/build-components/patterns.generated.ts +194 -57
- package/src/components/Builder.tsx +61 -17
- package/src/components/DeviceNavigationBar.tsx +0 -1
- package/src/components/EditorHeader.tsx +11 -1
- package/src/components/JsonTextEditor.tsx +185 -0
- package/src/mockOS/components/MockOSRouter.tsx +6 -0
- package/src/mockOS/context/MockOSContext.tsx +0 -5
- package/src/mockOS/managers/mockPermissionManager.ts +0 -4
- package/src/mockOS/managers/navigationManager.ts +1 -6
- package/src/modals/ColorModal.tsx +103 -25
- package/src/modals/LocalicationModal.tsx +4 -5
- package/src/modals/Modal.tsx +8 -1
- package/src/pages/ProjectPage.tsx +7 -1
- package/src/pages/tabs/SideTool.tsx +10 -9
- package/src/store.ts +5 -0
- package/src/styles/base/_global.scss +5 -0
- package/src/styles/components/_editor-shell.scss +4 -2
- package/src/styles/modals/_color-modal.scss +30 -1
- package/src/styles/utilities/_carousel.scss +9 -8
- package/src/utils/extractImageStyle.ts +3 -6
- package/src/utils/extractTextStyle.ts +2 -81
- package/src/utils/extractViewStyle.ts +20 -15
- package/src/utils/selection.ts +24 -0
- package/src/utils/useMergedStyle.ts +16 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { Node } from '../..';
|
|
2
3
|
type SideToolProps = {
|
|
3
4
|
data: Node;
|
|
4
|
-
setData:
|
|
5
|
+
setData: React.Dispatch<React.SetStateAction<Node>>;
|
|
5
6
|
};
|
|
6
7
|
export declare function SideTool({ data, setData }: SideToolProps): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
package/dist/store.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ type RenderStore = {
|
|
|
7
7
|
setCopiedNode: (node: Node | null) => void;
|
|
8
8
|
current: Node | null;
|
|
9
9
|
setCurrent: (node: Node | null) => void;
|
|
10
|
+
forceRender: number;
|
|
11
|
+
incForceRender: () => void;
|
|
10
12
|
device: Device;
|
|
11
13
|
setDevice: (device: Device) => void;
|
|
12
14
|
appConfig: AppConfig;
|
package/dist/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
*,*::before,*::after{box-sizing:border-box}html,body,#root{height:100%;margin:0;padding:0}body{background:#fff;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;overflow:hidden}button{font-family:inherit}input,button{font-size:100%}p{margin:0;padding:0}html,body,#root{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol",sans-serif}.editor-container{height:100vh;width:100%;display:flex;overflow:hidden}.app-main{flex:1 1 auto;background:#f3f4f6}.page-bg{background:#f3f4f6}.grid-cards{display:grid;grid-template-columns:repeat(auto-fill, minmax(160px, 1fr));gap:16px}.btn-add{height:120px;border:2px dashed #6b7280;border-radius:8px;background:#fff;cursor:pointer;font-weight:600;color:#111827;transition:border-color .2s ease,transform .1s ease,box-shadow .2s ease;box-shadow:0 1px 2px rgba(0,0,0,.04)}.btn-add:hover{border-color:hsl(220,8.9361702128%,36.0784313725%);transform:translateY(-1px);box-shadow:0 6px 16px rgba(0,0,0,.1)}.split-left{scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.25) rgba(0,0,0,0)}.split-left::-webkit-scrollbar{width:8px;height:4px}.split-left{flex:1 1 10%;min-width:200px;border-right:1px solid #e5e7eb;overflow:auto}.split-right{position:relative;flex:1 1 45%;min-width:450px;max-height:calc(100vh + 60px);padding:16px;padding-bottom:120px;overflow:auto}.split-right__controls{position:absolute;top:12px;z-index:2;display:flex;margin-bottom:12px}.split-third{flex:1 1 25%;border-right:1px solid #e5e7eb;overflow:auto;max-height:calc(100vh - 120px)}.split-right-background{position:absolute;top:0;left:0;right:0;bottom:0;height:calc(100vh + 60px);background-size:cover;background-position:center;background-repeat:repeat;background-size:500px auto;opacity:.2;z-index:0;pointer-events:none}.stage-wrapper{display:flex;justify-content:center;background:rgba(0,0,0,0);padding:16px;position:relative;z-index:1}.stage{background:#fff;border:1px solid #e5e7eb;border-radius:4px;border:1px solid #e5e7eb;overflow:hidden}.stage .scroll-container::-webkit-scrollbar{width:8px;height:8px}.stage .scroll-container::-webkit-scrollbar-track{background:rgba(0,0,0,0)}.stage .scroll-container::-webkit-scrollbar-thumb{background:rgba(0,0,0,.25);border-radius:8px}.stage .scroll-container{scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.25) rgba(0,0,0,0)}.app-header{position:sticky;top:0;z-index:10;background:#fff;border-bottom:1px solid #e5e7eb;height:60px;padding:0 16px;display:flex;align-items:center;justify-content:space-between}.app-header a{color:#111827;text-decoration:none}.app-header__brand{font-weight:700}.app-header__nav{display:flex;gap:16px}.warning{color:#ef4444;font-size:12px;font-weight:600;margin-bottom:16px}.breadcrumb{display:flex;align-items:center;gap:12px;font-size:12px;color:#6b7280}.breadcrumb__back{display:inline-flex;align-items:center;gap:4px;padding:0;border:none;background:none;color:#111827;font-weight:600;cursor:pointer;transition:color .2s ease}.breadcrumb__back:hover,.breadcrumb__back:focus-visible{color:#2563eb;outline:none}.breadcrumb__back-icon{font-size:14px;line-height:1}.breadcrumb__list{list-style:none;padding:0;margin:0;display:flex;align-items:center;gap:8px}.breadcrumb__item{display:inline-flex;align-items:center}.breadcrumb__item--clickable{cursor:pointer}.breadcrumb__separator{color:#e5e7eb;margin:0 4px}.breadcrumb__link{color:#111827;text-decoration:none}.breadcrumb__link:hover{text-decoration:underline}.breadcrumb__current{color:#6b7280}.device-status-bar{position:relative;z-index:100}.device-navigation-bar{position:relative;z-index:100}.mobile-panel-toggle{display:none;padding:0 16px 12px;gap:8px}.mobile-panel-toggle__button{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:12px;border-radius:8px;border:1px solid #e5e7eb;background:#fff;color:#111827;font-weight:600;cursor:pointer;transition:background .2s ease,color .2s ease,border-color .2s ease,box-shadow .2s ease}.mobile-panel-toggle__button:focus-visible{outline:2px solid #2563eb;outline-offset:2px}.mobile-panel-toggle__button--active{background:#111827;color:#fff;border-color:#111827;box-shadow:0 6px 16px rgba(0,0,0,.15)}.mobile-panel-toggle__icon{width:18px;height:12px;display:inline-flex}.mobile-panel-toggle__icon svg{width:100%;height:100%}.mobile-panel-toggle__label{line-height:1}.split-panel__close{display:none;position:absolute;top:12px;right:12px;border:none;border-radius:8px;background:rgba(0,0,0,.7);color:#fff;padding:6px 16px;font-weight:600;cursor:pointer;z-index:5}.editor-container__overlay{display:none}@media(max-width: 1000px){.editor-container{position:relative;min-height:calc(100vh - 60px);flex-direction:column}.split-left,.split-third{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;background:#f3f4f6;box-shadow:0 25px 60px rgba(0,0,0,.15);transition:transform .3s ease,opacity .3s ease;opacity:0;pointer-events:none;z-index:4}.split-left{transform:translate3d(-100%, 0, 0)}.split-third{transform:translate3d(100%, 0, 0)}.split-left.is-open,.split-third.is-open{opacity:1;pointer-events:auto;transform:translate3d(0, 0, 0)}.split-right{flex:1 1 auto;min-width:0;min-height:calc(100vh - 120px);padding:16px;padding-bottom:120px;position:relative}.mobile-panel-toggle{display:flex}.split-panel__close{display:inline-flex}.editor-container__overlay{display:block;position:absolute;inset:0;background:rgba(17,24,39,.35);border:none;padding:0;margin:0;cursor:pointer;z-index:3}}@media(max-width: 900px){.split-right__controls{top:12px;z-index:5;padding-bottom:12px}.split-right__controls .side-tool{width:100%}}.builder{display:flex;flex-direction:column;gap:12px}.builder__breadcrumbs{display:flex;flex-direction:row;gap:8px}.builder__breadcrumb{color:#6b7280;font-size:12px}.builder__current{font-weight:600}.builder__list{display:flex;flex-wrap:wrap;gap:8px}.builder__list-item{flex:1 1 220px;min-width:220px}.builder__button{position:relative;display:flex;align-items:stretch}.builder__button>.builder__button-link{flex:1;min-width:0;display:flex;align-items:center;background:#fff;border:1px solid #e5e7eb;border-radius:4px;height:40px;line-height:37px;padding:0 4px;margin:0;background:#2563eb;color:#fff;font-size:clamp(11px,1.3vw,13px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.builder__sort-controls{display:flex;flex-direction:column;gap:4px}.builder__sort-button{width:32px;height:18px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;font-size:14px;cursor:pointer;line-height:1;box-shadow:inset 0 0 0 1px #e5e7eb;padding:0}.builder__sort-button:disabled{opacity:.4;cursor:not-allowed}.builder__button-condition{position:absolute;bottom:-10px;font-size:8px}.builder__node{background:#fff;border:1px solid #e5e7eb;border-radius:4px;padding:6px}.builder__node-type{margin:0 0 8px 0;font-weight:600}.builder__children{position:relative;display:flex;flex-direction:column;gap:16px}.builder__children>:not(:first-child){margin-left:16px}.builder__children::before{content:"";position:absolute;left:6px;top:24px;bottom:0;width:1px;background:#e5e7eb}.builder__text,.builder__placeholder{color:#6b7280;font-size:12px}.editor-controls{display:grid;grid-template-columns:auto 1fr;gap:12px;padding:16px}.editor-section{background:#fff;border:1px solid #e5e7eb;border-radius:8px;padding:16px}.form-row{display:grid;grid-template-columns:160px 1fr;align-items:center;gap:12px;margin-bottom:12px}.form-actions{display:flex;gap:12px;margin-top:16px}.btn{padding:8px 12px;border-radius:8px;border:1px solid #e5e7eb;background:#fff;cursor:pointer;transition:background .2s ease,box-shadow .2s ease}.btn:hover{background:#f9fafb;box-shadow:0 6px 16px rgba(0,0,0,.06)}.input{display:inline-flex;align-items:center;height:32px;padding:0 8px;border:1px solid #e5e7eb;border-radius:8px;background:#fff;color:#111827;font:inherit;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.input:focus{border-color:hsl(220,13.0434782609%,82.9803921569%);box-shadow:0 0 0 3px rgba(0,0,0,.04)}.input--color{padding:0;width:40px;height:28px;border-radius:6px;cursor:pointer}.input--color::-webkit-color-swatch-wrapper{padding:0}.input--color::-webkit-color-swatch{border:none;border-radius:4px}.input--color::-moz-color-swatch{border:none;border-radius:4px}.builder-checkbox{display:inline-flex;flex-direction:column;gap:4px}.builder-checkbox__label{display:inline-flex;align-items:center;gap:10px;cursor:pointer;color:#111827;font-weight:600;position:relative;user-select:none}.builder-checkbox__native{position:absolute;opacity:0;pointer-events:none;width:1px;height:1px}.builder-checkbox__control{width:20px;height:20px;border-radius:6px;border:2px solid #e5e7eb;background:#fff;display:inline-flex;align-items:center;justify-content:center;transition:background .2s ease,border-color .2s ease,box-shadow .2s ease,transform .2s ease;box-shadow:0 2px 6px rgba(15,23,42,.12)}.builder-checkbox__control::after{content:"";width:6px;height:12px;border-right:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0);transform:rotate(45deg) scale(0);transform-origin:center;transition:transform .2s ease,border-color .2s ease}.builder-checkbox__label:hover .builder-checkbox__control{transform:translateY(-1px)}.builder-checkbox__native:focus-visible+.builder-checkbox__control{box-shadow:0 0 0 3px rgba(79,70,229,.3)}.builder-checkbox__native:checked+.builder-checkbox__control{background:linear-gradient(135deg, #1f2937, #4f46e5);border-color:rgba(0,0,0,0);box-shadow:0 6px 14px rgba(79,70,229,.35)}.builder-checkbox__native:checked+.builder-checkbox__control::after{border-color:#fff;transform:rotate(45deg) scale(1)}.builder-checkbox__text{font-size:14px;line-height:1.4}.builder-checkbox__helper{font-size:12px;color:#6b7280;margin-left:30px}.builder-checkbox--disabled{opacity:.6}.builder-checkbox--disabled .builder-checkbox__label{cursor:not-allowed}.editor-tabs{display:flex;gap:8px;border-bottom:1px solid #e5e7eb}.editor-tab{cursor:pointer;border:1px solid rgba(0,0,0,0);border-top-left-radius:4px;border-top-right-radius:4px;color:#111827;padding:8px 12px;display:inline-flex;align-items:center;white-space:nowrap}.editor-tab__label{display:inline-flex;align-items:center;white-space:nowrap;line-height:1.2;font-size:clamp(.85rem,.9rem + .2vw,1rem)}.editor-tab--active{background:#fff;border-color:#e5e7eb #e5e7eb #fff #e5e7eb}.editor-panels{padding:12px}.editor-panels.editor-panels-debug{padding:0}.jer-editor-container{padding-left:0 !important;padding-right:0 !important}.editor-panel{display:none}.editor-panel--active{display:block}.editor-header{display:flex;align-items:center;gap:12px;padding:0 16px;height:60px;background:#f3f4f6;border-bottom:1px solid #e5e7eb}.editor-header__title{color:#111827;font-weight:600}.editor-header__devices{scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.25) rgba(0,0,0,0)}.editor-header__devices::-webkit-scrollbar{width:8px;height:4px}.editor-header__devices{display:flex;flex-direction:row;align-items:stretch;gap:8px;overflow:auto;height:60px;padding:4px}.editor-device-button{position:relative;min-width:160px;height:100%;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#111827;cursor:pointer;font-size:12px}.editor-device-button.editor-device-button--selected{border-color:#000}.editor-device-button img{position:absolute;bottom:4px;right:4px;width:16px;height:16px}.editor-header__actions{margin-left:auto;display:flex;align-items:center;gap:8px}.editor-button{display:inline-flex;align-items:center;justify-content:center;height:36px;min-width:120px;padding:0 12px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#111827;cursor:pointer}.debug-button{min-width:auto;height:auto;padding:4px 12px;font-size:12px;line-height:1.2;border-radius:999px;background:hsla(0,0%,100%,.95);border-color:rgba(15,23,42,.15);box-shadow:0 2px 4px rgba(15,23,42,.08)}.debug-button:hover{background:#fff;border-color:rgba(15,23,42,.3)}.editor-button:disabled{opacity:.6;cursor:default}.editor-save-button,.editor-save-previewconfig-button{color:#000;font-weight:600;font-size:12px}.builder__add-button{width:100%;margin-top:12px;min-height:52px;border-style:dashed;border-color:#cbd5f5;background:#f8fafc;color:#0f172a;font-weight:600;gap:10px;transition:border-color .2s ease,background .2s ease,color .2s ease}.builder__add-button-icon{display:inline-flex;width:28px;height:28px;border-radius:999px;align-items:center;justify-content:center;background:#2563eb;color:#fff;font-size:18px;line-height:1}.builder__add-button:hover{border-color:#94a3b8;background:#eef2ff;color:#111827}.side-tool{display:flex;flex-direction:column;gap:4px;padding:4px;border-radius:4px;border:1px solid #e5e7eb;font-size:11px;max-width:220px}.side-tool select{width:100%;font-size:11px;padding:4px 6px}.side-tool .debug-button{border-radius:0;width:100%;justify-content:center}.attributes-editor__component-meta{margin-bottom:20px;padding:12px 16px;border-radius:8px;border:1px solid #eee;background:#f8f8f8}.attributes-editor__component-title,.attributes-editor__field-label{margin:0;font-weight:700}.attributes-editor__component-title{font-size:18px;text-transform:capitalize}.attributes-editor__component-description{margin:6px 0 0;font-size:14px;color:#555}.attributes-editor__tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}.attributes-editor__tab-button{padding:6px 12px;border-radius:6px;border:1px solid #ddd;background:#fff;color:#222;cursor:pointer;font-weight:600;transition:background .15s ease,color .15s ease}.attributes-editor__tab-button:disabled{opacity:.4;cursor:default}.attributes-editor__tab-button--active{background:#222;color:#fff}.attributes-editor__field-wrapper{position:relative;margin-bottom:16px;display:flex;flex-direction:column;gap:4px;width:100%}.attributes-editor__field-wrapper--boolean{flex-direction:row;align-items:center;gap:8px}.attributes-editor__field-label{font-size:14px}.attributes-editor__empty-state{padding:8px;opacity:.7}.attributes-editor__size-grid{display:flex;gap:12px;flex-wrap:wrap}.attributes-editor__size-grid-item{flex:1;min-width:140px;max-width:220px}.attributes-editor__size-field{display:flex;gap:6px;align-items:center;width:100%}.attributes-editor__size-field-input{flex:1;min-width:0;height:36px;line-height:36px}.attributes-editor__size-field-select{flex:0 0 72px;min-width:60px;height:36px;line-height:36px;padding-inline:6px}.field-info-tooltip{position:relative}.field-info-tooltip__trigger{position:absolute;top:0;right:0;font-size:11px;line-height:1.2;color:#666;cursor:pointer;font-weight:600;white-space:nowrap;text-transform:uppercase;letter-spacing:.5px;background:rgba(0,0,0,0);border:none;padding:0;font-family:inherit;display:inline-flex;align-items:center;gap:4px}.field-info-tooltip__trigger:focus-visible{outline:2px solid rgba(17,24,39,.4);outline-offset:2px}.field-info-tooltip__bubble{position:absolute;top:50%;right:100%;transform:translate(-8px, -50%);background:#111;color:#fff;padding:6px 10px;border-radius:4px;font-size:12px;line-height:1.4;width:220px;text-align:left;box-shadow:0 6px 16px rgba(0,0,0,.2);z-index:20;opacity:0;pointer-events:none;transition:opacity .15s ease,transform .15s ease}.field-info-tooltip__bubble--visible{opacity:1;transform:translate(-12px, -50%)}.special-category-section{border:1px solid #e0e0e0;border-radius:8px;padding:12px;margin-bottom:16px;background:#fdfdfd}.special-category-section__header{display:flex;justify-content:space-between;align-items:center;gap:8px}.special-category-section__title{margin:0;font-weight:700}.special-category-section__toggle{border:1px solid #ddd;background:#fff;color:#222;border-radius:4px;padding:4px 10px;cursor:pointer;font-weight:600;transition:background .15s ease,color .15s ease,border-color .15s ease}.special-category-section__toggle[data-active=true]{background:#222;color:#fff;border-color:#222}.special-category-section__description{margin:8px 0 0;color:#666;font-size:13px;padding-bottom:16px}.special-category-section__fields{display:grid;gap:8px;margin-top:12px}.special-category-section__fields--box{grid-template-columns:repeat(2, minmax(0, 1fr));grid-template-areas:"top top" "left right" "bottom bottom"}.special-category-section__fields--box>.field-info-tooltip:has([data-field-slot=top]){grid-area:top}.special-category-section__fields--box>.field-info-tooltip:has([data-field-slot=left]){grid-area:left}.special-category-section__fields--box>.field-info-tooltip:has([data-field-slot=right]){grid-area:right}.special-category-section__fields--box>.field-info-tooltip:has([data-field-slot=bottom]){grid-area:bottom}@media(max-width: 1400px){.special-category-section__fields--box{grid-template-columns:minmax(0, 1fr);grid-template-areas:"top" "left" "right" "bottom"}}.special-category-section__field{min-width:0}.special-category-section__placeholder{margin-top:8px;font-style:italic;opacity:.7}.mockos-router{width:100%;height:100%;position:relative}.mockos-screen{width:100%;height:100%}.mockos-screen--center{display:flex;flex-direction:column;align-items:center;justify-content:center}.mockos-screen--launchscreen{background-color:#000}.mockos-screen--home{padding:20px;background-color:#f5f5f5}.mockos-screen--onboard{padding:20px;background-color:#fff}.mockos-screen--subscription{padding:20px;background-color:#fff}.mockos-screen__title{font-size:32px;font-weight:bold;color:#000;margin-bottom:16px}.mockos-screen__subtitle{font-size:16px;color:#666}.mockos-screen__heading{font-size:24px;font-weight:bold;margin-bottom:20px}.mockos-screen__text{font-size:16px;color:#333;margin-bottom:12px}.mockos-screen__plan{padding:16px;border-radius:8px;text-align:center;margin-bottom:12px}.mockos-screen__plan--premium{background-color:#007aff;color:#fff}.mockos-screen__plan--basic{background-color:#e5e5e5;color:#333}.mockos-launcher{width:100%;height:100%;padding:40px 20px;display:flex;flex-direction:column}.mockos-launcher__grid{display:grid;grid-template-columns:repeat(4, 1fr);gap:20px;padding:20px}.mockos-launcher__app{display:flex;flex-direction:column;align-items:center;gap:8px;background:rgba(0,0,0,0);border:none;cursor:pointer;padding:8px;border-radius:12px;transition:background-color .2s}.mockos-launcher__app:hover{background-color:hsla(0,0%,100%,.1)}.mockos-launcher__app:active{transform:scale(0.95)}.mockos-launcher__app-icon{width:60px;height:60px;border-radius:13px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,.3)}.mockos-launcher__app-icon svg{width:100%;height:100%;display:block}.mockos-launcher__app-name{font-size:12px;color:#fff;text-align:center;max-width:70px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.modal{position:fixed;inset:0;z-index:10000}.modal__overlay{position:absolute;inset:0;background:rgba(0,0,0,.4);z-index:0}.modal__content{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);background:#fff;border-radius:12px;box-shadow:0 10px 30px rgba(0,0,0,.12);width:min(960px,100vw - 40px);max-height:calc(100vh - 120px);display:flex;flex-direction:column;overflow:hidden;z-index:1}.modal__header{display:flex;align-items:center;justify-content:space-between;padding:16px 24px;border-bottom:1px solid #e5e7eb;gap:12px}.modal__title{margin:0;font-size:16px;font-weight:700}.add-component-modal{display:flex;flex-direction:column;height:100%}.add-component-modal__body{flex:1;overflow-y:auto;padding-bottom:24px}.add-component-modal__section{padding:0 24px;margin-bottom:24px}.add-component-modal__section:first-of-type{margin-top:24px}.add-component-modal__section-title{font-size:16px;font-weight:600;margin-bottom:12px}.add-component-modal__toggle{display:flex;align-items:center;gap:12px;margin:0 24px 24px;padding:12px 0;font-weight:500;user-select:none}.add-component-modal__toggle input{width:18px;height:18px}.add-component-modal__group{background:#fff;border:1px solid #e5e7eb;border-radius:12px;padding:16px;margin-bottom:12px;box-shadow:0 10px 20px rgba(15,23,42,.05)}.add-component-modal__group-title{font-size:14px;font-weight:600;color:#6b7280;margin-bottom:12px}.add-component-modal__grid{padding:16px;display:grid;grid-template-columns:repeat(auto-fill, minmax(180px, 1fr));gap:12px;overflow:auto}.add-component-modal__card{display:flex;flex-direction:column;gap:12px;padding:12px;border:1px solid #e5e7eb;border-radius:10px;background:#f3f4f6;cursor:pointer;text-align:left;transition:border-color .2s ease,box-shadow .2s ease,transform .2s ease;color:inherit}.add-component-modal__card:hover{border-color:#2563eb;box-shadow:0 10px 25px rgba(37,99,235,.15);transform:translateY(-2px)}.add-component-modal__thumbnail{width:100%;aspect-ratio:4/3;border-radius:8px;background:#f3f4f6;border:1px dashed #e5e7eb;display:flex;align-items:center;justify-content:center;color:#2563eb;font-weight:600;font-size:12px;text-transform:uppercase;letter-spacing:.05em}.add-component-modal__title{font-weight:600;color:#111827}.add-component-modal__empty{margin:12px 0;padding:16px;border:1px dashed #e5e7eb;border-radius:10px;color:#6b7280;font-size:14px;text-align:center}.device-selector-modal{padding-bottom:24px}.device-selector-modal__grid{padding:24px;display:grid;grid-template-columns:repeat(auto-fill, minmax(180px, 1fr));gap:12px;overflow:auto}.device-selector-modal__grid .editor-device-button{height:80px;min-width:unset}.color-modal{width:min(520px,100vw - 32px);max-height:90vh;padding:24px;display:flex;flex-direction:column;gap:16px;overflow-y:auto}.color-modal__selected{display:flex;align-items:center;justify-content:space-between;background:#f3f4f6;border-radius:8px;padding:12px 16px}.color-modal__selected-info{display:flex;align-items:center;gap:12px}.color-modal__selected-preview{width:32px;height:32px;border-radius:6px;border:1px solid rgba(0,0,0,.1)}.color-modal__selected-label{margin:0;font-size:12px;color:#6b7280}.color-modal__selected-value{margin:0;font-weight:600}.color-modal__toggle{display:flex;flex-direction:column;gap:6px;padding:0 8px}.color-modal__toggle-label{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:600;color:#111827;cursor:pointer}.color-modal__toggle-input{width:16px;height:16px;accent-color:#2563eb}.color-modal__toggle-description{margin:0;font-size:12px;color:#6b7280}.color-modal__link-button{border:none;background:none;color:#2563eb;font-weight:600;font-size:13px;cursor:pointer;padding:4px 8px}.color-section{display:flex;flex-direction:column;gap:8px}.color-section__header{display:flex;align-items:center;justify-content:space-between;gap:8px}.color-section__title{margin:0;font-weight:600}.color-section__swatches{display:grid;grid-template-columns:repeat(auto-fill, minmax(120px, 1fr));gap:8px}.color-section__empty{margin:0;font-size:12px;color:#6b7280}.color-modal__swatch{border:1px solid #e5e7eb;border-radius:8px;padding:8px;background:#fff;display:flex;flex-direction:column;gap:6px;text-align:left;cursor:pointer;transition:border-color .2s ease,box-shadow .2s ease}.color-modal__swatch--active{border-color:#111827;box-shadow:0 0 0 1px #111827 inset}.color-modal__swatch-preview{width:100%;height:32px;border-radius:6px}.color-modal__swatch-preview--light{border:1px solid rgba(0,0,0,.1)}.color-modal__swatch-label{font-size:12px;font-weight:600;color:#111827}.color-modal__swatch-value{font-size:11px;color:#6b7280}.color-modal__input{display:none}.localication-modal__content{width:calc(100vw - 32px);height:calc(100vh - 32px);max-width:1600px;max-height:calc(100vh - 32px);padding:0;display:flex;flex-direction:column}.localication-modal__header{padding:16px 24px;border-bottom:1px solid #e5e7eb;display:flex;align-items:center;gap:16px}.localication-modal__header-main{flex:1;display:flex;flex-direction:column;gap:4px}.localication-modal__description{margin:0;font-size:13px;color:#6b7280}.localication-modal__body{flex:1;min-height:0;padding:24px;display:flex;flex-direction:column;gap:16px;overflow:auto}.localication-modal__editor{flex:1;min-height:0;overflow:auto;border:1px solid #e5e7eb;border-radius:8px;background:#f3f4f6}.localication-modal__json-editor{height:100%;width:100%;display:block;padding:12px;overflow:auto}.modal--scrollable .localication-modal__content{overflow:hidden}.modal--scrollable .localication-modal__body{overflow:auto}.embla{max-width:48rem;margin:auto;--slide-height: 19rem;--slide-spacing: 1rem;--slide-size: 70%}.embla__viewport{overflow:hidden}.embla__container{display:flex;touch-action:pan-y pinch-zoom;margin-left:calc(var(--slide-spacing)*-1)}.embla__slide{transform:translate3d(0, 0, 0);min-width:0;padding-left:var(--slide-spacing);flex:0 0 100%}.embla__slide__number{box-shadow:inset 0 0 0 .2rem var(--detail-medium-contrast);border-radius:1.8rem;font-size:4rem;font-weight:600;display:flex;align-items:center;justify-content:center;height:var(--slide-height);user-select:none}.embla__controls{display:grid;grid-template-columns:auto 1fr;justify-content:space-between;gap:1.2rem;margin-top:1.8rem}.embla__buttons{display:grid;grid-template-columns:repeat(2, 1fr);gap:.6rem;align-items:center}.embla__button{-webkit-tap-highlight-color:rgba(var(--text-high-contrast-rgb-value), 0.5);-webkit-appearance:none;appearance:none;background-color:rgba(0,0,0,0);touch-action:manipulation;display:inline-flex;text-decoration:none;cursor:pointer;border:0;padding:0;margin:0;box-shadow:inset 0 0 0 .2rem var(--detail-medium-contrast);width:3.6rem;height:3.6rem;z-index:1;border-radius:50%;color:var(--text-body);display:flex;align-items:center;justify-content:center}.embla__button:disabled{color:var(--detail-high-contrast)}.embla__button__svg{width:35%;height:35%}.embla__dots{flex-wrap:wrap;margin-right:0;height:50px;margin:0 auto}.embla__dot{-webkit-tap-highlight-color:rgba(var(--text-high-contrast-rgb-value), 0.5);-webkit-appearance:none;appearance:none;background-color:rgba(0,0,0,0);touch-action:manipulation;display:inline-flex;text-decoration:none;cursor:pointer;border:0;padding:0;margin:0;width:2.6rem;height:2.6rem;display:flex;align-items:center;border-radius:50%}.embla__dot:after{box-shadow:inset 0 0 0 .2rem var(--detail-medium-contrast);width:1.4rem;height:1.4rem;border-radius:50%;display:flex;align-items:center;content:""}.embla__dot--selected:after{box-shadow:inset 0 0 0 .2rem var(--text-body)}.carousel-provider{height:100%}.embla{height:100%}.embla__viewport{height:100%;display:flex;flex-direction:column}.embla__container{flex:1}
|
|
1
|
+
*,*::before,*::after{box-sizing:border-box}html,body,#root{height:100%;margin:0;padding:0}body{background:#fff;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;overflow:hidden}button{font-family:inherit}input,button{font-size:100%}p{margin:0;padding:0}html,body,#root{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol",sans-serif}.editor-container{height:100vh;width:100%;display:flex;overflow:hidden}.app-main{flex:1 1 auto;background:#f3f4f6}.page-bg{background:#f3f4f6}.grid-cards{display:grid;grid-template-columns:repeat(auto-fill, minmax(160px, 1fr));gap:16px}.btn-add{height:120px;border:2px dashed #6b7280;border-radius:8px;background:#fff;cursor:pointer;font-weight:600;color:#111827;transition:border-color .2s ease,transform .1s ease,box-shadow .2s ease;box-shadow:0 1px 2px rgba(0,0,0,.04)}.btn-add:hover{border-color:hsl(220,8.9361702128%,36.0784313725%);transform:translateY(-1px);box-shadow:0 6px 16px rgba(0,0,0,.1)}.split-left{scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.25) rgba(0,0,0,0)}.split-left::-webkit-scrollbar{width:8px;height:4px}.split-left{flex:1 1 10%;min-width:200px;border-right:1px solid #e5e7eb;overflow:auto}.split-right{position:relative;flex:1 1 45%;min-width:450px;max-height:calc(100vh + 60px);padding:16px;padding-bottom:120px;overflow:auto}.split-right__controls{position:absolute;top:12px;z-index:2;display:flex;margin-bottom:12px}.split-third{flex:1 1 25%;border-right:1px solid #e5e7eb;overflow:auto;max-height:calc(100vh - 120px)}.split-right-background{position:absolute;top:0;left:0;right:0;bottom:0;height:calc(100vh + 60px);background-size:cover;background-position:center;background-repeat:repeat;background-size:500px auto;opacity:.2;z-index:0;pointer-events:none}.stage-wrapper{display:flex;justify-content:center;background:rgba(0,0,0,0);padding:16px;position:relative;z-index:1}.stage{background:#fff;border:1px solid #e5e7eb;border-radius:4px;border:1px solid #e5e7eb;overflow:hidden}.stage .scroll-container::-webkit-scrollbar{width:8px;height:8px}.stage .scroll-container::-webkit-scrollbar-track{background:rgba(0,0,0,0)}.stage .scroll-container::-webkit-scrollbar-thumb{background:rgba(0,0,0,.25);border-radius:8px}.stage .scroll-container{scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.25) rgba(0,0,0,0)}.rb-node-selected{border:1px solid #2684ff}.app-header{position:sticky;top:0;z-index:10;background:#fff;border-bottom:1px solid #e5e7eb;height:60px;padding:0 16px;display:flex;align-items:center;justify-content:space-between}.app-header a{color:#111827;text-decoration:none}.app-header__brand{font-weight:700}.app-header__nav{display:flex;gap:16px}.warning{color:#ef4444;font-size:12px;font-weight:600;margin-bottom:16px}.breadcrumb{display:flex;align-items:center;gap:12px;font-size:12px;color:#6b7280}.breadcrumb__back{display:inline-flex;align-items:center;gap:4px;padding:0;border:none;background:none;color:#111827;font-weight:600;cursor:pointer;transition:color .2s ease}.breadcrumb__back:hover,.breadcrumb__back:focus-visible{color:#2563eb;outline:none}.breadcrumb__back-icon{font-size:14px;line-height:1}.breadcrumb__list{list-style:none;padding:0;margin:0;display:flex;align-items:center;gap:8px}.breadcrumb__item{display:inline-flex;align-items:center}.breadcrumb__item--clickable{cursor:pointer}.breadcrumb__separator{color:#e5e7eb;margin:0 4px}.breadcrumb__link{color:#111827;text-decoration:none}.breadcrumb__link:hover{text-decoration:underline}.breadcrumb__current{color:#6b7280}.device-status-bar{position:relative;z-index:100}.device-navigation-bar{position:relative;z-index:100}.mobile-panel-toggle{display:none;padding:0 16px 12px;gap:8px}.mobile-panel-toggle__button{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:12px;border-radius:8px;border:1px solid #e5e7eb;background:#fff;color:#111827;font-weight:600;cursor:pointer;transition:background .2s ease,color .2s ease,border-color .2s ease,box-shadow .2s ease}.mobile-panel-toggle__button:focus-visible{outline:2px solid #2563eb;outline-offset:2px}.mobile-panel-toggle__button--active{background:#111827;color:#fff;border-color:#111827;box-shadow:0 6px 16px rgba(0,0,0,.15)}.mobile-panel-toggle__icon{width:18px;height:12px;display:inline-flex}.mobile-panel-toggle__icon svg{width:100%;height:100%}.mobile-panel-toggle__label{line-height:1}.split-panel__close{display:none;position:absolute;top:12px;right:12px;border:none;border-radius:8px;background:rgba(0,0,0,.7);color:#fff;padding:6px 16px;font-weight:600;cursor:pointer;z-index:5}.editor-container__overlay{display:none}@media(max-width: 1000px){.editor-container{position:relative;min-height:calc(100vh - 60px);flex-direction:column}.split-left,.split-third{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;background:#f3f4f6;box-shadow:0 25px 60px rgba(0,0,0,.15);transition:transform .3s ease,opacity .3s ease;opacity:0;pointer-events:none;z-index:4}.split-left{transform:translate3d(-100%, 0, 0)}.split-third{transform:translate3d(100%, 0, 0)}.split-left.is-open,.split-third.is-open{opacity:1;pointer-events:auto;transform:translate3d(0, 0, 0)}.split-right{flex:1 1 auto;min-width:0;min-height:calc(100vh - 120px);padding:16px;padding-bottom:120px;position:relative}.mobile-panel-toggle{display:flex}.split-panel__close{display:inline-flex}.editor-container__overlay{display:block;position:absolute;inset:0;background:rgba(17,24,39,.35);border:none;padding:0;margin:0;cursor:pointer;z-index:3}}@media(max-width: 900px){.split-right__controls{top:12px;z-index:5;padding-bottom:12px}.split-right__controls .side-tool{width:100%}}.builder{display:flex;flex-direction:column;gap:12px}.builder__breadcrumbs{display:flex;flex-direction:row;gap:8px}.builder__breadcrumb{color:#6b7280;font-size:12px}.builder__current{font-weight:600}.builder__list{display:flex;flex-wrap:wrap;gap:8px}.builder__list-item{flex:1 1 220px;min-width:220px}.builder__button{position:relative;display:flex;align-items:stretch}.builder__button>.builder__button-link{flex:1;min-width:0;display:flex;align-items:center;background:#fff;border:1px solid #e5e7eb;border-radius:4px;height:40px;line-height:37px;padding:0 4px;margin:0;background:#2563eb;color:#fff;font-size:clamp(11px,1.3vw,13px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.builder__sort-controls{display:flex;flex-direction:column;gap:4px}.builder__sort-button{width:32px;height:18px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;font-size:14px;cursor:pointer;line-height:1;box-shadow:inset 0 0 0 1px #e5e7eb;padding:0}.builder__sort-button:disabled{opacity:.4;cursor:not-allowed}.builder__button-condition{position:absolute;bottom:-10px;font-size:8px}.builder__node{background:#fff;border:1px solid #e5e7eb;border-radius:4px;padding:6px}.builder__node-type{margin:0 0 8px 0;font-weight:600}.builder__children{position:relative;display:flex;flex-direction:column;gap:16px}.builder__children>:not(:first-child){margin-left:16px}.builder__children::before{content:"";position:absolute;left:6px;top:24px;bottom:0;width:1px;background:#e5e7eb}.builder__text,.builder__placeholder{color:#6b7280;font-size:12px}.editor-controls{display:grid;grid-template-columns:auto 1fr;gap:12px;padding:16px}.editor-section{background:#fff;border:1px solid #e5e7eb;border-radius:8px;padding:16px}.form-row{display:grid;grid-template-columns:160px 1fr;align-items:center;gap:12px;margin-bottom:12px}.form-actions{display:flex;gap:12px;margin-top:16px}.btn{padding:8px 12px;border-radius:8px;border:1px solid #e5e7eb;background:#fff;cursor:pointer;transition:background .2s ease,box-shadow .2s ease}.btn:hover{background:#f9fafb;box-shadow:0 6px 16px rgba(0,0,0,.06)}.input{display:inline-flex;align-items:center;height:32px;padding:0 8px;border:1px solid #e5e7eb;border-radius:8px;background:#fff;color:#111827;font:inherit;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.input:focus{border-color:hsl(220,13.0434782609%,82.9803921569%);box-shadow:0 0 0 3px rgba(0,0,0,.04)}.input--color{padding:0;width:40px;height:28px;border-radius:6px;cursor:pointer}.input--color::-webkit-color-swatch-wrapper{padding:0}.input--color::-webkit-color-swatch{border:none;border-radius:4px}.input--color::-moz-color-swatch{border:none;border-radius:4px}.builder-checkbox{display:inline-flex;flex-direction:column;gap:4px}.builder-checkbox__label{display:inline-flex;align-items:center;gap:10px;cursor:pointer;color:#111827;font-weight:600;position:relative;user-select:none}.builder-checkbox__native{position:absolute;opacity:0;pointer-events:none;width:1px;height:1px}.builder-checkbox__control{width:20px;height:20px;border-radius:6px;border:2px solid #e5e7eb;background:#fff;display:inline-flex;align-items:center;justify-content:center;transition:background .2s ease,border-color .2s ease,box-shadow .2s ease,transform .2s ease;box-shadow:0 2px 6px rgba(15,23,42,.12)}.builder-checkbox__control::after{content:"";width:6px;height:12px;border-right:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0);transform:rotate(45deg) scale(0);transform-origin:center;transition:transform .2s ease,border-color .2s ease}.builder-checkbox__label:hover .builder-checkbox__control{transform:translateY(-1px)}.builder-checkbox__native:focus-visible+.builder-checkbox__control{box-shadow:0 0 0 3px rgba(79,70,229,.3)}.builder-checkbox__native:checked+.builder-checkbox__control{background:linear-gradient(135deg, #1f2937, #4f46e5);border-color:rgba(0,0,0,0);box-shadow:0 6px 14px rgba(79,70,229,.35)}.builder-checkbox__native:checked+.builder-checkbox__control::after{border-color:#fff;transform:rotate(45deg) scale(1)}.builder-checkbox__text{font-size:14px;line-height:1.4}.builder-checkbox__helper{font-size:12px;color:#6b7280;margin-left:30px}.builder-checkbox--disabled{opacity:.6}.builder-checkbox--disabled .builder-checkbox__label{cursor:not-allowed}.editor-tabs{display:flex;gap:8px;border-bottom:1px solid #e5e7eb}.editor-tab{cursor:pointer;border:1px solid rgba(0,0,0,0);border-top-left-radius:4px;border-top-right-radius:4px;color:#111827;padding:8px 12px;display:inline-flex;align-items:center;white-space:nowrap}.editor-tab__label{display:inline-flex;align-items:center;white-space:nowrap;line-height:1.2;font-size:clamp(.85rem,.9rem + .2vw,1rem)}.editor-tab--active{background:#fff;border-color:#e5e7eb #e5e7eb #fff #e5e7eb}.editor-panels{padding:12px}.editor-panels.editor-panels-debug{padding:0}.jer-editor-container{padding-left:0 !important;padding-right:0 !important}.editor-panel{display:none}.editor-panel--active{display:block}.editor-header{display:flex;align-items:center;gap:12px;padding:0 16px;height:60px;background:#f3f4f6;border-bottom:1px solid #e5e7eb}.editor-header__title{color:#111827;font-weight:600}.editor-header__devices{scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.25) rgba(0,0,0,0)}.editor-header__devices::-webkit-scrollbar{width:8px;height:4px}.editor-header__devices{display:flex;flex-direction:row;align-items:stretch;gap:8px;overflow:auto;height:60px;padding:4px}.editor-device-button{position:relative;min-width:160px;height:100%;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#111827;cursor:pointer;font-size:12px}.editor-device-button.editor-device-button--selected{border-color:#000}.editor-device-button img{position:absolute;bottom:4px;right:4px;width:16px;height:16px}.editor-header__actions{margin-left:auto;display:flex;align-items:center;gap:8px}.editor-button{display:inline-flex;align-items:center;justify-content:center;height:36px;min-width:120px;padding:0 12px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#111827;cursor:pointer}.debug-button{min-width:auto;height:auto;padding:4px 12px;font-size:12px;line-height:1.2;border-radius:999px;background:hsla(0,0%,100%,.95);border-color:rgba(15,23,42,.15);box-shadow:0 2px 4px rgba(15,23,42,.08)}.debug-button:hover{background:#fff;border-color:rgba(15,23,42,.3)}.editor-button:disabled{opacity:.6;cursor:default}.editor-save-button,.editor-save-previewconfig-button{color:#000;font-weight:600;font-size:12px}.builder__add-button{width:100%;margin-top:12px;min-height:52px;border-style:dashed;border-color:#cbd5f5;background:#f8fafc;color:#0f172a;font-weight:600;gap:10px;transition:border-color .2s ease,background .2s ease,color .2s ease}.builder__add-button-icon{display:inline-flex;width:28px;height:28px;border-radius:999px;align-items:center;justify-content:center;background:#2563eb;color:#fff;font-size:18px;line-height:1}.builder__add-button:hover{border-color:#94a3b8;background:#eef2ff;color:#111827}.side-tool{display:flex;flex-direction:column;height:100%;max-width:220px;gap:4px;padding:4px;border-radius:4px;border:1px solid #e5e7eb;font-size:11xpx;background:#fff}.side-tool select{width:100%;font-size:11px;padding:4px 6px}.side-tool .debug-button{border-radius:0;width:100%;justify-content:center}.attributes-editor__component-meta{margin-bottom:20px;padding:12px 16px;border-radius:8px;border:1px solid #eee;background:#f8f8f8}.attributes-editor__component-title,.attributes-editor__field-label{margin:0;font-weight:700}.attributes-editor__component-title{font-size:18px;text-transform:capitalize}.attributes-editor__component-description{margin:6px 0 0;font-size:14px;color:#555}.attributes-editor__tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}.attributes-editor__tab-button{padding:6px 12px;border-radius:6px;border:1px solid #ddd;background:#fff;color:#222;cursor:pointer;font-weight:600;transition:background .15s ease,color .15s ease}.attributes-editor__tab-button:disabled{opacity:.4;cursor:default}.attributes-editor__tab-button--active{background:#222;color:#fff}.attributes-editor__field-wrapper{position:relative;margin-bottom:16px;display:flex;flex-direction:column;gap:4px;width:100%}.attributes-editor__field-wrapper--boolean{flex-direction:row;align-items:center;gap:8px}.attributes-editor__field-label{font-size:14px}.attributes-editor__empty-state{padding:8px;opacity:.7}.attributes-editor__size-grid{display:flex;gap:12px;flex-wrap:wrap}.attributes-editor__size-grid-item{flex:1;min-width:140px;max-width:220px}.attributes-editor__size-field{display:flex;gap:6px;align-items:center;width:100%}.attributes-editor__size-field-input{flex:1;min-width:0;height:36px;line-height:36px}.attributes-editor__size-field-select{flex:0 0 72px;min-width:60px;height:36px;line-height:36px;padding-inline:6px}.field-info-tooltip{position:relative}.field-info-tooltip__trigger{position:absolute;top:0;right:0;font-size:11px;line-height:1.2;color:#666;cursor:pointer;font-weight:600;white-space:nowrap;text-transform:uppercase;letter-spacing:.5px;background:rgba(0,0,0,0);border:none;padding:0;font-family:inherit;display:inline-flex;align-items:center;gap:4px}.field-info-tooltip__trigger:focus-visible{outline:2px solid rgba(17,24,39,.4);outline-offset:2px}.field-info-tooltip__bubble{position:absolute;top:50%;right:100%;transform:translate(-8px, -50%);background:#111;color:#fff;padding:6px 10px;border-radius:4px;font-size:12px;line-height:1.4;width:220px;text-align:left;box-shadow:0 6px 16px rgba(0,0,0,.2);z-index:20;opacity:0;pointer-events:none;transition:opacity .15s ease,transform .15s ease}.field-info-tooltip__bubble--visible{opacity:1;transform:translate(-12px, -50%)}.special-category-section{border:1px solid #e0e0e0;border-radius:8px;padding:12px;margin-bottom:16px;background:#fdfdfd}.special-category-section__header{display:flex;justify-content:space-between;align-items:center;gap:8px}.special-category-section__title{margin:0;font-weight:700}.special-category-section__toggle{border:1px solid #ddd;background:#fff;color:#222;border-radius:4px;padding:4px 10px;cursor:pointer;font-weight:600;transition:background .15s ease,color .15s ease,border-color .15s ease}.special-category-section__toggle[data-active=true]{background:#222;color:#fff;border-color:#222}.special-category-section__description{margin:8px 0 0;color:#666;font-size:13px;padding-bottom:16px}.special-category-section__fields{display:grid;gap:8px;margin-top:12px}.special-category-section__fields--box{grid-template-columns:repeat(2, minmax(0, 1fr));grid-template-areas:"top top" "left right" "bottom bottom"}.special-category-section__fields--box>.field-info-tooltip:has([data-field-slot=top]){grid-area:top}.special-category-section__fields--box>.field-info-tooltip:has([data-field-slot=left]){grid-area:left}.special-category-section__fields--box>.field-info-tooltip:has([data-field-slot=right]){grid-area:right}.special-category-section__fields--box>.field-info-tooltip:has([data-field-slot=bottom]){grid-area:bottom}@media(max-width: 1400px){.special-category-section__fields--box{grid-template-columns:minmax(0, 1fr);grid-template-areas:"top" "left" "right" "bottom"}}.special-category-section__field{min-width:0}.special-category-section__placeholder{margin-top:8px;font-style:italic;opacity:.7}.mockos-router{width:100%;height:100%;position:relative}.mockos-screen{width:100%;height:100%}.mockos-screen--center{display:flex;flex-direction:column;align-items:center;justify-content:center}.mockos-screen--launchscreen{background-color:#000}.mockos-screen--home{padding:20px;background-color:#f5f5f5}.mockos-screen--onboard{padding:20px;background-color:#fff}.mockos-screen--subscription{padding:20px;background-color:#fff}.mockos-screen__title{font-size:32px;font-weight:bold;color:#000;margin-bottom:16px}.mockos-screen__subtitle{font-size:16px;color:#666}.mockos-screen__heading{font-size:24px;font-weight:bold;margin-bottom:20px}.mockos-screen__text{font-size:16px;color:#333;margin-bottom:12px}.mockos-screen__plan{padding:16px;border-radius:8px;text-align:center;margin-bottom:12px}.mockos-screen__plan--premium{background-color:#007aff;color:#fff}.mockos-screen__plan--basic{background-color:#e5e5e5;color:#333}.mockos-launcher{width:100%;height:100%;padding:40px 20px;display:flex;flex-direction:column}.mockos-launcher__grid{display:grid;grid-template-columns:repeat(4, 1fr);gap:20px;padding:20px}.mockos-launcher__app{display:flex;flex-direction:column;align-items:center;gap:8px;background:rgba(0,0,0,0);border:none;cursor:pointer;padding:8px;border-radius:12px;transition:background-color .2s}.mockos-launcher__app:hover{background-color:hsla(0,0%,100%,.1)}.mockos-launcher__app:active{transform:scale(0.95)}.mockos-launcher__app-icon{width:60px;height:60px;border-radius:13px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,.3)}.mockos-launcher__app-icon svg{width:100%;height:100%;display:block}.mockos-launcher__app-name{font-size:12px;color:#fff;text-align:center;max-width:70px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.modal{position:fixed;inset:0;z-index:10000}.modal__overlay{position:absolute;inset:0;background:rgba(0,0,0,.4);z-index:0}.modal__content{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);background:#fff;border-radius:12px;box-shadow:0 10px 30px rgba(0,0,0,.12);width:min(960px,100vw - 40px);max-height:calc(100vh - 120px);display:flex;flex-direction:column;overflow:hidden;z-index:1}.modal__header{display:flex;align-items:center;justify-content:space-between;padding:16px 24px;border-bottom:1px solid #e5e7eb;gap:12px}.modal__title{margin:0;font-size:16px;font-weight:700}.add-component-modal{display:flex;flex-direction:column;height:100%}.add-component-modal__body{flex:1;overflow-y:auto;padding-bottom:24px}.add-component-modal__section{padding:0 24px;margin-bottom:24px}.add-component-modal__section:first-of-type{margin-top:24px}.add-component-modal__section-title{font-size:16px;font-weight:600;margin-bottom:12px}.add-component-modal__toggle{display:flex;align-items:center;gap:12px;margin:0 24px 24px;padding:12px 0;font-weight:500;user-select:none}.add-component-modal__toggle input{width:18px;height:18px}.add-component-modal__group{background:#fff;border:1px solid #e5e7eb;border-radius:12px;padding:16px;margin-bottom:12px;box-shadow:0 10px 20px rgba(15,23,42,.05)}.add-component-modal__group-title{font-size:14px;font-weight:600;color:#6b7280;margin-bottom:12px}.add-component-modal__grid{padding:16px;display:grid;grid-template-columns:repeat(auto-fill, minmax(180px, 1fr));gap:12px;overflow:auto}.add-component-modal__card{display:flex;flex-direction:column;gap:12px;padding:12px;border:1px solid #e5e7eb;border-radius:10px;background:#f3f4f6;cursor:pointer;text-align:left;transition:border-color .2s ease,box-shadow .2s ease,transform .2s ease;color:inherit}.add-component-modal__card:hover{border-color:#2563eb;box-shadow:0 10px 25px rgba(37,99,235,.15);transform:translateY(-2px)}.add-component-modal__thumbnail{width:100%;aspect-ratio:4/3;border-radius:8px;background:#f3f4f6;border:1px dashed #e5e7eb;display:flex;align-items:center;justify-content:center;color:#2563eb;font-weight:600;font-size:12px;text-transform:uppercase;letter-spacing:.05em}.add-component-modal__title{font-weight:600;color:#111827}.add-component-modal__empty{margin:12px 0;padding:16px;border:1px dashed #e5e7eb;border-radius:10px;color:#6b7280;font-size:14px;text-align:center}.device-selector-modal{padding-bottom:24px}.device-selector-modal__grid{padding:24px;display:grid;grid-template-columns:repeat(auto-fill, minmax(180px, 1fr));gap:12px;overflow:auto}.device-selector-modal__grid .editor-device-button{height:80px;min-width:unset}.color-modal{width:min(520px,100vw - 32px);max-height:90vh;padding:24px;display:flex;flex-direction:column;gap:16px;overflow-y:auto}.color-modal__selected{display:flex;align-items:center;justify-content:space-between;background:#f3f4f6;border-radius:8px;padding:12px 16px}.color-modal__selected-info{display:flex;align-items:center;gap:12px}.color-modal__selected-preview{width:32px;height:32px;border-radius:6px;border:1px solid rgba(0,0,0,.1)}.color-modal__selected-label{margin:0;font-size:12px;color:#6b7280}.color-modal__selected-value{margin:0;font-weight:600}.color-modal__toggle{display:flex;flex-direction:column;gap:6px;padding:0 8px}.color-modal__toggle-label{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:600;color:#111827;cursor:pointer}.color-modal__toggle-input{width:16px;height:16px;accent-color:#2563eb}.color-modal__toggle-description{margin:0;font-size:12px;color:#6b7280}.color-modal__link-button{border:none;background:none;color:#2563eb;font-weight:600;font-size:13px;cursor:pointer;padding:4px 8px}.color-modal__add-color{position:relative;display:inline-flex;align-items:center}.color-modal__add-color-input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%;border:0;padding:0;margin:0}.color-section{display:flex;flex-direction:column;gap:8px}.color-section__header{display:flex;align-items:center;justify-content:space-between;gap:8px}.color-section__title{margin:0;font-weight:600}.color-section__swatches{display:grid;grid-template-columns:repeat(auto-fill, minmax(120px, 1fr));gap:8px}.color-section__empty{margin:0;font-size:12px;color:#6b7280}.color-modal__swatch{border:1px solid #e5e7eb;border-radius:8px;padding:8px;background:#fff;display:flex;flex-direction:column;gap:6px;text-align:left;cursor:pointer;transition:border-color .2s ease,box-shadow .2s ease}.color-modal__swatch--active{border-color:#111827;box-shadow:0 0 0 1px #111827 inset}.color-modal__swatch-preview{width:100%;height:32px;border-radius:6px}.color-modal__swatch-preview--light{border:1px solid rgba(0,0,0,.1)}.color-modal__swatch-label{font-size:12px;font-weight:600;color:#111827}.color-modal__swatch-value{font-size:11px;color:#6b7280}.color-modal__input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;opacity:0}.localication-modal__content{width:calc(100vw - 32px);height:calc(100vh - 32px);max-width:1600px;max-height:calc(100vh - 32px);padding:0;display:flex;flex-direction:column}.localication-modal__header{padding:16px 24px;border-bottom:1px solid #e5e7eb;display:flex;align-items:center;gap:16px}.localication-modal__header-main{flex:1;display:flex;flex-direction:column;gap:4px}.localication-modal__description{margin:0;font-size:13px;color:#6b7280}.localication-modal__body{flex:1;min-height:0;padding:24px;display:flex;flex-direction:column;gap:16px;overflow:auto}.localication-modal__editor{flex:1;min-height:0;overflow:auto;border:1px solid #e5e7eb;border-radius:8px;background:#f3f4f6}.localication-modal__json-editor{height:100%;width:100%;display:block;padding:12px;overflow:auto}.modal--scrollable .localication-modal__content{overflow:hidden}.modal--scrollable .localication-modal__body{overflow:auto}.embla{max-width:48rem;margin:auto;--slide-height: 19rem;--slide-spacing: 1rem;--slide-size: 70%}.embla__viewport{overflow:hidden}.embla__container{display:flex;touch-action:pan-y pinch-zoom}.embla__slide{transform:translate3d(0, 0, 0);min-width:0;padding-left:var(--slide-spacing);flex:0 0 100%}.embla__slide__number{box-shadow:inset 0 0 0 .2rem var(--detail-medium-contrast);border-radius:1.8rem;font-size:4rem;font-weight:600;display:flex;align-items:center;justify-content:center;height:var(--slide-height);user-select:none}.embla__controls{display:grid;grid-template-columns:auto 1fr;justify-content:space-between;gap:1.2rem;margin-top:1.8rem}.embla__buttons{display:grid;grid-template-columns:repeat(2, 1fr);gap:.6rem;align-items:center}.embla__button{-webkit-tap-highlight-color:rgba(var(--text-high-contrast-rgb-value), 0.5);-webkit-appearance:none;appearance:none;background-color:rgba(0,0,0,0);touch-action:manipulation;display:inline-flex;text-decoration:none;cursor:pointer;border:0;padding:0;margin:0;box-shadow:inset 0 0 0 .2rem var(--detail-medium-contrast);width:3.6rem;height:3.6rem;z-index:1;border-radius:50%;color:var(--text-body);display:flex;align-items:center;justify-content:center}.embla__button:disabled{color:var(--detail-high-contrast)}.embla__button__svg{width:35%;height:35%}.embla__dots{flex-wrap:wrap;margin-right:0;height:50px;margin:0 auto}.embla__dot{-webkit-tap-highlight-color:rgba(var(--text-high-contrast-rgb-value), 0.5);-webkit-appearance:none;appearance:none;background-color:rgba(0,0,0,0);--embla-dot-color: var(--detail-medium-contrast);touch-action:manipulation;display:inline-flex;text-decoration:none;cursor:pointer;border:0;padding:0;margin:0;width:max(2.6rem,var(--embla-dot-size, 1.4rem) + 1.2rem);height:max(2.6rem,var(--embla-dot-size, 1.4rem) + 1.2rem);display:flex;align-items:center;border-radius:50%}.embla__dot:after{background-color:var(--embla-dot-color);width:var(--embla-dot-size, 1.4rem);height:var(--embla-dot-size, 1.4rem);border-radius:50%;display:flex;align-items:center;content:""}.embla__dot--selected{--embla-dot-color: var(--text-body)}.carousel-provider{height:100%}.embla{height:100%}.embla__viewport{height:100%;display:flex;flex-direction:column}.embla__container{flex:1}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { ImagePropsGenerated } from '../build-components/Image/ImageProps.generated';
|
|
2
2
|
import type { NodeData } from '../types/Node';
|
|
3
|
-
|
|
3
|
+
import { ExtractViewStyleOptions } from './extractViewStyle';
|
|
4
|
+
export declare function extractImageStyle<T extends ImagePropsGenerated['attributes']>(node: NodeData<T>, options?: ExtractViewStyleOptions): import("react").CSSProperties;
|
|
@@ -2,9 +2,8 @@ import { ViewPropsGenerated } from '../build-components/View/ViewProps.generated
|
|
|
2
2
|
import type { NodeData } from '../types/Node';
|
|
3
3
|
import type { AppConfig } from '../types/PreviewConfig';
|
|
4
4
|
import type { ProjectColors } from '../types/Project';
|
|
5
|
-
type ExtractViewStyleOptions = {
|
|
5
|
+
export type ExtractViewStyleOptions = {
|
|
6
6
|
appConfig?: AppConfig;
|
|
7
7
|
projectColors?: ProjectColors;
|
|
8
8
|
};
|
|
9
9
|
export declare function extractViewStyle<T extends ViewPropsGenerated['attributes']>(node: NodeData<T>, options?: ExtractViewStyleOptions): import("react").CSSProperties;
|
|
10
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@developer_tribe/react-builder",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"restricted": true,
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"@rollup/plugin-json": "^6.1.0",
|
|
36
36
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
37
37
|
"@rollup/plugin-url": "^8.0.2",
|
|
38
|
-
"@svgr/rollup": "^8.1.0",
|
|
39
38
|
"@types/node": "^22.7.4",
|
|
40
39
|
"@types/react": "^18.3.9",
|
|
41
40
|
"@types/react-dom": "^18.3.0",
|
|
@@ -44,7 +43,6 @@
|
|
|
44
43
|
"eslint-plugin-react": "^7.37.5",
|
|
45
44
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
46
45
|
"globals": "^16.4.0",
|
|
47
|
-
"json-edit-react": "^1.29.0",
|
|
48
46
|
"lottie-react": "^2.4.1",
|
|
49
47
|
"prettier": "^3.6.2",
|
|
50
48
|
"react": "^18.3.1",
|
|
@@ -67,8 +65,7 @@
|
|
|
67
65
|
"react-router-dom": ">=6.0.0"
|
|
68
66
|
},
|
|
69
67
|
"optionalDependencies": {
|
|
70
|
-
"embla-carousel-react": ">=8.6.0"
|
|
71
|
-
"json-edit-react": ">=1.29.0"
|
|
68
|
+
"embla-carousel-react": ">=8.6.0"
|
|
72
69
|
},
|
|
73
70
|
"engines": {
|
|
74
71
|
"node": ">=18"
|
package/src/.DS_Store
ADDED
|
Binary file
|
package/src/AttributesEditor.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import { useRenderStore } from './store';
|
|
12
12
|
import { Field } from './attributes-editor/Field';
|
|
13
13
|
import { SpecialCategorySection } from './attributes-editor/SpecialCategorySection';
|
|
14
|
+
import { toPreferredScale } from './attributes-editor/SizeField';
|
|
14
15
|
import {
|
|
15
16
|
LayoutContext,
|
|
16
17
|
SchemaEntry,
|
|
@@ -297,7 +298,9 @@ export function AttributesEditor({
|
|
|
297
298
|
{sectionEntries.map(({ name, type }) => {
|
|
298
299
|
const label = attributeMeta?.[name]?.label ?? name;
|
|
299
300
|
const description = attributeMeta?.[name]?.description;
|
|
300
|
-
const preferredScale =
|
|
301
|
+
const preferredScale = toPreferredScale(
|
|
302
|
+
attributeMeta?.[name]?.preferedScale,
|
|
303
|
+
);
|
|
301
304
|
const currentValue = (attributes as Record<string, unknown>)[
|
|
302
305
|
name
|
|
303
306
|
];
|
|
@@ -497,7 +500,9 @@ export function AttributesEditor({
|
|
|
497
500
|
{activeEntries.map(({ name, type }) => {
|
|
498
501
|
const label = attributeMeta?.[name]?.label ?? name;
|
|
499
502
|
const description = attributeMeta?.[name]?.description;
|
|
500
|
-
const preferredScale =
|
|
503
|
+
const preferredScale = toPreferredScale(
|
|
504
|
+
attributeMeta?.[name]?.preferedScale,
|
|
505
|
+
);
|
|
501
506
|
const isBoolean = isBooleanFieldType(type);
|
|
502
507
|
const wrapperClassNames = [
|
|
503
508
|
'attributes-editor__field-wrapper',
|
package/src/RenderPage.tsx
CHANGED
|
@@ -47,14 +47,18 @@ function findNodeByKeyNested(node: Node, key: string): Node | null {
|
|
|
47
47
|
|
|
48
48
|
export function RenderPage({ data, name, onSelectNode }: RenderPageProps) {
|
|
49
49
|
useLogRender('RenderPage');
|
|
50
|
-
const { device, previewMode, setCurrent } = useRenderStore(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
const { device, previewMode, forceRender, setCurrent } = useRenderStore(
|
|
51
|
+
(s) => ({
|
|
52
|
+
device: s.device,
|
|
53
|
+
previewMode: s.previewMode,
|
|
54
|
+
forceRender: s.forceRender,
|
|
55
|
+
setCurrent: s.setCurrent,
|
|
56
|
+
}),
|
|
57
|
+
);
|
|
55
58
|
const previewRootRef = useRef<HTMLDivElement | null>(null);
|
|
56
59
|
|
|
57
60
|
useEffect(() => {
|
|
61
|
+
console.log('previewMode!!!', previewMode);
|
|
58
62
|
if (!previewMode) {
|
|
59
63
|
return;
|
|
60
64
|
}
|
|
@@ -88,7 +92,7 @@ export function RenderPage({ data, name, onSelectNode }: RenderPageProps) {
|
|
|
88
92
|
return () => {
|
|
89
93
|
root.removeEventListener('click', handleClick);
|
|
90
94
|
};
|
|
91
|
-
}, [previewMode, data, onSelectNode, setCurrent]);
|
|
95
|
+
}, [previewMode, data, onSelectNode, setCurrent, forceRender]); // forceRender: retrigger effect when we want to force a refresh (e.g. route change)
|
|
92
96
|
|
|
93
97
|
const screenPreviewHeight = 800;
|
|
94
98
|
// The calculation is correct for maintaining the aspect ratio of the target screen size.
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '../utils/patterns';
|
|
10
10
|
import { Checkbox } from '../components/Checkbox';
|
|
11
11
|
import { LayoutPreviewPicker } from './LayoutPreviewPicker';
|
|
12
|
+
import { SizeField, type PreferredScale } from './SizeField';
|
|
12
13
|
import { LayoutContext, LayoutFieldName, isBooleanFieldType } from './types';
|
|
13
14
|
|
|
14
15
|
export type FieldProps = {
|
|
@@ -21,7 +22,7 @@ export type FieldProps = {
|
|
|
21
22
|
layoutContext?: LayoutContext;
|
|
22
23
|
viewAttributes?: Partial<ViewPropsGenerated['attributes']>;
|
|
23
24
|
label?: React.ReactNode;
|
|
24
|
-
preferredScale?:
|
|
25
|
+
preferredScale?: PreferredScale;
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
const layoutFieldNames: LayoutFieldName[] = [
|
|
@@ -251,10 +252,54 @@ export function Field({
|
|
|
251
252
|
);
|
|
252
253
|
})}
|
|
253
254
|
</div>
|
|
254
|
-
<div
|
|
255
|
+
<div
|
|
256
|
+
style={{
|
|
257
|
+
marginTop: 8,
|
|
258
|
+
display: 'flex',
|
|
259
|
+
alignItems: 'center',
|
|
260
|
+
justifyContent: 'space-between',
|
|
261
|
+
gap: 8,
|
|
262
|
+
}}
|
|
263
|
+
>
|
|
264
|
+
<div style={{ display: 'flex', gap: 4 }}>
|
|
265
|
+
<button
|
|
266
|
+
type="button"
|
|
267
|
+
onClick={(event) => {
|
|
268
|
+
event.stopPropagation();
|
|
269
|
+
if (idx <= 0) return;
|
|
270
|
+
const next = [...arr];
|
|
271
|
+
const tmp = next[idx - 1];
|
|
272
|
+
next[idx - 1] = next[idx];
|
|
273
|
+
next[idx] = tmp;
|
|
274
|
+
onChange(next);
|
|
275
|
+
}}
|
|
276
|
+
disabled={idx <= 0}
|
|
277
|
+
aria-label="Move up"
|
|
278
|
+
>
|
|
279
|
+
↑
|
|
280
|
+
</button>
|
|
281
|
+
<button
|
|
282
|
+
type="button"
|
|
283
|
+
onClick={(event) => {
|
|
284
|
+
event.stopPropagation();
|
|
285
|
+
if (idx >= arr.length - 1) return;
|
|
286
|
+
const next = [...arr];
|
|
287
|
+
const tmp = next[idx + 1];
|
|
288
|
+
next[idx + 1] = next[idx];
|
|
289
|
+
next[idx] = tmp;
|
|
290
|
+
onChange(next);
|
|
291
|
+
}}
|
|
292
|
+
disabled={idx >= arr.length - 1}
|
|
293
|
+
aria-label="Move down"
|
|
294
|
+
>
|
|
295
|
+
↓
|
|
296
|
+
</button>
|
|
297
|
+
</div>
|
|
298
|
+
|
|
255
299
|
<button
|
|
256
300
|
type="button"
|
|
257
|
-
onClick={() => {
|
|
301
|
+
onClick={(event) => {
|
|
302
|
+
event.stopPropagation();
|
|
258
303
|
const next = arr.filter((_, i) => i !== idx);
|
|
259
304
|
onChange(next.length ? next : undefined);
|
|
260
305
|
}}
|
|
@@ -510,160 +555,3 @@ function ColorPickerButton({
|
|
|
510
555
|
</>
|
|
511
556
|
);
|
|
512
557
|
}
|
|
513
|
-
|
|
514
|
-
type SizeUnit = '' | 'vs' | 's' | 'f' | '%';
|
|
515
|
-
|
|
516
|
-
function parseSizeValue(value: unknown): { amount: string; unit: SizeUnit } {
|
|
517
|
-
const empty = { amount: '', unit: '' as SizeUnit };
|
|
518
|
-
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
519
|
-
return { amount: String(value), unit: '' };
|
|
520
|
-
}
|
|
521
|
-
if (typeof value !== 'string') return empty;
|
|
522
|
-
const trimmed = value.trim();
|
|
523
|
-
if (!trimmed) return empty;
|
|
524
|
-
if (trimmed.endsWith('%')) {
|
|
525
|
-
return { amount: trimmed.slice(0, -1), unit: '%' };
|
|
526
|
-
}
|
|
527
|
-
const lower = trimmed.toLowerCase();
|
|
528
|
-
if (lower.endsWith('@vs'))
|
|
529
|
-
return { amount: trimmed.slice(0, -3), unit: 'vs' };
|
|
530
|
-
if (lower.endsWith('vs')) return { amount: trimmed.slice(0, -2), unit: 'vs' };
|
|
531
|
-
if (lower.endsWith('@fs')) return { amount: trimmed.slice(0, -3), unit: 'f' };
|
|
532
|
-
if (lower.endsWith('@f')) return { amount: trimmed.slice(0, -2), unit: 'f' };
|
|
533
|
-
if (lower.endsWith('fs')) return { amount: trimmed.slice(0, -2), unit: 'f' };
|
|
534
|
-
if (lower.endsWith('f')) return { amount: trimmed.slice(0, -1), unit: 'f' };
|
|
535
|
-
if (lower.endsWith('@s')) return { amount: trimmed.slice(0, -2), unit: 's' };
|
|
536
|
-
if (lower.endsWith('s')) return { amount: trimmed.slice(0, -1), unit: 's' };
|
|
537
|
-
if (lower.endsWith('px')) return { amount: trimmed.slice(0, -2), unit: '' };
|
|
538
|
-
return { amount: trimmed, unit: '' };
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
function composeSizeValue(amount: string, unit: SizeUnit): string | number {
|
|
542
|
-
const trimmed = amount.trim();
|
|
543
|
-
if (unit === '%') {
|
|
544
|
-
return `${trimmed}%`;
|
|
545
|
-
}
|
|
546
|
-
if (unit === '') {
|
|
547
|
-
const numeric = Number(trimmed);
|
|
548
|
-
return Number.isFinite(numeric) ? numeric : trimmed;
|
|
549
|
-
}
|
|
550
|
-
if (unit === 'f') {
|
|
551
|
-
return `${trimmed}@fs`;
|
|
552
|
-
}
|
|
553
|
-
return `${trimmed}@${unit}`;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
type SizeFieldProps = {
|
|
557
|
-
value: unknown;
|
|
558
|
-
onChange: (val: unknown) => void;
|
|
559
|
-
preferredScale?: string;
|
|
560
|
-
fieldName: string;
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
function normalizePreferredScale(
|
|
564
|
-
preferredScale: string | undefined,
|
|
565
|
-
fieldName: string,
|
|
566
|
-
): SizeUnit {
|
|
567
|
-
const fallbackName = fieldName.trim().toLowerCase();
|
|
568
|
-
const fallback: SizeUnit =
|
|
569
|
-
fallbackName.includes('height') ||
|
|
570
|
-
fallbackName.includes('top') ||
|
|
571
|
-
fallbackName.includes('vertical')
|
|
572
|
-
? 'vs'
|
|
573
|
-
: 's';
|
|
574
|
-
if (typeof preferredScale !== 'string') return fallback;
|
|
575
|
-
const normalized = preferredScale.trim().toLowerCase();
|
|
576
|
-
if (
|
|
577
|
-
normalized === 'vs' ||
|
|
578
|
-
normalized === 's' ||
|
|
579
|
-
normalized === 'f' ||
|
|
580
|
-
normalized === '%'
|
|
581
|
-
) {
|
|
582
|
-
return normalized as SizeUnit;
|
|
583
|
-
}
|
|
584
|
-
return fallback;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
function SizeField({
|
|
588
|
-
value,
|
|
589
|
-
onChange,
|
|
590
|
-
preferredScale,
|
|
591
|
-
fieldName,
|
|
592
|
-
}: SizeFieldProps) {
|
|
593
|
-
const parsed = useMemo(() => parseSizeValue(value), [value]);
|
|
594
|
-
const normalizedPreferred = useMemo(
|
|
595
|
-
() => normalizePreferredScale(preferredScale, fieldName),
|
|
596
|
-
[preferredScale, fieldName],
|
|
597
|
-
);
|
|
598
|
-
const [amount, setAmount] = useState(parsed.amount);
|
|
599
|
-
const [unit, setUnit] = useState<SizeUnit>(
|
|
600
|
-
parsed.unit || normalizedPreferred,
|
|
601
|
-
);
|
|
602
|
-
|
|
603
|
-
useEffect(() => {
|
|
604
|
-
setAmount(parsed.amount);
|
|
605
|
-
setUnit(parsed.unit || normalizedPreferred);
|
|
606
|
-
}, [parsed.amount, parsed.unit, normalizedPreferred]);
|
|
607
|
-
|
|
608
|
-
const emitValue = useCallback(
|
|
609
|
-
(nextAmount: string, nextUnit: SizeUnit) => {
|
|
610
|
-
const trimmed = nextAmount.trim();
|
|
611
|
-
if (!trimmed) {
|
|
612
|
-
onChange(undefined);
|
|
613
|
-
return;
|
|
614
|
-
}
|
|
615
|
-
onChange(composeSizeValue(trimmed, nextUnit));
|
|
616
|
-
},
|
|
617
|
-
[onChange],
|
|
618
|
-
);
|
|
619
|
-
|
|
620
|
-
const handleAmountChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
621
|
-
const nextAmount = e.target.value;
|
|
622
|
-
setAmount(nextAmount);
|
|
623
|
-
if (!nextAmount.trim()) {
|
|
624
|
-
onChange(undefined);
|
|
625
|
-
return;
|
|
626
|
-
}
|
|
627
|
-
emitValue(nextAmount, unit);
|
|
628
|
-
};
|
|
629
|
-
|
|
630
|
-
const handleUnitChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
|
631
|
-
const nextUnit = e.target.value as SizeUnit;
|
|
632
|
-
setUnit(nextUnit);
|
|
633
|
-
if (!amount.trim()) return;
|
|
634
|
-
emitValue(amount, nextUnit);
|
|
635
|
-
};
|
|
636
|
-
|
|
637
|
-
const unitPriority: SizeUnit[] = ['vs', 's', 'f', '%'];
|
|
638
|
-
const orderedUnits = [
|
|
639
|
-
normalizedPreferred,
|
|
640
|
-
...unitPriority.filter((unit) => unit !== normalizedPreferred),
|
|
641
|
-
];
|
|
642
|
-
const unitOptions: Array<{ value: SizeUnit; label: string }> =
|
|
643
|
-
orderedUnits.map((unit) => ({
|
|
644
|
-
value: unit,
|
|
645
|
-
label: unit === normalizedPreferred ? `${unit}` : unit,
|
|
646
|
-
}));
|
|
647
|
-
|
|
648
|
-
return (
|
|
649
|
-
<div className="attributes-editor__size-field">
|
|
650
|
-
<input
|
|
651
|
-
type="number"
|
|
652
|
-
className="input attributes-editor__size-field-input"
|
|
653
|
-
value={amount}
|
|
654
|
-
onChange={handleAmountChange}
|
|
655
|
-
/>
|
|
656
|
-
<select
|
|
657
|
-
className="input attributes-editor__size-field-select"
|
|
658
|
-
value={unit}
|
|
659
|
-
onChange={handleUnitChange}
|
|
660
|
-
>
|
|
661
|
-
{unitOptions.map((opt) => (
|
|
662
|
-
<option key={opt.value} value={opt.value}>
|
|
663
|
-
{opt.label}
|
|
664
|
-
</option>
|
|
665
|
-
))}
|
|
666
|
-
</select>
|
|
667
|
-
</div>
|
|
668
|
-
);
|
|
669
|
-
}
|