@kubuild/components 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -3,4 +3,5 @@ export * from './definitions';
3
3
  export * from './requirements';
4
4
  export * from './prop-types';
5
5
  export * from './traits';
6
+ export * from './blocks';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -2268,8 +2268,527 @@ function primitiveTypeForField(field) {
2268
2268
  function isBindableField(field) {
2269
2269
  return primitiveTypeForField(field) !== void 0;
2270
2270
  }
2271
+
2272
+ // src/blocks.ts
2273
+ var nextId = 1;
2274
+ function defaultGenId(prefix = "node") {
2275
+ return `${prefix}-${Date.now().toString(36)}-${(nextId++).toString(36)}`;
2276
+ }
2277
+ var STARTER_BLOCKS = [
2278
+ // --- Layout Blocks (STORA-241) ---
2279
+ {
2280
+ id: "layout-1-col",
2281
+ name: "1 Column",
2282
+ category: "layout",
2283
+ categoryLabel: "Layout Blocks",
2284
+ description: "Full-width single column container inside a section",
2285
+ icon: "layout",
2286
+ createNodeTree: (gen = defaultGenId) => ({
2287
+ id: gen("section"),
2288
+ type: "section",
2289
+ styles: { base: { padding: "40px 20px", width: "100%" } },
2290
+ children: [
2291
+ {
2292
+ id: gen("container"),
2293
+ type: "container",
2294
+ props: { tag: "div" },
2295
+ styles: { base: { maxWidth: "1200px", margin: "0 auto", width: "100%" } },
2296
+ children: []
2297
+ }
2298
+ ]
2299
+ })
2300
+ },
2301
+ {
2302
+ id: "layout-2-col-50-50",
2303
+ name: "2 Columns (50/50)",
2304
+ category: "layout",
2305
+ categoryLabel: "Layout Blocks",
2306
+ description: "Two equal-width 50/50 columns with flexible layout",
2307
+ icon: "columns",
2308
+ createNodeTree: (gen = defaultGenId) => ({
2309
+ id: gen("section"),
2310
+ type: "section",
2311
+ styles: { base: { padding: "40px 20px", width: "100%" } },
2312
+ children: [
2313
+ {
2314
+ id: gen("columns"),
2315
+ type: "columns",
2316
+ props: { columns: 2, gap: "24px" },
2317
+ styles: { base: { display: "flex", gap: "24px", width: "100%", maxWidth: "1200px", margin: "0 auto" } },
2318
+ children: [
2319
+ {
2320
+ id: gen("container"),
2321
+ type: "container",
2322
+ props: { tag: "div" },
2323
+ styles: { base: { flex: "1 1 0%", minWidth: "0" } },
2324
+ children: []
2325
+ },
2326
+ {
2327
+ id: gen("container"),
2328
+ type: "container",
2329
+ props: { tag: "div" },
2330
+ styles: { base: { flex: "1 1 0%", minWidth: "0" } },
2331
+ children: []
2332
+ }
2333
+ ]
2334
+ }
2335
+ ]
2336
+ })
2337
+ },
2338
+ {
2339
+ id: "layout-2-col-30-70",
2340
+ name: "2 Columns (30/70)",
2341
+ category: "layout",
2342
+ categoryLabel: "Layout Blocks",
2343
+ description: "Two asymmetric columns: 30% sidebar and 70% main area",
2344
+ icon: "columns",
2345
+ createNodeTree: (gen = defaultGenId) => ({
2346
+ id: gen("section"),
2347
+ type: "section",
2348
+ styles: { base: { padding: "40px 20px", width: "100%" } },
2349
+ children: [
2350
+ {
2351
+ id: gen("columns"),
2352
+ type: "columns",
2353
+ props: { columns: 2, gap: "24px" },
2354
+ styles: { base: { display: "flex", gap: "24px", width: "100%", maxWidth: "1200px", margin: "0 auto" } },
2355
+ children: [
2356
+ {
2357
+ id: gen("container"),
2358
+ type: "container",
2359
+ props: { tag: "div" },
2360
+ styles: { base: { flex: "0 0 30%", minWidth: "0" } },
2361
+ children: []
2362
+ },
2363
+ {
2364
+ id: gen("container"),
2365
+ type: "container",
2366
+ props: { tag: "div" },
2367
+ styles: { base: { flex: "1 1 0%", minWidth: "0" } },
2368
+ children: []
2369
+ }
2370
+ ]
2371
+ }
2372
+ ]
2373
+ })
2374
+ },
2375
+ {
2376
+ id: "layout-3-col",
2377
+ name: "3 Columns",
2378
+ category: "layout",
2379
+ categoryLabel: "Layout Blocks",
2380
+ description: "Three equal-width columns for grid showcases or card groups",
2381
+ icon: "grid",
2382
+ createNodeTree: (gen = defaultGenId) => ({
2383
+ id: gen("section"),
2384
+ type: "section",
2385
+ styles: { base: { padding: "40px 20px", width: "100%" } },
2386
+ children: [
2387
+ {
2388
+ id: gen("columns"),
2389
+ type: "columns",
2390
+ props: { columns: 3, gap: "24px" },
2391
+ styles: { base: { display: "flex", gap: "24px", width: "100%", maxWidth: "1200px", margin: "0 auto" } },
2392
+ children: [
2393
+ {
2394
+ id: gen("container"),
2395
+ type: "container",
2396
+ props: { tag: "div" },
2397
+ styles: { base: { flex: "1 1 0%", minWidth: "0" } },
2398
+ children: []
2399
+ },
2400
+ {
2401
+ id: gen("container"),
2402
+ type: "container",
2403
+ props: { tag: "div" },
2404
+ styles: { base: { flex: "1 1 0%", minWidth: "0" } },
2405
+ children: []
2406
+ },
2407
+ {
2408
+ id: gen("container"),
2409
+ type: "container",
2410
+ props: { tag: "div" },
2411
+ styles: { base: { flex: "1 1 0%", minWidth: "0" } },
2412
+ children: []
2413
+ }
2414
+ ]
2415
+ }
2416
+ ]
2417
+ })
2418
+ },
2419
+ {
2420
+ id: "layout-4-col",
2421
+ name: "4 Columns",
2422
+ category: "layout",
2423
+ categoryLabel: "Layout Blocks",
2424
+ description: "Four equal columns for metric stats, logos, or compact feature cards",
2425
+ icon: "grid",
2426
+ createNodeTree: (gen = defaultGenId) => ({
2427
+ id: gen("section"),
2428
+ type: "section",
2429
+ styles: { base: { padding: "40px 20px", width: "100%" } },
2430
+ children: [
2431
+ {
2432
+ id: gen("columns"),
2433
+ type: "columns",
2434
+ props: { columns: 4, gap: "16px" },
2435
+ styles: { base: { display: "flex", gap: "16px", width: "100%", maxWidth: "1200px", margin: "0 auto" } },
2436
+ children: [
2437
+ {
2438
+ id: gen("container"),
2439
+ type: "container",
2440
+ props: { tag: "div" },
2441
+ styles: { base: { flex: "1 1 0%", minWidth: "0" } },
2442
+ children: []
2443
+ },
2444
+ {
2445
+ id: gen("container"),
2446
+ type: "container",
2447
+ props: { tag: "div" },
2448
+ styles: { base: { flex: "1 1 0%", minWidth: "0" } },
2449
+ children: []
2450
+ },
2451
+ {
2452
+ id: gen("container"),
2453
+ type: "container",
2454
+ props: { tag: "div" },
2455
+ styles: { base: { flex: "1 1 0%", minWidth: "0" } },
2456
+ children: []
2457
+ },
2458
+ {
2459
+ id: gen("container"),
2460
+ type: "container",
2461
+ props: { tag: "div" },
2462
+ styles: { base: { flex: "1 1 0%", minWidth: "0" } },
2463
+ children: []
2464
+ }
2465
+ ]
2466
+ }
2467
+ ]
2468
+ })
2469
+ },
2470
+ // --- Pre-composed UI Blocks (STORA-242) ---
2471
+ {
2472
+ id: "hero-section",
2473
+ name: "Hero Section",
2474
+ category: "sections",
2475
+ categoryLabel: "Hero & Headers",
2476
+ description: "Engaging hero banner with headline, lead paragraph, and call-to-action button",
2477
+ icon: "layout",
2478
+ createNodeTree: (gen = defaultGenId) => ({
2479
+ id: gen("section"),
2480
+ type: "section",
2481
+ styles: {
2482
+ base: {
2483
+ padding: "80px 24px",
2484
+ backgroundColor: "#f8fafc",
2485
+ textAlign: "center",
2486
+ width: "100%"
2487
+ }
2488
+ },
2489
+ children: [
2490
+ {
2491
+ id: gen("container"),
2492
+ type: "container",
2493
+ props: { tag: "div" },
2494
+ styles: { base: { maxWidth: "768px", margin: "0 auto" } },
2495
+ children: [
2496
+ {
2497
+ id: gen("heading"),
2498
+ type: "heading",
2499
+ props: { text: "Build Remarkable Experiences", level: 1 },
2500
+ styles: {
2501
+ base: {
2502
+ fontSize: "44px",
2503
+ fontWeight: "800",
2504
+ color: "#0f172a",
2505
+ marginBottom: "16px",
2506
+ lineHeight: "1.2"
2507
+ }
2508
+ }
2509
+ },
2510
+ {
2511
+ id: gen("paragraph"),
2512
+ type: "paragraph",
2513
+ props: {
2514
+ content: "A visual builder designed for maximum craft, responsiveness, and performance."
2515
+ },
2516
+ styles: {
2517
+ base: {
2518
+ fontSize: "18px",
2519
+ color: "#475569",
2520
+ marginBottom: "32px",
2521
+ lineHeight: "1.6"
2522
+ }
2523
+ }
2524
+ },
2525
+ {
2526
+ id: gen("button"),
2527
+ type: "button",
2528
+ props: { label: "Get Started Today", href: "#explore" },
2529
+ styles: {
2530
+ base: {
2531
+ backgroundColor: "#2563eb",
2532
+ color: "#ffffff",
2533
+ padding: "12px 28px",
2534
+ borderRadius: "8px",
2535
+ fontWeight: "600",
2536
+ display: "inline-block"
2537
+ },
2538
+ states: {
2539
+ ":hover": { backgroundColor: "#1d4ed8" }
2540
+ }
2541
+ }
2542
+ }
2543
+ ]
2544
+ }
2545
+ ]
2546
+ })
2547
+ },
2548
+ {
2549
+ id: "feature-card",
2550
+ name: "Feature Card",
2551
+ category: "ui",
2552
+ categoryLabel: "UI Blocks",
2553
+ description: "Clean elevated feature card with badge, title, text, and action link",
2554
+ icon: "box",
2555
+ createNodeTree: (gen = defaultGenId) => ({
2556
+ id: gen("container"),
2557
+ type: "container",
2558
+ props: { tag: "div" },
2559
+ styles: {
2560
+ base: {
2561
+ padding: "24px",
2562
+ backgroundColor: "#ffffff",
2563
+ borderRadius: "12px",
2564
+ border: "1px solid #e2e8f0",
2565
+ boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.05)"
2566
+ }
2567
+ },
2568
+ children: [
2569
+ {
2570
+ id: gen("badge"),
2571
+ type: "badge",
2572
+ props: { label: "PRO FEATURE", variant: "primary" },
2573
+ styles: { base: { marginBottom: "12px", display: "inline-block" } }
2574
+ },
2575
+ {
2576
+ id: gen("heading"),
2577
+ type: "heading",
2578
+ props: { text: "Next-Gen Performance", level: 3 },
2579
+ styles: {
2580
+ base: { fontSize: "20px", fontWeight: "700", color: "#1e293b", marginBottom: "8px" }
2581
+ }
2582
+ },
2583
+ {
2584
+ id: gen("paragraph"),
2585
+ type: "paragraph",
2586
+ props: {
2587
+ content: "Engineered for sub-millisecond render updates and zero runtime overhead."
2588
+ },
2589
+ styles: { base: { fontSize: "14px", color: "#64748b", lineHeight: "1.5" } }
2590
+ }
2591
+ ]
2592
+ })
2593
+ },
2594
+ {
2595
+ id: "media-object",
2596
+ name: "Media Object",
2597
+ category: "ui",
2598
+ categoryLabel: "UI Blocks",
2599
+ description: "Horizontal media layout with image beside text content",
2600
+ icon: "image",
2601
+ createNodeTree: (gen = defaultGenId) => ({
2602
+ id: gen("container"),
2603
+ type: "container",
2604
+ props: { tag: "div" },
2605
+ styles: {
2606
+ base: {
2607
+ display: "flex",
2608
+ gap: "16px",
2609
+ alignItems: "flex-start",
2610
+ padding: "16px",
2611
+ backgroundColor: "#ffffff",
2612
+ borderRadius: "8px",
2613
+ border: "1px solid #e2e8f0"
2614
+ }
2615
+ },
2616
+ children: [
2617
+ {
2618
+ id: gen("image"),
2619
+ type: "image",
2620
+ props: {
2621
+ src: "https://images.unsplash.com/photo-1579546929518-9e396f3cc809?w=160&auto=format&fit=crop&q=80",
2622
+ alt: "Visual preview"
2623
+ },
2624
+ styles: {
2625
+ base: {
2626
+ width: "80px",
2627
+ height: "80px",
2628
+ borderRadius: "8px",
2629
+ objectFit: "cover",
2630
+ flexShrink: "0"
2631
+ }
2632
+ }
2633
+ },
2634
+ {
2635
+ id: gen("container"),
2636
+ type: "container",
2637
+ props: { tag: "div" },
2638
+ styles: { base: { flex: "1 1 0%" } },
2639
+ children: [
2640
+ {
2641
+ id: gen("heading"),
2642
+ type: "heading",
2643
+ props: { text: "Creative Studio Asset", level: 4 },
2644
+ styles: {
2645
+ base: { fontSize: "16px", fontWeight: "600", color: "#0f172a", marginBottom: "4px" }
2646
+ }
2647
+ },
2648
+ {
2649
+ id: gen("paragraph"),
2650
+ type: "paragraph",
2651
+ props: { content: "High dynamic range gradients crafted for modern presentations." },
2652
+ styles: { base: { fontSize: "13px", color: "#64748b", lineHeight: "1.4" } }
2653
+ }
2654
+ ]
2655
+ }
2656
+ ]
2657
+ })
2658
+ },
2659
+ {
2660
+ id: "pricing-table",
2661
+ name: "Pricing Table",
2662
+ category: "pricing",
2663
+ categoryLabel: "Pricing",
2664
+ description: "Highlighted subscription pricing plan with price, feature list, and buy button",
2665
+ icon: "table",
2666
+ createNodeTree: (gen = defaultGenId) => ({
2667
+ id: gen("container"),
2668
+ type: "container",
2669
+ props: { tag: "div" },
2670
+ styles: {
2671
+ base: {
2672
+ padding: "32px 24px",
2673
+ backgroundColor: "#ffffff",
2674
+ borderRadius: "16px",
2675
+ border: "2px solid #3b82f6",
2676
+ boxShadow: "0 10px 15px -3px rgba(59, 130, 246, 0.1)",
2677
+ textAlign: "center",
2678
+ maxWidth: "360px"
2679
+ }
2680
+ },
2681
+ children: [
2682
+ {
2683
+ id: gen("badge"),
2684
+ type: "badge",
2685
+ props: { label: "MOST POPULAR", variant: "primary" },
2686
+ styles: { base: { marginBottom: "12px", display: "inline-block" } }
2687
+ },
2688
+ {
2689
+ id: gen("heading"),
2690
+ type: "heading",
2691
+ props: { text: "Professional", level: 3 },
2692
+ styles: { base: { fontSize: "22px", fontWeight: "700", color: "#0f172a" } }
2693
+ },
2694
+ {
2695
+ id: gen("heading"),
2696
+ type: "heading",
2697
+ props: { text: "$29 / mo", level: 2 },
2698
+ styles: {
2699
+ base: { fontSize: "36px", fontWeight: "800", color: "#2563eb", margin: "16px 0 24px 0" }
2700
+ }
2701
+ },
2702
+ {
2703
+ id: gen("paragraph"),
2704
+ type: "paragraph",
2705
+ props: { content: "Includes unlimited pages, custom domains, and team collaboration." },
2706
+ styles: { base: { fontSize: "14px", color: "#64748b", marginBottom: "24px" } }
2707
+ },
2708
+ {
2709
+ id: gen("button"),
2710
+ type: "button",
2711
+ props: { label: "Upgrade to Pro", href: "#checkout" },
2712
+ styles: {
2713
+ base: {
2714
+ width: "100%",
2715
+ backgroundColor: "#2563eb",
2716
+ color: "#ffffff",
2717
+ padding: "12px",
2718
+ borderRadius: "8px",
2719
+ fontWeight: "600",
2720
+ display: "block"
2721
+ },
2722
+ states: {
2723
+ ":hover": { backgroundColor: "#1d4ed8" }
2724
+ }
2725
+ }
2726
+ }
2727
+ ]
2728
+ })
2729
+ },
2730
+ {
2731
+ id: "cta-banner",
2732
+ name: "CTA Banner",
2733
+ category: "cta",
2734
+ categoryLabel: "Call to Action",
2735
+ description: "High-contrast conversion banner with title and action button",
2736
+ icon: "layout",
2737
+ createNodeTree: (gen = defaultGenId) => ({
2738
+ id: gen("section"),
2739
+ type: "section",
2740
+ styles: {
2741
+ base: {
2742
+ padding: "60px 24px",
2743
+ backgroundColor: "#0f172a",
2744
+ color: "#ffffff",
2745
+ borderRadius: "16px",
2746
+ textAlign: "center",
2747
+ width: "100%"
2748
+ }
2749
+ },
2750
+ children: [
2751
+ {
2752
+ id: gen("heading"),
2753
+ type: "heading",
2754
+ props: { text: "Ready to boost your workflow?", level: 2 },
2755
+ styles: {
2756
+ base: { fontSize: "32px", fontWeight: "700", color: "#ffffff", marginBottom: "12px" }
2757
+ }
2758
+ },
2759
+ {
2760
+ id: gen("paragraph"),
2761
+ type: "paragraph",
2762
+ props: { content: "Start building with zero installation and instant live preview." },
2763
+ styles: {
2764
+ base: { fontSize: "16px", color: "#94a3b8", marginBottom: "24px", maxWidth: "600px", margin: "0 auto 24px auto" }
2765
+ }
2766
+ },
2767
+ {
2768
+ id: gen("button"),
2769
+ type: "button",
2770
+ props: { label: "Start Free Trial", href: "#signup" },
2771
+ styles: {
2772
+ base: {
2773
+ backgroundColor: "#ffffff",
2774
+ color: "#0f172a",
2775
+ padding: "12px 28px",
2776
+ borderRadius: "8px",
2777
+ fontWeight: "700",
2778
+ display: "inline-block"
2779
+ },
2780
+ states: {
2781
+ ":hover": { backgroundColor: "#f1f5f9" }
2782
+ }
2783
+ }
2784
+ }
2785
+ ]
2786
+ })
2787
+ }
2788
+ ];
2271
2789
  export {
2272
2790
  ComponentRegistry,
2791
+ STARTER_BLOCKS,
2273
2792
  TRAIT_GROUP_LABELS,
2274
2793
  TRAIT_GROUP_ORDER,
2275
2794
  actionTrait,