@developer_tribe/react-builder 1.2.8 → 1.2.10
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/AttributesEditor.d.ts +2 -11
- package/dist/attribute-analyser/style/native/useExtractImageStyle.d.ts +10 -0
- package/dist/attribute-analyser/style/native/useExtractTextStyle.d.ts +9 -0
- package/dist/attribute-analyser/style/native/useExtractViewStyle.d.ts +8 -0
- package/dist/attribute-analyser/style/web/useExtractImageStyle.d.ts +4 -0
- package/dist/attribute-analyser/style/web/useExtractTextStyle.d.ts +4 -0
- package/dist/attribute-analyser/style/web/useExtractViewStyle.d.ts +4 -0
- package/dist/attributes-editor/AttributesEditorFields.d.ts +18 -0
- package/dist/attributes-editor/AttributesEditorView.d.ts +4 -0
- package/dist/attributes-editor/attributesEditorModelTypes.d.ts +67 -0
- package/dist/attributes-editor/attributesEditorUtils.d.ts +19 -0
- package/dist/attributes-editor/useAttributesEditorModel.d.ts +2 -0
- package/dist/build-components/BIcon/BIconProps.generated.d.ts +6 -6
- package/dist/build-components/BackgroundImage/BackgroundImageProps.generated.d.ts +3 -3
- package/dist/build-components/Button/ButtonProps.generated.d.ts +1 -1
- package/dist/build-components/Carousel/CarouselProps.generated.d.ts +2 -2
- package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +4 -4
- package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +3 -3
- package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +1 -1
- package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +1 -1
- package/dist/build-components/Image/ImageProps.generated.d.ts +5 -3
- package/dist/build-components/Main/MainProps.generated.d.ts +2 -2
- package/dist/build-components/Onboard/OnboardProps.generated.d.ts +1 -1
- package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +9 -8
- package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +11 -11
- package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +15 -9
- package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +10 -10
- package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +8 -6
- package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +6 -3
- package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +5 -4
- package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +3 -3
- package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +3 -3
- package/dist/build-components/PaywallBackground/PaywallBackgroundProps.generated.d.ts +1 -1
- package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +6 -6
- package/dist/build-components/PaywallOptions/PaywallOptionsProps.generated.d.ts +1 -1
- package/dist/build-components/PaywallProvider/PaywallProviderProps.generated.d.ts +1 -1
- package/dist/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.d.ts +1 -1
- package/dist/build-components/RadioButton/RadioButtonProps.generated.d.ts +4 -4
- package/dist/build-components/Text/TextProps.generated.d.ts +3 -3
- package/dist/build-components/View/ViewProps.generated.d.ts +1 -1
- package/dist/build-components/patterns.generated.d.ts +2690 -5804
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +5 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.cjs.js +6 -4
- package/dist/index.native.cjs.js.map +1 -1
- package/dist/index.native.d.ts +5 -6
- package/dist/index.native.esm.js +6 -4
- package/dist/index.native.esm.js.map +1 -1
- package/dist/migrations/migratePipe.d.ts +1 -1
- package/dist/migrations/migrations/1.1.2_extract_component_attributes_from_style.d.ts +2 -0
- package/dist/mockOS/components/PermissionModal.d.ts +1 -2
- package/dist/styles.css +1 -1
- package/dist/types/PreviewConfig.d.ts +1 -5
- package/dist/utils/getMeta.d.ts +5 -0
- package/dist/utils/patterns.d.ts +12 -0
- package/package.json +4 -2
- package/scripts/prebuild/prebuild.js +14 -0
- package/scripts/prebuild/utils/createGeneratedProps.js +19 -13
- package/scripts/prebuild/utils/index.js +1 -0
- package/scripts/prebuild/utils/updateMetaJson.js +66 -0
- package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +37 -3
- package/scripts/prebuild/utils/validatePatternJson.js +27 -2
- package/scripts/public/scripts/build/index.js +20 -3
- package/scripts/public/scripts/build/info.json +6 -0
- package/scripts/public/scripts/build/utils/createComponentsIndex.js +9 -3
- package/scripts/public/scripts/build/utils/createRenderNodeGenerated.js +66 -8
- package/src/AttributesEditor.tsx +8 -944
- package/src/assets/meta.json +4 -0
- package/src/assets/samples/carousel-sample.json +1 -1
- package/src/assets/samples/getSamples.ts +2 -0
- package/src/assets/samples/paywall-1.json +11 -7
- package/src/assets/samples/simple-1.json +3 -3
- package/src/assets/samples/simple-2.json +3 -3
- package/src/assets/samples/unmigrated-builder-1.1.1.json +87 -0
- package/src/assets/samples/unmigrated-builder1.json +1 -1
- package/src/assets/samples/unvalidated-builder1.json +3 -3
- package/src/assets/samples/unvalidated-crash1.json +1 -1
- package/src/assets/samples/unvalidated-crashcomponent1.json +1 -1
- package/src/assets/samples/vpn-onboard-1.json +1 -1
- package/src/assets/samples/vpn-onboard-2.json +1 -1
- package/src/assets/samples/vpn-onboard-3.json +1 -1
- package/src/assets/samples/vpn-onboard-4.json +1 -1
- package/src/assets/samples/vpn-onboard-5.json +1 -1
- package/src/assets/samples/vpn-onboard-6.json +1 -1
- package/src/attribute-analyser/style/native/useExtractImageStyle.ts +46 -0
- package/src/attribute-analyser/style/native/useExtractTextStyle.ts +50 -0
- package/src/attribute-analyser/style/native/useExtractViewStyle.ts +32 -0
- package/src/attribute-analyser/style/web/useExtractImageStyle.ts +20 -0
- package/src/attribute-analyser/style/web/useExtractTextStyle.ts +27 -0
- package/src/attribute-analyser/style/web/useExtractViewStyle.ts +20 -0
- package/src/attributes-editor/AttributesEditorFields.tsx +248 -0
- package/src/attributes-editor/AttributesEditorView.tsx +360 -0
- package/src/attributes-editor/attributesEditorModelTypes.ts +86 -0
- package/src/attributes-editor/attributesEditorUtils.ts +102 -0
- package/src/attributes-editor/useAttributesEditorModel.ts +477 -0
- package/src/build-components/BIcon/BIcon.tsx +4 -4
- package/src/build-components/BIcon/BIconProps.generated.ts +6 -6
- package/src/build-components/BIcon/pattern.json +5 -6
- package/src/build-components/BackgroundImage/BackgroundImage.tsx +3 -2
- package/src/build-components/BackgroundImage/BackgroundImageProps.generated.ts +3 -3
- package/src/build-components/Button/Button.tsx +2 -2
- package/src/build-components/Button/ButtonProps.generated.ts +1 -1
- package/src/build-components/Button/pattern.json +17 -15
- package/src/build-components/Carousel/Carousel.tsx +1 -1
- package/src/build-components/Carousel/CarouselProps.generated.ts +2 -2
- package/src/build-components/CarouselButtons/CarouselButtons.tsx +4 -7
- package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +7 -7
- package/src/build-components/CarouselButtons/pattern.json +2 -1
- package/src/build-components/CarouselDots/CarouselDots.tsx +2 -2
- package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +9 -9
- package/src/build-components/CarouselItem/CarouselItem.tsx +1 -1
- package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +1 -1
- package/src/build-components/CarouselProvider/CarouselProvider.tsx +1 -1
- package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +1 -1
- package/src/build-components/Image/Image.tsx +1 -1
- package/src/build-components/Image/ImageProps.generated.ts +5 -3
- package/src/build-components/Image/pattern.json +10 -9
- package/src/build-components/Main/Main.tsx +2 -2
- package/src/build-components/Main/MainProps.generated.ts +2 -2
- package/src/build-components/Main/pattern.json +2 -1
- package/src/build-components/Onboard/OnboardProps.generated.ts +1 -1
- package/src/build-components/OnboardButton/OnboardButton.tsx +7 -6
- package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +14 -13
- package/src/build-components/OnboardButton/pattern.json +9 -7
- package/src/build-components/OnboardButtons/OnboardButtons.tsx +31 -31
- package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +14 -14
- package/src/build-components/OnboardButtons/pattern.json +9 -7
- package/src/build-components/OnboardDot/OnboardDot.tsx +7 -6
- package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +26 -9
- package/src/build-components/OnboardFooter/OnboardFooter.tsx +17 -16
- package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +10 -10
- package/src/build-components/OnboardFooter/pattern.json +16 -14
- package/src/build-components/OnboardImage/OnboardImage.tsx +8 -8
- package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +8 -6
- package/src/build-components/OnboardImage/pattern.json +2 -1
- package/src/build-components/OnboardItem/OnboardItem.tsx +1 -1
- package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +6 -3
- package/src/build-components/OnboardItem/pattern.json +2 -1
- package/src/build-components/OnboardProvider/OnboardProvider.tsx +1 -1
- package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +5 -4
- package/src/build-components/OnboardProvider/pattern.json +2 -1
- package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +3 -3
- package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +3 -3
- package/src/build-components/PaywallBackground/PaywallBackground.tsx +1 -1
- package/src/build-components/PaywallBackground/PaywallBackgroundProps.generated.ts +1 -1
- package/src/build-components/PaywallCloseButton/PaywallCloseButton.tsx +5 -4
- package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +6 -6
- package/src/build-components/PaywallOptions/PaywallOptionButton.tsx +1 -1
- package/src/build-components/PaywallOptions/PaywallOptionsProps.generated.ts +1 -1
- package/src/build-components/PaywallProvider/PaywallProvider.tsx +1 -1
- package/src/build-components/PaywallProvider/PaywallProviderProps.generated.ts +1 -1
- package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButton.tsx +1 -1
- package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.ts +1 -1
- package/src/build-components/RadioButton/RadioButton.tsx +5 -5
- package/src/build-components/RadioButton/RadioButtonProps.generated.ts +4 -4
- package/src/build-components/RadioButton/pattern.json +9 -7
- package/src/build-components/Text/Text.tsx +6 -6
- package/src/build-components/Text/TextProps.generated.ts +3 -3
- package/src/build-components/Text/pattern.json +15 -11
- package/src/build-components/View/View.tsx +1 -1
- package/src/build-components/View/ViewProps.generated.ts +1 -1
- package/src/build-components/View/pattern.json +71 -66
- package/src/build-components/patterns.generated.ts +3059 -6008
- package/src/components/AttributesEditorPanel.tsx +2 -2
- package/src/index.native.ts +6 -9
- package/src/index.ts +1 -0
- package/src/migrations/migratePipe.ts +7 -3
- package/src/migrations/migrations/1.1.2_extract_component_attributes_from_style.ts +211 -0
- package/src/mockOS/components/MockOSRouter.tsx +3 -1
- package/src/mockOS/components/PermissionModal.tsx +20 -160
- package/src/mockOS/components/SubscriptionModal.tsx +41 -278
- package/src/pages/ProjectPage.tsx +12 -6
- package/src/styles/components/_attributes-editor.scss +122 -0
- package/src/styles/components/_mockos-router.scss +388 -0
- package/src/styles/components/_onboard.scss +23 -0
- package/src/styles/index.scss +1 -0
- package/src/types/PreviewConfig.ts +1 -5
- package/src/utils/analyseNodeByPatterns.ts +39 -4
- package/src/utils/extractTextStyle/extractTextStyle.ts +4 -1
- package/src/utils/getMeta.ts +15 -0
- package/src/utils/patterns.ts +47 -4
- package/dist/hooks/useExtractImageStyle.d.ts +0 -5
- package/dist/hooks/useExtractTextStyle.d.ts +0 -3
- package/dist/hooks/useExtractViewStyle.d.ts +0 -3
- package/dist/migrations/migrations/1.1.0_normalize_style_attributes.d.ts +0 -2
- package/src/hooks/useExtractImageStyle.ts +0 -30
- package/src/hooks/useExtractTextStyle.ts +0 -34
- package/src/hooks/useExtractViewStyle.ts +0 -30
- package/src/migrations/migrations/1.1.0_normalize_style_attributes.ts +0 -80
|
@@ -141,3 +141,391 @@
|
|
|
141
141
|
text-overflow: ellipsis;
|
|
142
142
|
white-space: nowrap;
|
|
143
143
|
}
|
|
144
|
+
|
|
145
|
+
// ------------------------------------------------------------
|
|
146
|
+
// MockOS "OS alert" modals (Permission + Subscription)
|
|
147
|
+
// - Theme-aware via builder tokens (see `foundation/_colors.scss`)
|
|
148
|
+
// ------------------------------------------------------------
|
|
149
|
+
|
|
150
|
+
.mockos-modal-overlay {
|
|
151
|
+
position: absolute;
|
|
152
|
+
inset: 0;
|
|
153
|
+
display: flex;
|
|
154
|
+
z-index: 9999;
|
|
155
|
+
background-color: rgba(0, 0, 0, var(--mockos-overlay-alpha, 0.5));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.mockos-modal-overlay--ios {
|
|
159
|
+
--mockos-overlay-alpha: 0.4;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.mockos-modal-overlay--android {
|
|
163
|
+
--mockos-overlay-alpha: 0.5;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.mockos-modal-overlay--center {
|
|
167
|
+
align-items: center;
|
|
168
|
+
justify-content: center;
|
|
169
|
+
padding: 20px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.mockos-modal-overlay--bottom {
|
|
173
|
+
align-items: flex-end;
|
|
174
|
+
justify-content: stretch;
|
|
175
|
+
padding: 0;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.mockos-permission-modal {
|
|
179
|
+
width: 100%;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.mockos-permission-modal--ios {
|
|
183
|
+
max-width: 270px;
|
|
184
|
+
overflow: hidden;
|
|
185
|
+
border-radius: 14px;
|
|
186
|
+
background-color: hsl(var(--card, var(--rb-card, 0 0% 100%)) / 0.95);
|
|
187
|
+
backdrop-filter: blur(20px);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.mockos-permission-modal--android {
|
|
191
|
+
max-width: 280px;
|
|
192
|
+
border-radius: 4px;
|
|
193
|
+
background-color: colors.$surfaceColor;
|
|
194
|
+
box-shadow:
|
|
195
|
+
0 11px 15px -7px rgba(0, 0, 0, 0.2),
|
|
196
|
+
0 24px 38px 3px rgba(0, 0, 0, 0.14);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.mockos-permission-modal__content {
|
|
200
|
+
padding: 20px 16px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.mockos-permission-modal__content--center {
|
|
204
|
+
text-align: center;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.mockos-permission-modal__title {
|
|
208
|
+
font-size: 17px;
|
|
209
|
+
font-weight: 600;
|
|
210
|
+
color: colors.$textColor;
|
|
211
|
+
margin-bottom: 8px;
|
|
212
|
+
line-height: 1.3;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.mockos-permission-modal__title--android {
|
|
216
|
+
font-size: 20px;
|
|
217
|
+
font-weight: 500;
|
|
218
|
+
margin-bottom: 16px;
|
|
219
|
+
line-height: 1.2;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.mockos-permission-modal__message {
|
|
223
|
+
font-size: 13px;
|
|
224
|
+
line-height: 1.4;
|
|
225
|
+
color: hsl(
|
|
226
|
+
var(--muted-foreground, var(--rb-muted-foreground, 220 8.9% 46.1%))
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.mockos-permission-modal__message--android {
|
|
231
|
+
font-size: 16px;
|
|
232
|
+
line-height: 1.5;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.mockos-permission-modal__actions {
|
|
236
|
+
display: flex;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.mockos-permission-modal__actions--ios {
|
|
240
|
+
border-top: 0.5px solid
|
|
241
|
+
hsl(var(--border, var(--rb-border, 220 13% 91%)) / 0.65);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.mockos-permission-modal__actions--android {
|
|
245
|
+
padding: 8px 8px 8px 0;
|
|
246
|
+
justify-content: flex-end;
|
|
247
|
+
gap: 8px;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.mockos-permission-modal__button {
|
|
251
|
+
background: transparent;
|
|
252
|
+
border: none;
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
font: inherit;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.mockos-permission-modal__button--ios {
|
|
258
|
+
flex: 1;
|
|
259
|
+
padding: 11px 0;
|
|
260
|
+
font-size: 17px;
|
|
261
|
+
font-weight: 400;
|
|
262
|
+
color: hsl(var(--primary, var(--rb-primary, 221.2 83.2% 53.3%)));
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.mockos-permission-modal__actions--ios
|
|
266
|
+
.mockos-permission-modal__button--ios:first-child {
|
|
267
|
+
border-right: 0.5px solid
|
|
268
|
+
hsl(var(--border, var(--rb-border, 220 13% 91%)) / 0.65);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.mockos-permission-modal__button--bold {
|
|
272
|
+
font-weight: 600;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.mockos-permission-modal__button--android {
|
|
276
|
+
padding: 8px 16px;
|
|
277
|
+
font-size: 14px;
|
|
278
|
+
font-weight: 500;
|
|
279
|
+
border-radius: 4px;
|
|
280
|
+
text-transform: uppercase;
|
|
281
|
+
letter-spacing: 0.5px;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.mockos-permission-modal__button--deny {
|
|
285
|
+
color: hsl(
|
|
286
|
+
var(--muted-foreground, var(--rb-muted-foreground, 220 8.9% 46.1%))
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.mockos-permission-modal__button--allow {
|
|
291
|
+
color: hsl(var(--primary, var(--rb-primary, 221.2 83.2% 53.3%)));
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.mockos-subscription-sheet {
|
|
295
|
+
width: 100%;
|
|
296
|
+
border-top-left-radius: 16px;
|
|
297
|
+
border-top-right-radius: 16px;
|
|
298
|
+
overflow: hidden;
|
|
299
|
+
padding-bottom: max(12px, env(safe-area-inset-bottom));
|
|
300
|
+
transform: translateY(0);
|
|
301
|
+
background-color: colors.$surfaceColor;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.mockos-subscription-sheet--ios {
|
|
305
|
+
background-color: hsl(var(--card, var(--rb-card, 0 0% 100%)) / 0.96);
|
|
306
|
+
backdrop-filter: blur(20px);
|
|
307
|
+
box-shadow:
|
|
308
|
+
0 -12px 30px rgba(0, 0, 0, 0.18),
|
|
309
|
+
0 -2px 6px rgba(0, 0, 0, 0.08);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.mockos-subscription-sheet--android {
|
|
313
|
+
box-shadow:
|
|
314
|
+
0 -10px 20px rgba(0, 0, 0, 0.22),
|
|
315
|
+
0 -2px 6px rgba(0, 0, 0, 0.14);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.mockos-subscription-sheet__handle {
|
|
319
|
+
width: 44px;
|
|
320
|
+
height: 5px;
|
|
321
|
+
border-radius: 999px;
|
|
322
|
+
background-color: hsl(
|
|
323
|
+
var(--foreground, var(--rb-foreground, 220.9 39.3% 11%)) / 0.18
|
|
324
|
+
);
|
|
325
|
+
margin: 10px auto 0;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.mockos-subscription-sheet__content {
|
|
329
|
+
padding: 14px 16px 10px;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.mockos-subscription-sheet__content--ios {
|
|
333
|
+
padding: 10px 16px 10px;
|
|
334
|
+
text-align: center;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.mockos-subscription-sheet__top-actions {
|
|
338
|
+
display: flex;
|
|
339
|
+
justify-content: flex-end;
|
|
340
|
+
margin-bottom: 6px;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.mockos-subscription-sheet__android-header {
|
|
344
|
+
display: flex;
|
|
345
|
+
justify-content: space-between;
|
|
346
|
+
align-items: center;
|
|
347
|
+
gap: 12px;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.mockos-subscription-sheet__close {
|
|
351
|
+
width: 28px;
|
|
352
|
+
height: 28px;
|
|
353
|
+
border-radius: 999px;
|
|
354
|
+
border: none;
|
|
355
|
+
background: hsl(
|
|
356
|
+
var(--foreground, var(--rb-foreground, 220.9 39.3% 11%)) / 0.06
|
|
357
|
+
);
|
|
358
|
+
color: hsl(var(--foreground, var(--rb-foreground, 220.9 39.3% 11%)) / 0.55);
|
|
359
|
+
font-size: 18px;
|
|
360
|
+
line-height: 28px;
|
|
361
|
+
cursor: pointer;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.mockos-subscription-sheet__title {
|
|
365
|
+
font-weight: 600;
|
|
366
|
+
color: colors.$textColor;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.mockos-subscription-sheet__title--ios {
|
|
370
|
+
font-size: 15px;
|
|
371
|
+
margin-bottom: 8px;
|
|
372
|
+
line-height: 1.3;
|
|
373
|
+
letter-spacing: 0.2px;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.mockos-subscription-sheet__title--android {
|
|
377
|
+
font-size: 16px;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.mockos-subscription-sheet__subtitle {
|
|
381
|
+
color: hsl(
|
|
382
|
+
var(--muted-foreground, var(--rb-muted-foreground, 220 8.9% 46.1%))
|
|
383
|
+
);
|
|
384
|
+
line-height: 1.5;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.mockos-subscription-sheet__subtitle--ios {
|
|
388
|
+
font-size: 13px;
|
|
389
|
+
line-height: 1.4;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.mockos-subscription-sheet__subtitle--android {
|
|
393
|
+
margin-top: 8px;
|
|
394
|
+
font-size: 14px;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.mockos-subscription-sheet__card {
|
|
398
|
+
margin-top: 12px;
|
|
399
|
+
padding: 10px 12px;
|
|
400
|
+
background: hsl(
|
|
401
|
+
var(--foreground, var(--rb-foreground, 220.9 39.3% 11%)) / 0.04
|
|
402
|
+
);
|
|
403
|
+
text-align: left;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.mockos-subscription-sheet__card--ios {
|
|
407
|
+
border-radius: 12px;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.mockos-subscription-sheet__card--android {
|
|
411
|
+
margin-top: 14px;
|
|
412
|
+
border-radius: 10px;
|
|
413
|
+
border: 1px solid hsl(var(--border, var(--rb-border, 220 13% 91%)) / 0.7);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
.mockos-subscription-sheet__row {
|
|
417
|
+
display: flex;
|
|
418
|
+
align-items: center;
|
|
419
|
+
gap: 10px;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.mockos-subscription-sheet__row--space-between {
|
|
423
|
+
justify-content: space-between;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.mockos-subscription-sheet__icon {
|
|
427
|
+
width: 38px;
|
|
428
|
+
height: 38px;
|
|
429
|
+
border-radius: 10px;
|
|
430
|
+
background: linear-gradient(
|
|
431
|
+
135deg,
|
|
432
|
+
rgba(0, 122, 255, 0.25),
|
|
433
|
+
rgba(88, 86, 214, 0.22)
|
|
434
|
+
);
|
|
435
|
+
border: 1px solid hsl(var(--border, var(--rb-border, 220 13% 91%)) / 0.7);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.mockos-subscription-sheet__meta {
|
|
439
|
+
flex: 1;
|
|
440
|
+
min-width: 0;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.mockos-subscription-sheet__meta--android {
|
|
444
|
+
min-width: 0;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.mockos-subscription-sheet__product-id {
|
|
448
|
+
font-size: 14px;
|
|
449
|
+
font-weight: 600;
|
|
450
|
+
color: hsl(var(--foreground, var(--rb-foreground, 220.9 39.3% 11%)) / 0.9);
|
|
451
|
+
line-height: 1.2;
|
|
452
|
+
white-space: nowrap;
|
|
453
|
+
overflow: hidden;
|
|
454
|
+
text-overflow: ellipsis;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.mockos-subscription-sheet__meta-subtitle {
|
|
458
|
+
margin-top: 2px;
|
|
459
|
+
font-size: 12px;
|
|
460
|
+
color: hsl(
|
|
461
|
+
var(--muted-foreground, var(--rb-muted-foreground, 220 8.9% 46.1%)) / 0.95
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.mockos-subscription-sheet__price {
|
|
466
|
+
font-size: 13px;
|
|
467
|
+
font-weight: 700;
|
|
468
|
+
color: hsl(var(--foreground, var(--rb-foreground, 220.9 39.3% 11%)) / 0.86);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.mockos-subscription-sheet__actions {
|
|
472
|
+
display: flex;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.mockos-subscription-sheet__actions--ios {
|
|
476
|
+
border-top: 0.5px solid
|
|
477
|
+
hsl(var(--border, var(--rb-border, 220 13% 91%)) / 0.6);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.mockos-subscription-sheet__actions--android {
|
|
481
|
+
padding: 10px 12px 12px;
|
|
482
|
+
justify-content: flex-end;
|
|
483
|
+
gap: 8px;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.mockos-subscription-sheet__action {
|
|
487
|
+
background: transparent;
|
|
488
|
+
border: none;
|
|
489
|
+
cursor: pointer;
|
|
490
|
+
font: inherit;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.mockos-subscription-sheet__action--ios {
|
|
494
|
+
flex: 1;
|
|
495
|
+
padding: 13px 0;
|
|
496
|
+
font-size: 17px;
|
|
497
|
+
font-weight: 400;
|
|
498
|
+
color: hsl(var(--primary, var(--rb-primary, 221.2 83.2% 53.3%)));
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.mockos-subscription-sheet__actions--ios
|
|
502
|
+
.mockos-subscription-sheet__action--ios:first-child {
|
|
503
|
+
border-right: 0.5px solid
|
|
504
|
+
hsl(var(--border, var(--rb-border, 220 13% 91%)) / 0.6);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.mockos-subscription-sheet__action--bold {
|
|
508
|
+
font-weight: 600;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.mockos-subscription-sheet__action--android {
|
|
512
|
+
padding: 10px 16px;
|
|
513
|
+
font-size: 14px;
|
|
514
|
+
font-weight: 600;
|
|
515
|
+
border-radius: 4px;
|
|
516
|
+
text-transform: uppercase;
|
|
517
|
+
letter-spacing: 0.5px;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.mockos-subscription-sheet__action--cancel {
|
|
521
|
+
color: hsl(
|
|
522
|
+
var(--muted-foreground, var(--rb-muted-foreground, 220 8.9% 46.1%))
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.mockos-subscription-sheet__action--primary {
|
|
527
|
+
color: hsl(var(--primary, var(--rb-primary, 221.2 83.2% 53.3%)));
|
|
528
|
+
background: hsl(var(--primary, var(--rb-primary, 221.2 83.2% 53.3%)) / 0.12);
|
|
529
|
+
border-radius: 999px;
|
|
530
|
+
font-weight: 700;
|
|
531
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* Onboard components */
|
|
2
|
+
|
|
3
|
+
.onboard__separator {
|
|
4
|
+
height: 1px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.onboard__buttons {
|
|
9
|
+
display: flex;
|
|
10
|
+
height: 40px;
|
|
11
|
+
gap: 12px;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
margin: 12px 24px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.onboard__buttons--row {
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.onboard__buttons--column {
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
}
|
package/src/styles/index.scss
CHANGED
|
@@ -22,7 +22,12 @@ export type AnalyseResultWithPath = {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
type AttributeTypeSpec = string | string[];
|
|
25
|
-
|
|
25
|
+
// schema v2 supports nesting style specs under `attributes.style` (one level deep)
|
|
26
|
+
type NestedAttributeSchema = Record<string, AttributeTypeSpec>;
|
|
27
|
+
type AttributeSchema = Record<
|
|
28
|
+
string,
|
|
29
|
+
AttributeTypeSpec | NestedAttributeSchema
|
|
30
|
+
>;
|
|
26
31
|
|
|
27
32
|
type PatternLike = {
|
|
28
33
|
pattern: {
|
|
@@ -51,6 +56,16 @@ function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
|
51
56
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
52
57
|
}
|
|
53
58
|
|
|
59
|
+
function getStyleSubSchema(
|
|
60
|
+
schema: AttributeSchema | undefined,
|
|
61
|
+
): AttributeSchema {
|
|
62
|
+
if (!schema) return {};
|
|
63
|
+
const maybe = schema.style;
|
|
64
|
+
if (!maybe) return {};
|
|
65
|
+
if (typeof maybe === 'string' || Array.isArray(maybe)) return {};
|
|
66
|
+
return (maybe ?? {}) as AttributeSchema;
|
|
67
|
+
}
|
|
68
|
+
|
|
54
69
|
function isNodeDataLike(
|
|
55
70
|
value: unknown,
|
|
56
71
|
): value is NodeData<NodeDefaultAttribute> {
|
|
@@ -359,6 +374,7 @@ function validateAttributesByPattern(
|
|
|
359
374
|
const schema: AttributeSchema = (getAttributeSchema(pattern.pattern.type) ??
|
|
360
375
|
pattern.pattern.attributes ??
|
|
361
376
|
{}) as AttributeSchema;
|
|
377
|
+
const styleSchema = getStyleSubSchema(schema);
|
|
362
378
|
|
|
363
379
|
// Validate nested `attributes.style` as an object; validate any style keys that also exist in schema.
|
|
364
380
|
const maybeStyle = (attrs as Record<string, unknown>).style;
|
|
@@ -369,7 +385,9 @@ function validateAttributesByPattern(
|
|
|
369
385
|
for (const [styleKey, styleValue] of Object.entries(
|
|
370
386
|
maybeStyle as Record<string, unknown>,
|
|
371
387
|
)) {
|
|
372
|
-
const spec = schema?.[styleKey]
|
|
388
|
+
const spec = (styleSchema?.[styleKey] ?? schema?.[styleKey]) as
|
|
389
|
+
| AttributeTypeSpec
|
|
390
|
+
| undefined;
|
|
373
391
|
if (!spec) continue; // allow unknown style keys (free-form CSSProperties)
|
|
374
392
|
const res = validateAttributeValue(
|
|
375
393
|
pattern.pattern.type,
|
|
@@ -383,9 +401,26 @@ function validateAttributesByPattern(
|
|
|
383
401
|
|
|
384
402
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
385
403
|
if (attrName === 'style') continue;
|
|
386
|
-
const attrSpec = schema?.[attrName];
|
|
404
|
+
const attrSpec = schema?.[attrName] as AttributeTypeSpec | undefined;
|
|
387
405
|
if (!attrSpec) {
|
|
388
|
-
|
|
406
|
+
// Back-compat: allow legacy flat style keys even when the schema nests them.
|
|
407
|
+
const legacyStyleSpec = styleSchema?.[attrName] as
|
|
408
|
+
| AttributeTypeSpec
|
|
409
|
+
| undefined;
|
|
410
|
+
if (!legacyStyleSpec) {
|
|
411
|
+
return fail(
|
|
412
|
+
`Unknown attribute "${attrName}"`,
|
|
413
|
+
joinPath(path, attrName),
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
const res = validateAttributeValue(
|
|
417
|
+
pattern.pattern.type,
|
|
418
|
+
attrValue,
|
|
419
|
+
legacyStyleSpec,
|
|
420
|
+
joinPath(path, attrName),
|
|
421
|
+
);
|
|
422
|
+
if (!res.valid) return res;
|
|
423
|
+
continue;
|
|
389
424
|
}
|
|
390
425
|
const res = validateAttributeValue(
|
|
391
426
|
pattern.pattern.type,
|
|
@@ -15,7 +15,10 @@ import {
|
|
|
15
15
|
} from '../loadFontFamily';
|
|
16
16
|
import { fontsDebug } from '../fontsDebug';
|
|
17
17
|
|
|
18
|
-
const inFlightFontLoads: Map<string, Promise<void>> = new Map
|
|
18
|
+
const inFlightFontLoads: Map<string, Promise<void>> = new Map<
|
|
19
|
+
string,
|
|
20
|
+
Promise<void>
|
|
21
|
+
>();
|
|
19
22
|
|
|
20
23
|
function weightToNumericKey(weight: unknown): string | undefined {
|
|
21
24
|
const normalized = normalizeFontWeight(weight);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import metaJson from '../assets/meta.json';
|
|
2
|
+
|
|
3
|
+
export type BuilderMeta = {
|
|
4
|
+
supportedProjectVersion: string;
|
|
5
|
+
reactBuilderVersion: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const meta: BuilderMeta = {
|
|
9
|
+
supportedProjectVersion: metaJson.supportedProjectVersion,
|
|
10
|
+
reactBuilderVersion: metaJson.reactBuilderVersion,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export function getMeta(): BuilderMeta {
|
|
14
|
+
return { ...meta };
|
|
15
|
+
}
|
package/src/utils/patterns.ts
CHANGED
|
@@ -66,6 +66,38 @@ function normalizePlatform(platform?: BuilderPlatform | null): BuilderPlatform {
|
|
|
66
66
|
return platform === 'native' ? 'native' : 'web';
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Keys that conceptually behave like component props (behavior/flags) rather than
|
|
71
|
+
* style properties. These should NOT be normalized into `attributes.style`.
|
|
72
|
+
*/
|
|
73
|
+
export const NON_STYLE_ATTRIBUTE_KEYS = new Set<string>([
|
|
74
|
+
'scrollable',
|
|
75
|
+
'showEllipsis',
|
|
76
|
+
'adjustsFontSizeToFit',
|
|
77
|
+
]);
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* schemaVersion=2 stores style-like keys inside `attributes.style`.
|
|
81
|
+
*
|
|
82
|
+
* We treat View+Text schema keys as style-like by default, but explicitly exclude
|
|
83
|
+
* known non-style props (behavior flags).
|
|
84
|
+
*/
|
|
85
|
+
export function getStyleAttributeKeySet(): Set<string> {
|
|
86
|
+
const viewSchema = getAttributeSchema('View') ?? {};
|
|
87
|
+
const textSchema = getAttributeSchema('Text') ?? {};
|
|
88
|
+
const viewStyle =
|
|
89
|
+
typeof (viewSchema as any)?.style === 'object' && (viewSchema as any)?.style
|
|
90
|
+
? Object.keys((viewSchema as any).style)
|
|
91
|
+
: Object.keys(viewSchema);
|
|
92
|
+
const textStyle =
|
|
93
|
+
typeof (textSchema as any)?.style === 'object' && (textSchema as any)?.style
|
|
94
|
+
? Object.keys((textSchema as any).style)
|
|
95
|
+
: Object.keys(textSchema);
|
|
96
|
+
const out = new Set<string>([...viewStyle, ...textStyle]);
|
|
97
|
+
for (const k of NON_STYLE_ATTRIBUTE_KEYS) out.delete(k);
|
|
98
|
+
return out;
|
|
99
|
+
}
|
|
100
|
+
|
|
69
101
|
function adjustMetaForPlatform(
|
|
70
102
|
meta: Record<string, AttributeMeta> | undefined,
|
|
71
103
|
platform?: BuilderPlatform,
|
|
@@ -113,7 +145,7 @@ function adjustMetaForPlatform(
|
|
|
113
145
|
}
|
|
114
146
|
|
|
115
147
|
// Build a fast lookup map without normalization for direct access
|
|
116
|
-
const patternIndex: Map<string, Pattern> = new Map(
|
|
148
|
+
const patternIndex: Map<string, Pattern> = new Map<string, Pattern>(
|
|
117
149
|
patterns.map((p) => [p.pattern.type, p]),
|
|
118
150
|
);
|
|
119
151
|
|
|
@@ -131,7 +163,7 @@ function pascalToKebabCase(s: string): string {
|
|
|
131
163
|
.toLowerCase();
|
|
132
164
|
}
|
|
133
165
|
|
|
134
|
-
const typeAliases: Map<string, string> = new Map();
|
|
166
|
+
const typeAliases: Map<string, string> = new Map<string, string>();
|
|
135
167
|
for (const p of patterns) {
|
|
136
168
|
const canonical = p?.pattern?.type;
|
|
137
169
|
if (typeof canonical !== 'string' || !canonical) continue;
|
|
@@ -176,8 +208,19 @@ export function getAttributeMeta(
|
|
|
176
208
|
platform?: BuilderPlatform,
|
|
177
209
|
): Record<string, AttributeMeta> | undefined {
|
|
178
210
|
const p = getPatternByType(type);
|
|
179
|
-
const
|
|
180
|
-
|
|
211
|
+
const styles = p?.meta?.styles;
|
|
212
|
+
const attributes = p?.meta?.attributes;
|
|
213
|
+
|
|
214
|
+
// schemaVersion=2 prefers `meta.styles` but some repos split UI meta into:
|
|
215
|
+
// - meta.styles: style-tab fields
|
|
216
|
+
// - meta.attributes: non-style fields (container/other)
|
|
217
|
+
// Merge both to keep the editor + platform adjustments working.
|
|
218
|
+
const merged =
|
|
219
|
+
styles && attributes
|
|
220
|
+
? { ...attributes, ...styles }
|
|
221
|
+
: (styles ?? attributes);
|
|
222
|
+
|
|
223
|
+
return adjustMetaForPlatform(merged, platform);
|
|
181
224
|
}
|
|
182
225
|
|
|
183
226
|
/** Returns defaults block (if any) for a given component type */
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { NodeData } from '../types/Node';
|
|
2
|
-
import type { ImagePropsGenerated } from '../build-components/Image/ImageProps.generated';
|
|
3
|
-
export declare function useExtractImageStyle<T extends ImagePropsGenerated['attributes']>(node: NodeData<T>): {
|
|
4
|
-
[x: string]: unknown;
|
|
5
|
-
} | import("react").CSSProperties;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { NodeData } from '../types/Node';
|
|
2
|
-
import type { TextPropsGenerated } from '../build-components/Text/TextProps.generated';
|
|
3
|
-
export declare function useExtractTextStyle<T extends TextPropsGenerated['attributes']>(node: NodeData<T>): Record<string, unknown> | import("react").CSSProperties;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { NodeData } from '../types/Node';
|
|
2
|
-
import type { ViewPropsGenerated } from '../build-components/View/ViewProps.generated';
|
|
3
|
-
export declare function useExtractViewStyle<T extends ViewPropsGenerated['attributes']>(node: NodeData<T>): Record<string, unknown> | import("react").CSSProperties;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import type { NodeData } from '../types/Node';
|
|
3
|
-
import type { ImagePropsGenerated } from '../build-components/Image/ImageProps.generated';
|
|
4
|
-
import { useBuilderParams } from '../components/BuilderProvider';
|
|
5
|
-
import {
|
|
6
|
-
extractImageStyle,
|
|
7
|
-
extractImageStyleNative,
|
|
8
|
-
} from '../utils/extractImageStyle';
|
|
9
|
-
import { defaultAppConfig } from '../types/PreviewConfig';
|
|
10
|
-
|
|
11
|
-
export function useExtractImageStyle<
|
|
12
|
-
T extends ImagePropsGenerated['attributes'],
|
|
13
|
-
>(node: NodeData<T>) {
|
|
14
|
-
const {
|
|
15
|
-
appConfig,
|
|
16
|
-
projectColors: builderProjectColors,
|
|
17
|
-
platform,
|
|
18
|
-
} = useBuilderParams();
|
|
19
|
-
const theme = appConfig?.theme ?? defaultAppConfig.theme;
|
|
20
|
-
const projectColors = builderProjectColors;
|
|
21
|
-
const isNative = platform === 'native';
|
|
22
|
-
|
|
23
|
-
return useMemo(
|
|
24
|
-
() =>
|
|
25
|
-
isNative
|
|
26
|
-
? extractImageStyleNative(node, { theme, projectColors })
|
|
27
|
-
: extractImageStyle(node, { theme, projectColors }),
|
|
28
|
-
[node, theme, projectColors, isNative],
|
|
29
|
-
);
|
|
30
|
-
}
|