ab-nextjs-components 0.2.2 β 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -12
- package/ab-bottom-drawer/index.tsx +35 -4
- package/ab-bottom-drawer/use-ab-swipe-down.ts +125 -0
- package/ab-button/helpers.ts +2 -2
- package/ab-button/index.tsx +1 -1
- package/ab-button/styles.module.css +86 -20
- package/ab-carousel/index.tsx +202 -31
- package/ab-carousel/styles.module.css +22 -1
- package/ab-drawer/kit.module.css +27 -0
- package/ab-flow-diagram/frame-scale.tsx +65 -0
- package/ab-flow-diagram/helpers.ts +89 -3
- package/ab-flow-diagram/index.tsx +116 -3
- package/ab-flow-diagram/styles.module.css +112 -1
- package/ab-mobile-header/index.tsx +151 -12
- package/ab-playground-scene/i18n.module.css +54 -0
- package/ab-playground-scene/i18n.tsx +141 -0
- package/ab-playground-scene/icons.tsx +96 -0
- package/ab-playground-scene/index.tsx +138 -0
- package/ab-playground-scene/labels.ts +103 -0
- package/ab-playground-scene/scenes.tsx +103 -0
- package/ab-playground-scene/styles.module.css +148 -0
- package/ab-playground-scene/upgraded.tsx +315 -0
- package/ab-playground-scene/welcome.tsx +120 -0
- package/ab-theme-mode/index.tsx +82 -0
- package/ab-theme-toggle/index.tsx +22 -3
- package/index.ts +11 -14
- package/package.json +9 -18
- package/server/ab-button/index.tsx +3 -2
- package/server/index.ts +0 -3
- package/types/index.d.ts +8 -6
- package/ab-key-feature/index.tsx +0 -61
- package/ab-key-feature/styles.module.css +0 -79
- package/ab-main-headline/index.tsx +0 -58
- package/ab-main-headline/styles.module.css +0 -56
- package/ab-preview/index.tsx +0 -79
- package/ab-preview/styles.module.css +0 -58
- package/ab-switch-back/index.tsx +0 -73
- package/ab-switch-back/styles.module.css +0 -77
- package/ab-test-hello/index.tsx +0 -38
- package/ab-test-hello/styles.module.css +0 -57
- package/server/ab-button/styles.module.css +0 -191
- package/server/ab-key-feature/index.tsx +0 -60
- package/server/ab-key-feature/styles.module.css +0 -79
- package/server/ab-switch-back/index.tsx +0 -72
- package/server/ab-switch-back/styles.module.css +0 -77
- package/server/ab-test-hello/index.tsx +0 -36
- package/server/ab-test-hello/styles.module.css +0 -54
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-components
|
|
27
|
+
* @name: AbPlaygroundScene - Styles (G38)
|
|
28
|
+
* @file: ab-playground-scene/styles.module.css
|
|
29
|
+
* @type: CSS module β transform/opacity/dash only (CLS 0)
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
35
|
+
* MOTTO: We'll always do more π!!!
|
|
36
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/* ===== AB PLAYGROUND SCENE STYLES ===== */
|
|
40
|
+
/* π¨ John's welcome-v6 scene content classes (scenes.py css()), scoped to this module. No motion here:
|
|
41
|
+
wires, pulses and the ease dot all ride ab-nextjs-animations' wire classes (reduced motion included). */
|
|
42
|
+
/* π 0.2.3 (God 02:26): the card is v6's ORIGINAL --card via theme β₯ 0.3.7 `--ab-color-welcome-card`, so the white /
|
|
43
|
+
warmer gapped-desktop card tokens never leak in (fallbacks = the v6 values) */
|
|
44
|
+
.scene { --ab-flow-card: var(--ab-color-welcome-card, #fff); }
|
|
45
|
+
:global(:is(.dark, [data-theme="dark"])) .scene { --ab-flow-card: var(--ab-color-welcome-card, #241a12); }
|
|
46
|
+
.scene { --pg-bronze: #a67c52; --pg-sage: #8a9a88; --pg-chip: #f3e6da; --pg-card2: var(--ab-color-card2, #fbf3ec); }
|
|
47
|
+
:global(:is(.dark, [data-theme="dark"])) .scene { --pg-chip: #3a2b1f; --pg-card2: var(--ab-color-card2, #2c2118); }
|
|
48
|
+
.m { font-family: var(--ab-font-code, 'Roboto Mono', var(--ab-font-mono, ui-monospace, monospace)); font-size: 12px; } /* π» */
|
|
49
|
+
.mut { color: var(--ab-flow-muted, rgb(33 26 22 / 0.62)); } /* ποΈ */
|
|
50
|
+
.br { color: var(--pg-bronze); } /* π₯ */
|
|
51
|
+
.sg { color: var(--pg-sage); } /* πΏ */
|
|
52
|
+
.t13 { font-size: 13px; font-weight: 600; } /* π‘ */
|
|
53
|
+
.zs { font-family: var(--ab-font-display, 'Zilla Slab', serif); font-weight: 700; letter-spacing: -0.01em; } /* π€ */
|
|
54
|
+
.col { display: flex; flex-direction: column; align-items: center; gap: 8px; } /* π */
|
|
55
|
+
.logo { display: inline-flex; align-items: center; } /* π
°οΈ */
|
|
56
|
+
.logo :is(img, svg) { height: 100%; width: auto; } /* π
°οΈ */
|
|
57
|
+
.b1, .b2 { height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; width: 112px; box-sizing: border-box; } /* π */
|
|
58
|
+
.b1 { background: var(--pg-bronze); color: #fff8f5; } /* π */
|
|
59
|
+
.b2 { border: 1px solid var(--pg-bronze); color: var(--pg-bronze); } /* π */
|
|
60
|
+
.tog { width: 50px; height: 28px; border-radius: 999px; background: var(--pg-bronze); position: relative; flex: none; display: block; } /* π */
|
|
61
|
+
.tog::after { content: ""; position: absolute; right: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff8f5; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); } /* βͺ */
|
|
62
|
+
.seg { display: flex; background: var(--pg-chip); border-radius: 9px; padding: 3px; font-size: 12px; font-weight: 600; } /* ποΈ */
|
|
63
|
+
.seg > span { padding: 6px 11px; border-radius: 7px; color: var(--ab-flow-muted, rgb(33 26 22 / 0.62)); display: inline-flex; align-items: center; } /* ποΈ */
|
|
64
|
+
.seg > span.on { background: var(--pg-bronze); color: #fff8f5; } /* ποΈ */
|
|
65
|
+
.sw { display: flex; gap: 8px; } /* π¨ */
|
|
66
|
+
.sw > i { display: block; border: 1px solid var(--ab-flow-line, rgb(107 79 53 / 0.16)); box-sizing: border-box; } /* π¨ */
|
|
67
|
+
.focus { width: 110px; height: 34px; border-radius: 9px; border: 2px solid var(--pg-bronze); box-shadow: 0 0 0 4px rgb(166 124 82 / 0.25); display: flex; align-items: center; justify-content: center; box-sizing: border-box; } /* βΏ */
|
|
68
|
+
.focusSm { border: 2px solid var(--pg-bronze); border-radius: 7px; padding: 3px 9px; } /* βΏ */
|
|
69
|
+
.sheetMock { width: 190px; height: 104px; border-radius: 12px; background: var(--pg-card2); position: relative; overflow: hidden; } /* π */
|
|
70
|
+
.sheetPanel { position: absolute; inset: auto 0 0; height: 64px; background: var(--ab-flow-node, #fff); border-top: 1px solid var(--ab-flow-line, rgb(107 79 53 / 0.16)); border-radius: 12px 12px 0 0; padding: 8px 12px; box-sizing: border-box; } /* π */
|
|
71
|
+
.sheetHandle { display: block; width: 34px; height: 4px; border-radius: 2px; background: var(--ab-flow-line, rgb(107 79 53 / 0.16)); margin: 0 auto 8px; } /* β */
|
|
72
|
+
.navMock { width: 190px; height: 56px; border-radius: 12px; background: var(--pg-card2); display: flex; justify-content: space-around; align-items: center; } /* π§ */
|
|
73
|
+
.aa { width: 80px; height: 80px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 650; box-sizing: border-box; } /* π
°οΈ */
|
|
74
|
+
.aaLight { background: #fff8f5; border: 1px solid rgb(107 79 53 / 0.2); color: #211a16; } /* π */
|
|
75
|
+
.aaDark { background: #19120c; border: 1px solid rgb(255 232 210 / 0.2); color: #f5ebe1; } /* π */
|
|
76
|
+
.chipScheme { border-radius: 7px; padding: 4px 10px; } /* π¨ */
|
|
77
|
+
.radius { display: block; width: 30px; height: 30px; border: 2px solid var(--pg-bronze); box-sizing: border-box; } /* π² */
|
|
78
|
+
.iconGrid { display: grid; grid-template-columns: repeat(6, 38px); gap: 8px 10px; } /* π£ */
|
|
79
|
+
.iconGrid > span { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 9px; } /* π£ */
|
|
80
|
+
.iconGrid > span.iconOn { background: var(--pg-bronze); color: #fff8f5; } /* π£ */
|
|
81
|
+
.bigDot { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--pg-bronze); } /* βͺ */
|
|
82
|
+
.axis { stroke: var(--ab-flow-line, rgb(107 79 53 / 0.16)); } /* π */
|
|
83
|
+
/* π¬ the ease dot = ab-nextjs-animations' .ab-wire-pulse shrunk to a zero-length round dash (ring + dot) */
|
|
84
|
+
.easeRing.easeRing, .easeDot.easeDot { fill: none; stroke-linecap: round; stroke-dasharray: 0 100; } /* βͺ */
|
|
85
|
+
.easeRing { stroke: #fff8f5; } /* βͺ v6 stroke */
|
|
86
|
+
.easeDot { stroke: var(--pg-bronze); } /* π₯ */
|
|
87
|
+
/* π§± 0.2.3 core scene (real core exports): a mini main pane, a dotted swatch, a linear progress */
|
|
88
|
+
.paneMock { width: 120px; height: 40px; border-radius: 8px; background: var(--pg-card2); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--ab-flow-line, rgb(107 79 53 / 0.16)); box-sizing: border-box; } /* π */
|
|
89
|
+
.paneHead { display: block; height: 10px; background: var(--pg-chip); } /* π the sticky main header */
|
|
90
|
+
.paneBody { display: block; flex: 1; margin: 5px 8px; border-radius: 3px; background: linear-gradient(var(--ab-flow-line, rgb(107 79 53 / 0.16)) 0 3px, transparent 3px 7px) 0 0 / 100% 7px; } /* π the scroller */
|
|
91
|
+
.dotSwatch { display: block; width: 150px; height: 40px; border-radius: 9px; border: 1px solid var(--ab-flow-line, rgb(107 79 53 / 0.16)); box-sizing: border-box;
|
|
92
|
+
background: radial-gradient(var(--ab-dot-color, rgb(107 79 53 / 16%)) 1.3px, transparent 1.4px) 5px 5px / 10px 10px, var(--pg-card2); } /* π€ data-ab-surface="dotted" */
|
|
93
|
+
.progress { display: block; width: 150px; height: 6px; border-radius: 999px; background: var(--pg-chip); overflow: hidden; } /* β track */
|
|
94
|
+
.progress > i { display: block; width: 62%; height: 100%; border-radius: inherit; background: var(--pg-bronze); } /* π₯ value */
|
|
95
|
+
|
|
96
|
+
/* π 0.2.3 welcome + all scenes (v6 s01 / s09) */
|
|
97
|
+
.pnode { display: flex; flex-direction: column; gap: 9px; align-items: flex-start; width: 100%; padding: 0 14px; box-sizing: border-box; } /* π¦ v6 pnode */
|
|
98
|
+
.swSm { display: block; width: 18px; height: 24px; border-radius: 5px; border: 1px solid var(--ab-flow-line, rgb(107 79 53 / 0.16)); box-sizing: border-box; } /* π¨ */
|
|
99
|
+
.mchip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; white-space: nowrap; } /* π v6 .mchip */
|
|
100
|
+
/* π¨ 0.2.3 (God 03:02) John's Welcome v6 UPGRADED scenes (upgraded.tsx). Layout + colour only: every bit of motion is
|
|
101
|
+
ab-nextjs-animations' .ab-state-cycle-* (4 states Γ 600ms = 2.4s), which also owns the still frame + reduced motion. */
|
|
102
|
+
.scene { --ab-state-cycle-duration: var(--ab-wire-pulse-duration, 2400ms); --ab-state-cycle-on-fg: #fff8f5; --ab-state-cycle-off-fg: var(--ab-flow-muted, rgb(33 26 22 / 0.62)); --ab-state-cycle-switch-off: var(--pg-chip); --ab-state-cycle-knob-travel: 22px; }
|
|
103
|
+
.ic { display: inline-flex; flex: none; } /* π£ real ab-nextjs-icons SVG */
|
|
104
|
+
.ic > svg { display: block; } /* π£ */
|
|
105
|
+
.cy { position: relative; display: inline-block; flex: none; } /* π v6 cyc(): a fixed box (no layout shift) */
|
|
106
|
+
.cyItem { position: absolute; top: 0; left: 0; white-space: nowrap; } /* π stacked states */
|
|
107
|
+
.cyCentre { right: 0; display: flex; justify-content: center; } /* βοΈ centred without transform (the cycle owns transform) */
|
|
108
|
+
.segCycle > span { white-space: nowrap; } /* ποΈ chips: colours come from .ab-state-cycle-chip */
|
|
109
|
+
.wts { display: flex; gap: 2px; } /* β weight picker */
|
|
110
|
+
.wt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px 4px; border-radius: 7px; border: 1px solid transparent; --ab-state-cycle-hl-border: transparent; } /* β John: tint only */
|
|
111
|
+
.tog2 { width: 50px; height: 28px; border-radius: 999px; position: relative; flex: none; display: block; } /* π track (colour = the cycle) */
|
|
112
|
+
.knob { position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff8f5; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); } /* βͺ */
|
|
113
|
+
.lpTrack { display: block; height: 4px; border-radius: 2px; background: var(--pg-chip); overflow: hidden; } /* β */
|
|
114
|
+
.lpFill { display: block; width: 100%; height: 100%; border-radius: 2px; background: var(--pg-bronze); } /* π₯ scaleX = the cycle */
|
|
115
|
+
.popDot { display: block; border-radius: 50%; background: var(--pg-bronze); } /* π */
|
|
116
|
+
.curveBox { position: relative; display: block; flex: none; } /* π */
|
|
117
|
+
.curveBox > svg { display: block; overflow: visible; } /* π */
|
|
118
|
+
.rideDot { position: absolute; left: 0; top: 0; box-sizing: border-box; border-radius: 50%; background: var(--pg-bronze); border: 2px solid #fff8f5; offset-anchor: center; } /* π’ rides offset-path */
|
|
119
|
+
/* π§± core: nested layout (v6 lay()) */
|
|
120
|
+
.layApp, .layScreen, .layMain, .layAside, .layMob { border: 1.5px solid var(--ab-flow-line); box-sizing: border-box; font: 500 10px var(--ab-font-code, 'Roboto Mono', monospace); color: var(--ab-flow-muted); } /* π§± */
|
|
121
|
+
.layApp { position: relative; width: 276px; height: 92px; border-radius: 10px; } /* π§± AbAppLayout */
|
|
122
|
+
.layLb { position: absolute; } /* π·οΈ */
|
|
123
|
+
.layScreen { position: absolute; left: 8px; right: 8px; top: 20px; bottom: 8px; border-radius: 8px; } /* π§± AbScreenLayout */
|
|
124
|
+
.layMain { position: absolute; left: 6px; top: 18px; bottom: 6px; width: 112px; border-radius: 6px; padding: 3px 6px; } /* π */
|
|
125
|
+
.layAsideWrap { position: absolute; right: 6px; top: 18px; bottom: 6px; width: 104px; display: block; } /* π«οΈ dims in the Screen state */
|
|
126
|
+
.layAside { display: block; width: 100%; height: 100%; border-radius: 6px; padding: 3px 6px; } /* πͺ */
|
|
127
|
+
.mobLayers { display: flex; gap: 4px; } /* π± */
|
|
128
|
+
.layMob { border-radius: 6px; padding: 8px 10px; } /* π± */
|
|
129
|
+
/* π§© components */
|
|
130
|
+
.searchMock { width: 170px; height: 34px; border-radius: 10px; border: 1px solid var(--ab-flow-line); display: flex; align-items: center; gap: 8px; padding: 0 10px; color: var(--ab-flow-muted); box-sizing: border-box; } /* π */
|
|
131
|
+
.sheetMock2 { width: 180px; height: 70px; border-radius: 10px; background: var(--pg-card2); position: relative; overflow: hidden; display: block; } /* π */
|
|
132
|
+
.sheetPanel2 { position: absolute; left: 0; right: 0; bottom: 0; height: 48px; background: var(--ab-flow-node, #fff); border-top: 1px solid var(--ab-flow-line); border-radius: 10px 10px 0 0; padding: 6px 10px; box-sizing: border-box; display: block; } /* β¬οΈ rises = the cycle */
|
|
133
|
+
.chip0 { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ab-flow-line); border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 600; } /* π */
|
|
134
|
+
/* π¨ theme */
|
|
135
|
+
.aaCard { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 10px; font: 700 15px 'Mulish', var(--ab-font-sans, sans-serif); box-sizing: border-box; border-style: solid; } /* π
°οΈ */
|
|
136
|
+
.aaLab { font: 500 8.5px var(--ab-font-code, 'Roboto Mono', monospace); } /* π·οΈ */
|
|
137
|
+
.radiusTile { display: block; width: 30px; height: 28px; border: 2px solid var(--pg-bronze); box-sizing: border-box; } /* π² */
|
|
138
|
+
/* π£ icons */
|
|
139
|
+
.icGrid { display: grid; grid-template-columns: repeat(6, 38px); gap: 8px 10px; } /* π£ */
|
|
140
|
+
.icCell { display: flex; align-items: center; justify-content: center; border-radius: 9px; border: 1px solid transparent; box-sizing: border-box; --ab-state-cycle-hl-border: transparent; } /* π£ John: tint only (his cells have no border) */
|
|
141
|
+
/* π 0.2.3 (Joseph 02:55) variant="auto": both scenes ship, CSS picks one (SSR-safe, no flash, no hydration mismatch) */
|
|
142
|
+
.auto { display: contents; } /* π«₯ no extra box */
|
|
143
|
+
.autoCompact.autoCompact { display: none; } /* π₯οΈ β₯ 768px: full */
|
|
144
|
+
@media (width < 768px) {
|
|
145
|
+
.autoFull.autoFull { display: none; } /* π± phones: compact only */
|
|
146
|
+
.autoCompact.autoCompact { display: block; } /* π± */
|
|
147
|
+
}
|
|
148
|
+
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-components
|
|
27
|
+
* @name: AbPlaygroundScene upgraded scenes
|
|
28
|
+
* @file: ab-playground-scene/upgraded.tsx
|
|
29
|
+
* @type: Module
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
35
|
+
* MOTTO: We'll always do more π!!!
|
|
36
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
// π¨ 0.2.3 (God 03:02, John's Welcome v6 "upgraded" designs): the 7 package scenes, 1:1 with
|
|
40
|
+
// ai-mocks/welcome-v6/upgraded/_src/build_upgraded.py + playground-spec.md rev 2 (real export names as captions,
|
|
41
|
+
// 4 states Γ 0.6s = one 2.4s loop, reduced-motion still = state 0). ALL motion = ab-nextjs-animations' state cycle.
|
|
42
|
+
|
|
43
|
+
// βοΈ types
|
|
44
|
+
import type { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
45
|
+
// π§΅ classes
|
|
46
|
+
import clsx from 'clsx';
|
|
47
|
+
// γ°οΈ flow types
|
|
48
|
+
import type { AbFlowNode } from '../ab-flow-diagram/helpers';
|
|
49
|
+
// π¬ the 4-state cycle ships from ab-nextjs-animations β₯ 0.2.5 (keyframes, still frame, βΏ, pause)
|
|
50
|
+
import { AB_STATE_CYCLE_CLASSES as C } from 'ab-nextjs-animations/state-cycle';
|
|
51
|
+
import 'ab-nextjs-animations/state-cycle/styles.css'; // π .ab-state-cycle-*
|
|
52
|
+
// π£ the REAL ab-nextjs-icons outlined SVGs (one module per icon, tree-shaken)
|
|
53
|
+
import home from 'ab-nextjs-icons/ab-icons/icons/home';
|
|
54
|
+
import search from 'ab-nextjs-icons/ab-icons/icons/search';
|
|
55
|
+
import favorite from 'ab-nextjs-icons/ab-icons/icons/favorite';
|
|
56
|
+
import bolt from 'ab-nextjs-icons/ab-icons/icons/bolt';
|
|
57
|
+
import person from 'ab-nextjs-icons/ab-icons/icons/person';
|
|
58
|
+
import settings from 'ab-nextjs-icons/ab-icons/icons/settings';
|
|
59
|
+
import language from 'ab-nextjs-icons/ab-icons/icons/language';
|
|
60
|
+
import palette from 'ab-nextjs-icons/ab-icons/icons/palette';
|
|
61
|
+
import code from 'ab-nextjs-icons/ab-icons/icons/code';
|
|
62
|
+
import star from 'ab-nextjs-icons/ab-icons/icons/star';
|
|
63
|
+
import anchor from 'ab-nextjs-icons/ab-icons/icons/anchor';
|
|
64
|
+
import article from 'ab-nextjs-icons/ab-icons/icons/article';
|
|
65
|
+
// π¨ mock content classes
|
|
66
|
+
import s from './styles.module.css';
|
|
67
|
+
|
|
68
|
+
// π₯ John's bronze
|
|
69
|
+
const BRONZE = '#A67C52';
|
|
70
|
+
// π the 4 locale chips
|
|
71
|
+
const LOC = ['EN', 'FR', 'ES', 'RU'];
|
|
72
|
+
/** π΅ v6 N(x, y, w, h, html, lb, cls) (same shape as scenes.tsx) */
|
|
73
|
+
export type AbPgMk = (x: number, y: number, w: number, h: number, content: ReactNode, caption?: string, hub?: boolean) => AbFlowNode;
|
|
74
|
+
|
|
75
|
+
// β±οΈ the state an element owns (0β¦3)
|
|
76
|
+
const slot = (i: number, extra?: CSSProperties): CSSProperties => ({ '--ab-state-cycle-index': String(i), ...extra }) as CSSProperties;
|
|
77
|
+
const still = (i: number): '' | undefined => (i === 0 ? '' : undefined); // πΌοΈ still frame = state 0
|
|
78
|
+
|
|
79
|
+
// π£ a real ab-nextjs-icons SVG at a size / stroke / colour (decorative)
|
|
80
|
+
const ICONS = { home, search, favorite, bolt, person, settings, language, palette, code, star, anchor, article };
|
|
81
|
+
type IconName = keyof typeof ICONS;
|
|
82
|
+
function Ic({ n, sz = 22, sw, col }: { n: IconName; sz?: number; sw?: number; col?: string }): ReactElement {
|
|
83
|
+
let svg = ICONS[n].outlined.replace('width="24" height="24"', `width="${sz}" height="${sz}"`); // π
|
|
84
|
+
if (sw) svg = svg.replace(/stroke-width="[0-9.]+"/g, `stroke-width="${sw}"`); // ποΈ weight
|
|
85
|
+
return <span className={s.ic} style={col ? { color: col } : undefined} aria-hidden="true" dangerouslySetInnerHTML={{ __html: svg }} />;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// π§© small pieces
|
|
89
|
+
const M = ({ children, className, fs, style }: { children: ReactNode; className?: string; fs?: number; style?: CSSProperties }): ReactElement => (
|
|
90
|
+
<span className={clsx(s.m, className)} style={fs ? { fontSize: fs, ...style } : style}>{children}</span>
|
|
91
|
+
);
|
|
92
|
+
const Br = ({ children }: { children: ReactNode }): ReactElement => <span className={s.br}>{children}</span>;
|
|
93
|
+
const Sg = ({ children }: { children: ReactNode }): ReactElement => <span className={s.sg}>{children}</span>;
|
|
94
|
+
const Mark = ({ logo, h }: { logo: ReactNode; h: number }): ReactElement => <span className={s.logo} style={{ height: h }}>{logo}</span>;
|
|
95
|
+
|
|
96
|
+
/** π v6 `cyc()`: 4 stacked states, the cycle shows state k (fade + 8px rise in 0.24s); still = state 0 */
|
|
97
|
+
export function AbPgCycle({ states, w, h = 18, align = 'center' }: { states: ReactNode[]; w?: number; h?: number; align?: 'center' | 'left' }): ReactElement {
|
|
98
|
+
return (
|
|
99
|
+
<span className={s.cy} style={{ width: w, height: h }}>
|
|
100
|
+
{states.map((st, i) => <span key={i} className={clsx(s.cyItem, align === 'center' && s.cyCentre, C.word)} data-ab-still={still(i)} style={slot(i)}>{st}</span>)}
|
|
101
|
+
</span>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** ποΈ v6 `seg()`: chip k mod n is on (4 β one slot each, 2 β every other, 3 β the first also owns slot 3) */
|
|
106
|
+
export function AbPgSeg({ items, fs = 11, className }: { items: ReactNode[]; fs?: number; className?: string }): ReactElement {
|
|
107
|
+
const n = items.length;
|
|
108
|
+
const mode = (i: number): string | undefined => (n === 2 ? 'every-2' : n === 3 && i === 0 ? 'first-last' : undefined); // π’
|
|
109
|
+
return (
|
|
110
|
+
<span className={clsx(s.seg, s.segCycle, className)} style={{ fontSize: fs }}>
|
|
111
|
+
{items.map((it, i) => <span key={i} className={C.chip} data-ab-cycle={mode(i)} data-ab-still={still(i)} style={slot(i)}>{it}</span>)}
|
|
112
|
+
</span>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** π¦ v6 `[data-hl]`: bronze border + 12% tint during state i (idle border / background are the element's own) */
|
|
117
|
+
const hl = (i: number, cls?: string, idleBorder = 'var(--ab-flow-line)', idleBg = 'transparent', extra?: CSSProperties): { className: string; style: CSSProperties; 'data-ab-still'?: '' } => ({
|
|
118
|
+
className: clsx(cls, C.hl), 'data-ab-still': still(i),
|
|
119
|
+
style: slot(i, { '--ab-state-cycle-idle-border': idleBorder, '--ab-state-cycle-idle-bg': idleBg, borderColor: idleBorder, background: idleBg, ...extra } as CSSProperties),
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
/** π `useAbAsideToggle()` switch: on for states 0β1, off for 2β3 */
|
|
123
|
+
const Switch = (): ReactElement => <span className={clsx(s.tog2, C.switch)}><i className={clsx(s.knob, C.knob)} /></span>;
|
|
124
|
+
/** π `AbLinearProgress`: sweeps 0 β 100% per loop (still 40%) */
|
|
125
|
+
const Progress = ({ w }: { w: number }): ReactElement => <span className={s.lpTrack} style={{ width: w }}><i className={clsx(s.lpFill, C.fill)} /></span>;
|
|
126
|
+
/** π pop-in dot (0.6 β 1.06 β 1 each state) */
|
|
127
|
+
const Pop = ({ sz }: { sz: number }): ReactElement => <span className={clsx(s.popDot, C.pop)} style={{ width: sz, height: sz }} />;
|
|
128
|
+
/** π’ the dot riding the emphasized curve (0β75%, then holds; still = the end) */
|
|
129
|
+
function Curve({ w, h, d, r, axes }: { w: number; h: number; d: string; r: number; axes?: boolean }): ReactElement {
|
|
130
|
+
return (
|
|
131
|
+
<span className={s.curveBox} style={{ width: w, height: h }}>
|
|
132
|
+
<svg width={w} height={h} viewBox={`0 0 ${w} ${h}`} aria-hidden="true">
|
|
133
|
+
{axes ? <><path d={`M10 ${h - 10} H${w - 10}`} className={s.axis} /><path d={`M10 ${h - 10} V10`} className={s.axis} /></> : null}
|
|
134
|
+
<path d={d} fill="none" stroke={BRONZE} strokeWidth={axes ? 2.5 : 2.2} />
|
|
135
|
+
</svg>
|
|
136
|
+
<i className={clsx(s.rideDot, C.ride)} style={{ offsetPath: `path('${d}')`, width: r * 2, height: r * 2, borderWidth: axes ? 2 : 1.5 }} />
|
|
137
|
+
</span>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// π± the compact hub (spec rev 2: y = 122, h = 58) + the bottom caption right of the centre wire
|
|
142
|
+
const mobHub = (N: AbPgMk, x: number, w: number, c: ReactNode): AbFlowNode => N(x, 122, w, 58, c, '', true);
|
|
143
|
+
const bottom = (n: AbFlowNode): AbFlowNode => ({ ...n, captionAt: 'beside-centre' });
|
|
144
|
+
|
|
145
|
+
/* ===================================================================== π₯οΈ 760Γ600 + π± 350Γ276 per scene */
|
|
146
|
+
|
|
147
|
+
/** π§± 3.1 core: nested AbAppLayout β AbScreenLayout β AbMainLayout + AbAsideLayout, App β Screen β Main β Aside */
|
|
148
|
+
export function buildCoreUp(N: AbPgMk, compact: boolean): AbFlowNode[] {
|
|
149
|
+
if (compact) return [
|
|
150
|
+
mobHub(N, 85, 180, <span className={s.mobLayers}><span {...hl(2, s.layMob)}>Main</span><span {...hl(3, s.layMob)}>Aside</span></span>),
|
|
151
|
+
N(14, 62, 150, 52, <M><<Br>AbPageProvider</Br>></M>, 'provider'),
|
|
152
|
+
N(186, 62, 150, 52, <Switch />, 'useAbAsideToggle'),
|
|
153
|
+
bottom(N(100, 212, 150, 50, <Progress w={110} />, 'AbLinearProgress')),
|
|
154
|
+
];
|
|
155
|
+
return [
|
|
156
|
+
N(225, 262, 310, 120, (
|
|
157
|
+
<div {...hl(0, s.layApp)}>
|
|
158
|
+
<span className={s.layLb} style={{ left: 8, top: 5 }}>AbAppLayout</span>
|
|
159
|
+
<div {...hl(1, s.layScreen)}>
|
|
160
|
+
<span className={s.layLb} style={{ left: 6, top: 3 }}>AbScreenLayout</span>
|
|
161
|
+
<div {...hl(2, s.layMain)}>AbMainLayout</div>
|
|
162
|
+
<span className={clsx(s.layAsideWrap, C.dim)} style={slot(2)}><span {...hl(3, s.layAside)}>AbAsideLayout</span></span>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
), 'ab-nextjs-core/ab-app-layout', true),
|
|
166
|
+
N(40, 104, 210, 84, <span className={s.col} style={{ gap: 4 }}><M><<Br>AbPageProvider</Br>></M><M className={s.mut} fs={11}>useAbPage()</M></span>, 'AbPageProvider'),
|
|
167
|
+
N(290, 112, 180, 64, <Progress w={140} />, 'AbLinearProgress'),
|
|
168
|
+
N(510, 104, 210, 84, <><M>aside</M><Switch /></>, 'useAbAsideToggle()'),
|
|
169
|
+
N(40, 456, 210, 74, <M><Br>240</Br><span className={s.mut}>ms</span></M>, 'AB_ASIDE_DURATION'),
|
|
170
|
+
N(290, 456, 180, 74, <M><Sg>"Done"</Sg> Γ4</M>, 'supportedCore'),
|
|
171
|
+
N(510, 456, 210, 74, <M>(max-width: 1179px)</M>, 'AB_ASIDE_SHEET_QUERY'),
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** π§© 3.2 components: 54 Ab* exports; press, tabs, typing search, rising sheet, locale */
|
|
176
|
+
export function buildComponentsUp(N: AbPgMk, compact: boolean, logo: ReactNode): AbFlowNode[] {
|
|
177
|
+
const btn = (w: number): ReactElement => <span className={clsx(s.b1, C.press)} style={{ width: w }}>Get started</span>;
|
|
178
|
+
if (compact) return [
|
|
179
|
+
mobHub(N, 90, 170, <><Mark logo={logo} h={18} />Components</>),
|
|
180
|
+
N(14, 62, 150, 52, btn(100), 'AbButton'),
|
|
181
|
+
N(186, 62, 150, 52, <AbPgSeg items={['Code', 'Props']} fs={10.5} />, 'AbTabs'),
|
|
182
|
+
bottom(N(100, 212, 150, 50, <M>v0.2.2 βΎ</M>, 'AbVersionSwitcher')),
|
|
183
|
+
];
|
|
184
|
+
return [
|
|
185
|
+
N(250, 282, 260, 76, <><Mark logo={logo} h={24} /><M className={s.t13}>54 Ab* exports</M></>, 'supportedComponents', true),
|
|
186
|
+
N(40, 104, 200, 84, btn(110), 'AbButton'),
|
|
187
|
+
N(280, 112, 200, 64, <AbPgSeg items={['Preview', 'Code', 'Props']} />, 'AbTabs'),
|
|
188
|
+
N(520, 104, 200, 84, <span className={s.searchMock}><Ic n="search" sz={16} /><AbPgCycle states={['Search', 'Bu', 'Butto', 'Button']} w={90} h={16} align="left" /></span>, 'AbSearchbar'),
|
|
189
|
+
N(40, 440, 210, 106, <span className={s.sheetMock2}><span className={clsx(s.sheetPanel2, C.rise)}><i className={s.sheetHandle} /><span className={s.t13} style={{ fontSize: 11 }}>Language</span></span></span>, 'AbBottomDrawer'),
|
|
190
|
+
N(290, 456, 180, 74, <span className={s.chip0}><Ic n="language" sz={16} col={BRONZE} /> <AbPgCycle states={LOC} w={22} h={16} /></span>, 'AbLocaleSwitcher'),
|
|
191
|
+
N(510, 456, 210, 74, <M>v0.2.2 βΎ</M>, 'AbVersionSwitcher'),
|
|
192
|
+
];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** π¨ 3.3 theme: abTheme.colors; light β dark β light-hc β dark-hc */
|
|
196
|
+
export function buildThemeUp(N: AbPgMk, compact: boolean): AbFlowNode[] {
|
|
197
|
+
const SW = ['#6B4F35', '#A67C52', '#D9BE9C', '#FFF8F5', '#19120C'];
|
|
198
|
+
const sw = (w: number, h: number, gap: number): ReactElement => (
|
|
199
|
+
<span className={s.sw} style={{ gap }}>{SW.map((c) => <i key={c} style={{ width: w, height: h, borderRadius: 8, background: c }} />)}</span>
|
|
200
|
+
);
|
|
201
|
+
const modes = ['light', 'dark', 'light-hc', 'dark-hc'].map((x) => <M key={x}>{x}</M>);
|
|
202
|
+
if (compact) return [
|
|
203
|
+
mobHub(N, 80, 190, sw(20, 26, 6)),
|
|
204
|
+
N(14, 62, 150, 52, <AbPgSeg items={['light', 'dark']} fs={10.5} />, '[data-theme]'),
|
|
205
|
+
N(186, 62, 150, 52, <M><Br>--ab-color-primary</Br></M>, 'tokens'),
|
|
206
|
+
bottom(N(100, 212, 150, 50, <AbPgCycle states={modes} w={90} h={16} />, 'theme file')),
|
|
207
|
+
];
|
|
208
|
+
const card = (bg: string, fg: string, bd: string, lab: string, hi?: number): ReactElement => {
|
|
209
|
+
const own = { width: 62, height: 48, color: fg, border: `${hi === undefined ? 1 : 2}px solid ${bd}` };
|
|
210
|
+
const p = hi === undefined ? { className: s.aaCard, style: { ...own, background: bg } } : hl(hi, s.aaCard, bd, bg, own);
|
|
211
|
+
return <span {...p}>Aa<span className={s.aaLab}>{lab}</span></span>;
|
|
212
|
+
};
|
|
213
|
+
return [
|
|
214
|
+
N(230, 272, 300, 100, sw(28, 36, 8), 'abTheme.colors', true),
|
|
215
|
+
N(40, 100, 210, 96, <div className={s.m} style={{ lineHeight: 1.75 }}><Br>--ab-color-primary</Br><br /><Br>--ab-radius-card</Br>: 14px<br /><Br>--ab-font-title</Br></div>, 'css/ab-tokens.css'),
|
|
216
|
+
N(290, 112, 180, 64, <AbPgSeg items={['light', 'dark']} />, '[data-theme]'),
|
|
217
|
+
N(510, 96, 210, 110, <span style={{ display: 'flex', gap: 8 }}>{card('#FFF8F5', '#19120C', 'rgba(107,79,53,.25)', 'light')}{card('#19120C', '#FFF8F5', BRONZE, 'dark-hc', 3)}</span>, 'css/{light,dark}{,-mc,-hc}.css'),
|
|
218
|
+
N(40, 456, 210, 74, <span style={{ display: 'flex', gap: 9, alignItems: 'flex-end' }}>{[6, 10, 14, 999].map((r, i) => <i key={r} {...hl(i, s.radiusTile, BRONZE, 'transparent', { borderRadius: r })} />)}</span>, '--ab-radius-{chip,button,card,pill}'),
|
|
219
|
+
N(290, 456, 180, 74, <AbPgCycle states={modes} w={90} h={16} />, 'theme file'),
|
|
220
|
+
N(510, 456, 210, 74, <M>import <Br>abTheme</Br></M>, 'default export'),
|
|
221
|
+
];
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** π£ 3.4 icons: abIconNames grid (highlight steps i mod 4) + the weight picker 100 β 700 */
|
|
225
|
+
export function buildIconsUp(N: AbPgMk, compact: boolean): AbFlowNode[] {
|
|
226
|
+
const cell = (n: IconName, i: number, sz: number, box: number): ReactElement => {
|
|
227
|
+
return <span key={n} {...hl(i % 4, s.icCell, 'transparent', 'transparent', { width: box, height: box })}><Ic n={n} sz={sz} /></span>;
|
|
228
|
+
};
|
|
229
|
+
if (compact) return [
|
|
230
|
+
mobHub(N, 70, 210, <span style={{ display: 'flex', gap: 8 }}>{(['home', 'search', 'favorite', 'bolt'] as IconName[]).map((n, i) => cell(n, i, 20, 28))}</span>),
|
|
231
|
+
N(14, 62, 150, 52, <M><Br>abIconWeights</Br></M>, '100β700'),
|
|
232
|
+
N(186, 62, 150, 52, <M><<Br>AbIcon</Br>/></M>, 'components'),
|
|
233
|
+
bottom(N(100, 212, 150, 50, <M><Br>getAbIconSvg</Br>()</M>, 'svg string')),
|
|
234
|
+
];
|
|
235
|
+
const names: IconName[] = ['home', 'search', 'favorite', 'bolt', 'person', 'settings', 'language', 'palette', 'code', 'star', 'anchor', 'article'];
|
|
236
|
+
const wts: Array<[number, number]> = [[100, 0.7], [200, 1.25], [400, 1.9], [700, 2.8]];
|
|
237
|
+
return [
|
|
238
|
+
N(220, 262, 320, 124, <span className={s.icGrid}>{names.map((n, i) => cell(n, i, 22, 38))}</span>, 'abIconNames', true),
|
|
239
|
+
// β John's weight picker steps with a soft highlight (his `[data-on]` has no chip fill here), same as the grid
|
|
240
|
+
N(40, 100, 210, 96, <span className={s.wts}>{wts.map(([w, sw], i) => <span key={w} {...hl(i, s.wt, 'transparent')}><Ic n="star" sz={22} sw={sw} /><span className={s.m} style={{ fontSize: 9.5 }}>{w}</span></span>)}</span>, 'abIconWeights'),
|
|
241
|
+
N(290, 112, 180, 64, <M><Br>200</Br></M>, 'abIconDefaultWeight'),
|
|
242
|
+
N(510, 104, 210, 84, <M><Br>getAbIconSvg</Br>(<Sg>"anchor"</Sg>)</M>, 'getAbIconSvg()'),
|
|
243
|
+
N(40, 456, 210, 74, <M><<Br>AbIcon</Br> name=<Sg>"bolt"</Sg>/></M>, 'AbIcon (ab-nextjs-components)'),
|
|
244
|
+
N(290, 456, 180, 74, <><Ic n="anchor" sz={28} col={BRONZE} /><M>24Γ24</M></>, 'viewBox'),
|
|
245
|
+
N(510, 456, 210, 74, <M>type <Br>AbIconName</Br></M>, 'typed names'),
|
|
246
|
+
];
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/** π€ 3.5 fonts: Mulish "Aa" 300 β 400 β 600 β 700 (fixed box, no shift) */
|
|
250
|
+
export function buildFontsUp(N: AbPgMk, compact: boolean): AbFlowNode[] {
|
|
251
|
+
const W8: Array<[string, number]> = [['light', 300], ['regular', 400], ['semibold', 600], ['bold', 700]];
|
|
252
|
+
const MUL = "'Mulish', var(--ab-font-sans, sans-serif)", INT = "'Inter', var(--ab-font-sans, sans-serif)", RM = "'Roboto Mono', var(--ab-font-mono, monospace)";
|
|
253
|
+
const sp = (fam: string, txt: string, w: number, sz: number): ReactElement => <span style={{ fontFamily: fam, fontWeight: w, fontSize: sz }}>{txt}</span>;
|
|
254
|
+
if (compact) return [
|
|
255
|
+
{ ...N(90, 130, 170, 66, <AbPgCycle states={W8.map(([, w]) => <span key={w} style={{ font: `${w} 34px/1 ${MUL}` }}>Aa</span>)} w={60} h={36} />, '', true), y: 122, h: 58 },
|
|
256
|
+
N(14, 62, 150, 52, sp(MUL, 'Mulish', 700, 16), 'titles'),
|
|
257
|
+
N(186, 62, 150, 52, sp(INT, 'Inter', 500, 15), 'body'),
|
|
258
|
+
bottom(N(100, 212, 150, 50, sp(RM, 'Roboto Mono', 500, 13), 'code')),
|
|
259
|
+
];
|
|
260
|
+
return [
|
|
261
|
+
N(240, 262, 280, 120, (
|
|
262
|
+
<span className={s.col} style={{ gap: 4 }}>
|
|
263
|
+
<AbPgCycle states={W8.map(([, w]) => <span key={w} style={{ font: `${w} 60px/1 ${MUL}`, letterSpacing: '-0.02em' }}>Aa</span>)} w={120} h={62} />
|
|
264
|
+
<AbPgCycle states={W8.map(([n]) => <M key={n} className={s.mut}>font-mulish-{n}</M>)} w={180} h={16} />
|
|
265
|
+
</span>
|
|
266
|
+
), 'mulishStyles', true),
|
|
267
|
+
N(40, 100, 210, 96, <span className={s.col} style={{ gap: 2, alignItems: 'flex-start' }}>{sp(MUL, 'Mulish', 700, 24)}<M className={s.mut}>titles</M></span>, 'mulishStyles'),
|
|
268
|
+
N(290, 112, 180, 64, sp(INT, 'Inter', 500, 22), 'interStyles'),
|
|
269
|
+
N(510, 100, 210, 96, <span className={s.col} style={{ gap: 2, alignItems: 'flex-start' }}>{sp(RM, 'Roboto Mono', 500, 20)}<M className={s.mut}>code</M></span>, 'robotoMonoStyles'),
|
|
270
|
+
N(40, 456, 210, 74, <M>.<Br>font-mulish-bold</Br></M>, 'utility'),
|
|
271
|
+
N(290, 456, 180, 74, <M>.<Br>font-inter-regular</Br></M>, 'utility'),
|
|
272
|
+
N(510, 456, 210, 74, <M>.<Br>font-robotomono-medium</Br></M>, 'utility'),
|
|
273
|
+
];
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** π¬ 3.6 animations: the dot rides --ab-motion-ease-emphasized; presets step; pop-in pops */
|
|
277
|
+
export function buildAnimationsUp(N: AbPgMk, compact: boolean): AbFlowNode[] {
|
|
278
|
+
if (compact) return [
|
|
279
|
+
mobHub(N, 85, 180, <Curve w={150} h={44} d="M4 40 C 34 40, 34 4, 146 4" r={5} />),
|
|
280
|
+
N(14, 62, 150, 52, <M>200ms</M>, 'duration-medium'),
|
|
281
|
+
N(186, 62, 150, 52, <Pop sz={16} />, 'pop-in'),
|
|
282
|
+
bottom(N(100, 212, 150, 50, <M><Sg>'ab-wire-pulse'</Sg></M>, 'AB_WIRE_PULSE_CLASS')),
|
|
283
|
+
];
|
|
284
|
+
return [
|
|
285
|
+
N(220, 262, 320, 128, <Curve w={280} h={100} d="M10 90 C 66 90, 66 10, 270 10" r={7} axes />, '--ab-motion-ease-emphasized', true),
|
|
286
|
+
N(40, 100, 210, 96, <div className={s.m} style={{ lineHeight: 1.7 }}>duration-<Br>short</Br> 160ms<br />duration-<Br>medium</Br> 200ms<br />duration-<Br>long</Br> 280ms</div>, 'AB_MOTION_TOKENS'),
|
|
287
|
+
N(290, 112, 180, 64, <M fs={11}>cubic-bezier(.2,.8,.2,1)</M>, 'ease-emphasized'),
|
|
288
|
+
N(510, 104, 210, 84, <AbPgSeg items={['pop-in', 'fade', 'slide-up']} />, 'supportedAnimations Β· 19'),
|
|
289
|
+
N(40, 456, 210, 74, <><M>reduce</M><span className={s.tog} style={{ opacity: 0.55 }} /></>, 'AB_REDUCED_MOTION_QUERY'),
|
|
290
|
+
N(290, 456, 180, 74, <Pop sz={18} />, 'pop-in'),
|
|
291
|
+
N(510, 456, 210, 74, <><M><Sg>'ab-wire-pulse'</Sg></M><M className={s.mut}>2400ms</M></>, 'AB_WIRE_PULSE_CLASS'),
|
|
292
|
+
];
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/** πͺ 3.7 hooks: each hook's live return value steps through 4 states */
|
|
296
|
+
export function buildHooksUp(N: AbPgMk, compact: boolean, logo: ReactNode): AbFlowNode[] {
|
|
297
|
+
if (compact) return [
|
|
298
|
+
mobHub(N, 90, 170, <><Mark logo={logo} h={18} />Hooks</>),
|
|
299
|
+
N(14, 62, 150, 52, <M><Br>useAbThemeMode</Br></M>, 'theme'),
|
|
300
|
+
N(186, 62, 150, 52, <M><Br>useAbMedia</Br></M>, 'media'),
|
|
301
|
+
bottom(N(100, 212, 150, 50, <M><Br>useAbSwipe</Br></M>, 'gestures')),
|
|
302
|
+
];
|
|
303
|
+
const r = (v: ReactNode): ReactElement => <><M className={s.mut} fs={11}>β</M>{v}</>;
|
|
304
|
+
const q = (xs: string[], w: number): ReactElement => <AbPgCycle states={xs.map((x) => <M key={x} fs={11}><Sg>"{x}"</Sg></M>)} w={w} h={16} align="left" />;
|
|
305
|
+
const p = (xs: string[], w: number): ReactElement => <AbPgCycle states={xs.map((x, i) => <M key={i} fs={11}>{x}</M>)} w={w} h={16} align="left" />;
|
|
306
|
+
return [
|
|
307
|
+
N(260, 286, 240, 72, <><Mark logo={logo} h={24} /><M className={s.t13}>ab-nextjs-hooks</M></>, 'supportedHooks Β· 47', true),
|
|
308
|
+
N(40, 104, 210, 84, <><M fs={11}><Br>useAbThemeMode</Br>()</M>{r(q(['light', 'dark', 'system', 'light'], 64))}</>, 'AbThemeMode'),
|
|
309
|
+
N(290, 104, 180, 84, <><M fs={11}><Br>useAbMedia</Br>(q)</M>{r(p(['true', 'true', 'false', 'false'], 40))}</>, '(min-width:768px)'),
|
|
310
|
+
N(510, 104, 210, 84, <><M fs={11}><Br>useAbSwipe</Br>(ref)</M>{r(q(['left', 'right', 'up', 'down'], 56))}</>, 'AbSwipeDirection'),
|
|
311
|
+
N(40, 456, 210, 74, <M fs={11}><Br>useAbLocalStorage</Br>(k)</M>, 'read / write'),
|
|
312
|
+
N(290, 456, 180, 74, <><M fs={11}><Br>useAbClipboard</Br>()</M>{r(p(['copy', 'β', 'β', 'copy'], 30))}</>, 'AB_CLIPBOARD_RESET_MS 2000'),
|
|
313
|
+
N(510, 456, 210, 74, <><M fs={11}><Br>useAbReducedMotion</Br>()</M>{r(<M fs={11}>false</M>)}</>, 'boolean'),
|
|
314
|
+
];
|
|
315
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-components
|
|
27
|
+
* @name: AbPlaygroundScene welcome + all
|
|
28
|
+
* @file: ab-playground-scene/welcome.tsx
|
|
29
|
+
* @type: Module
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
35
|
+
* MOTTO: We'll always do more π!!!
|
|
36
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
// βοΈ types
|
|
40
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
41
|
+
// γ°οΈ flow types
|
|
42
|
+
import type { AbFlowNode, AbFlowPoint } from '../ab-flow-diagram/helpers';
|
|
43
|
+
// πΌοΈ line icons (+ the 0.2.3 package marks)
|
|
44
|
+
import { Ms } from './icons';
|
|
45
|
+
// π labels
|
|
46
|
+
import type { AbPlaygroundSceneLabels } from './labels';
|
|
47
|
+
// π¨ shared mock classes (.m, .br, .b1, .tog, .t13β¦)
|
|
48
|
+
import s from './styles.module.css';
|
|
49
|
+
|
|
50
|
+
// π₯ John's bronze
|
|
51
|
+
const BRONZE = '#A67C52';
|
|
52
|
+
// π¨ v6 palette (theme swatches)
|
|
53
|
+
const PALETTE = ['#6B4F35', '#A67C52', '#D9BE9C', '#FFF8F5', '#19120C'];
|
|
54
|
+
// π΅ a node in frame px (same shape as scenes.tsx N())
|
|
55
|
+
type Mk = (x: number, y: number, w: number, h: number, content: ReactNode, caption?: string, hub?: boolean) => AbFlowNode;
|
|
56
|
+
/** π§± what a builder returns (extra wires, optional explicit edges / no anchors for the mobile chip ring) */
|
|
57
|
+
export interface AbPgWelcomeData { nodes: AbFlowNode[]; wires?: AbFlowPoint[][]; edges?: []; anchors?: boolean }
|
|
58
|
+
|
|
59
|
+
/** π¦ v6 `pnode(name, icon, preview)`: bronze mark + name, then a small live preview */
|
|
60
|
+
function Pnode({ name, icon, children }: { name: string; icon: string; children: ReactNode }): ReactElement {
|
|
61
|
+
return (
|
|
62
|
+
<div className={s.pnode}>
|
|
63
|
+
<span className={s.t13} style={{ display: 'flex', alignItems: 'center', gap: 7 }}><Ms n={icon} sz={16} col={BRONZE} />{name}</span>
|
|
64
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: 8, minHeight: 34 }}>{children}</div>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
/** π v6 `mini_curve()` (static: the Welcome scene has no extra motion, spec Β§5 #0) */
|
|
69
|
+
const MiniCurve = (): ReactElement => (
|
|
70
|
+
<svg width="120" height="34" viewBox="0 0 120 34" aria-hidden="true"><path d="M2 32 C 50 32, 60 2, 118 2" fill="none" stroke={BRONZE} strokeWidth="2.2" /><circle cx="62" cy="17" r="4" fill={BRONZE} /></svg>
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
/** π₯οΈ v6 `welcome_nodes` (s01, 760Γ600): hub = the Ab mark + ab-elements, 7 package nodes, 3 extra links = 10 wires */
|
|
74
|
+
export function buildWelcomeFull(N: Mk, L: AbPlaygroundSceneLabels, logo: ReactNode): AbPgWelcomeData {
|
|
75
|
+
const sw = <div style={{ display: 'flex', gap: 5 }}>{PALETTE.map((c) => <i key={c} className={s.swSm} style={{ background: c }} />)}</div>; // π¨
|
|
76
|
+
return {
|
|
77
|
+
nodes: [
|
|
78
|
+
N(24, 84, 200, 100, <Pnode name={L.pkgTheme} icon="pkgTheme">{sw}</Pnode>),
|
|
79
|
+
N(280, 84, 200, 100, <Pnode name={L.pkgComponents} icon="pkgComponents"><span className={s.b1} style={{ width: 72, height: 28, fontSize: 12 }}>{L.button}</span><span className={s.tog} style={{ transform: 'scale(.85)' }} /></Pnode>),
|
|
80
|
+
N(536, 84, 200, 100, <Pnode name={L.pkgIcons} icon="pkgIcons">{['home', 'search', 'heart', 'bolt', 'user'].map((n) => <Ms key={n} n={n} sz={20} />)}</Pnode>),
|
|
81
|
+
N(24, 264, 180, 118, <Pnode name={L.pkgFonts} icon="pkgFonts"><span style={{ fontSize: 30, fontWeight: 650, letterSpacing: '-.03em' }}>Aa</span><span className={s.m} style={{ fontSize: 18 }}>Aa</span></Pnode>),
|
|
82
|
+
N(556, 264, 180, 118, <Pnode name={L.pkgHooks} icon="pkgHooks"><span className={s.m}><span className={s.br}>useAb</span>Media()</span></Pnode>), // πͺ real export
|
|
83
|
+
N(120, 452, 210, 104, <Pnode name={L.pkgAnimations} icon="pkgAnimations"><MiniCurve /></Pnode>),
|
|
84
|
+
N(430, 452, 210, 104, <Pnode name={L.pkgCore} icon="pkgCore"><span className={s.m}><<span className={s.br}>AbPageProvider</span>></span></Pnode>), // π§± real export
|
|
85
|
+
N(300, 262, 160, 122, <div className={s.col}><span className={s.logo} style={{ height: 52 }}>{logo}</span><span className={`${s.m} ${s.mut}`} style={{ fontSize: 11 }}>abβelements</span></div>, '', true), // π
°οΈ hub
|
|
86
|
+
],
|
|
87
|
+
wires: [[[224, 134], [280, 134]], [[536, 134], [480, 134]], [[646, 382], [646, 504], [640, 504]]], // β v6 extras
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** π± v6 `mscene_nodes(0)` (350Γ276): the Ab mark ringed by 7 package chips, straight spokes, no anchors */
|
|
92
|
+
export function buildWelcomeCompact(N: Mk, L: AbPlaygroundSceneLabels, logo: ReactNode): AbPgWelcomeData {
|
|
93
|
+
const names: [string, string][] = [[L.pkgCore, 'pkgCore'], [L.pkgComponents, 'pkgComponents'], [L.pkgTheme, 'pkgTheme'], [L.pkgIcons, 'pkgIcons'], [L.pkgFonts, 'pkgFonts'], [L.pkgAnimations, 'pkgAnimations'], [L.pkgHooks, 'pkgHooks']];
|
|
94
|
+
const nodes = names.map(([nm, ico], i) => {
|
|
95
|
+
const a = -Math.PI / 2 + (i * 2 * Math.PI) / 7; const w = Math.round(nm.length * 7 + 38); // π v6 ring (rx 104, ry 80)
|
|
96
|
+
return N(Math.round(175 + 104 * Math.cos(a) - w / 2), Math.round(160 + 80 * Math.sin(a) - 15), w, 30, <span className={s.mchip}><Ms n={ico} sz={13} col={BRONZE} />{nm}</span>);
|
|
97
|
+
});
|
|
98
|
+
const wires = nodes.map((n): AbFlowPoint[] => [[n.x + (n.w ?? 0) / 2, n.y + (n.h ?? 30) / 2], [175, 156]]); // γ°οΈ spokes to the hub (w/h always set by N(); `??` for strict consumers)
|
|
99
|
+
return { nodes: [...nodes, N(141, 126, 68, 68, <span className={s.logo} style={{ height: 34 }}>{logo}</span>, '', true)], wires, edges: [], anchors: false };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** π₯οΈ v6 scene 8 (s09, 760Γ600): AbElements hub, all 7 packages */
|
|
103
|
+
export function buildAllFull(N: Mk, L: AbPlaygroundSceneLabels, logo: ReactNode): AbPgWelcomeData {
|
|
104
|
+
const pk: [string, string, number, number][] = [[L.pkgCore, 'pkgCore', 40, 104], [L.pkgComponents, 'pkgComponents', 290, 104], [L.pkgTheme, 'pkgTheme', 540, 104], [L.pkgIcons, 'pkgIcons', 40, 470], [L.pkgFonts, 'pkgFonts', 290, 470], [L.pkgAnimations, 'pkgAnimations', 540, 470]];
|
|
105
|
+
const row = (nm: string, ico: string): ReactElement => <><Ms n={ico} sz={20} col={BRONZE} /><span className={s.t13}>{nm}</span></>;
|
|
106
|
+
return { nodes: [
|
|
107
|
+
...pk.map(([nm, ico, x, y]) => N(x, y, 180, 62, row(nm, ico))),
|
|
108
|
+
N(560, 292, 160, 62, row(L.pkgHooks, 'pkgHooks')),
|
|
109
|
+
N(300, 262, 160, 124, <span className={s.logo} style={{ height: 64 }}>{logo}</span>, L.abElements, true), // π
°οΈ hub
|
|
110
|
+
] };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** π± v6 mobile final (s09, 350Γ276): hub + 7 packages Β· MIT Β· free Β· Live docs Β· One PWA */
|
|
114
|
+
export function buildAllCompact(N: Mk, L: AbPlaygroundSceneLabels, logo: ReactNode): AbPgWelcomeData {
|
|
115
|
+
const t = (x: string): ReactElement => <span className={s.t13}>{x}</span>;
|
|
116
|
+
return { nodes: [
|
|
117
|
+
N(14, 58, 140, 48, t(L.sevenPackages)), N(196, 58, 140, 48, t(L.mitFree)), N(14, 214, 140, 48, t(L.liveDocs)), N(196, 214, 140, 48, t(L.onePwa)),
|
|
118
|
+
N(135, 124, 80, 72, <span className={s.logo} style={{ height: 36 }}>{logo}</span>, '', true), // π
°οΈ hub
|
|
119
|
+
] };
|
|
120
|
+
}
|