@lark-apaas/coding-registry-buildless 0.1.19 → 0.1.20-alpha.20260818121638
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/package.json +1 -1
- package/scripts/deck-stage.js +62 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/coding-registry-buildless",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20-alpha.20260818121638",
|
|
4
4
|
"description": "Miaoda registry (buildless runtime) — shadcn-style copy-in SDKs (globals + CDN-pinned, browser Babel) for buildless static HTML stacks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
package/scripts/deck-stage.js
CHANGED
|
@@ -152,6 +152,25 @@
|
|
|
152
152
|
const KEEP_LIVE_PREFIXES = ['cd-'];
|
|
153
153
|
const keepsCloneLive = (el) => KEEP_LIVE_PREFIXES.some((p) => el.localName.startsWith(p));
|
|
154
154
|
|
|
155
|
+
/* Why a clone needs a substrate rule of its own: _collectAuthorCss samples
|
|
156
|
+
* document.styleSheets, which never lists a shadow root's styles, so a clone
|
|
157
|
+
* gets 100% of the author's CSS and 0% of deck-stage's. That split is deliberate
|
|
158
|
+
* (no .rail / .thumb / .stage chrome inside a clone) but it halves a neutralising
|
|
159
|
+
* pair — author `html { background }` travels and _applyAuthorCss's :host alias
|
|
160
|
+
* lands it right under the clone, while the substrate that covers it on the
|
|
161
|
+
* stage cannot travel at all.
|
|
162
|
+
* Read off the live stage, never restated here: a second declaration stops
|
|
163
|
+
* matching the moment a mode selector or a theme moves the real one (the reason
|
|
164
|
+
* _syncThumbHostAttrs mirrors computed values rather than stylesheet text).
|
|
165
|
+
* !important costs the author every override of this one property, their own
|
|
166
|
+
* !important included. Intended: the substrate belongs to whoever renders the
|
|
167
|
+
* slide. Specificity can't carry it alone — the alias is zeroed to :where(:host)
|
|
168
|
+
* so a plain rule wins, but importance outranks specificity. Own sheet rather
|
|
169
|
+
* than appended to the author snapshot, so their CSS stays verbatim. */
|
|
170
|
+
const cloneBaseCss = (substrate) => ':host { background: ' + substrate + ' !important; }';
|
|
171
|
+
|
|
172
|
+
const NO_PAINT_RE = /,\s*0\s*\)\s*$/;
|
|
173
|
+
|
|
155
174
|
// Mirrors the host platform's isMobile() (UA regex + iPad maxTouchPoints);
|
|
156
175
|
// the product iframe is cross-origin, so the shared helper can't be
|
|
157
176
|
// imported. Deliberately NOT viewport-based: the desktop workbench renders
|
|
@@ -220,6 +239,7 @@
|
|
|
220
239
|
position: relative;
|
|
221
240
|
transform-origin: center center;
|
|
222
241
|
flex-shrink: 0;
|
|
242
|
+
/* Sole declaration of the slide substrate; _slideSubstrate reads it back. */
|
|
223
243
|
background: #fff;
|
|
224
244
|
will-change: transform;
|
|
225
245
|
}
|
|
@@ -1044,9 +1064,10 @@
|
|
|
1044
1064
|
* <deck-stage> ancestor, so a rule like `deck-stage section { background }`
|
|
1045
1065
|
* (the common per-slide default-background idiom) would never match and
|
|
1046
1066
|
* the clone renders with a transparent background — through which the
|
|
1047
|
-
*
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1067
|
+
* thumb host shows. The thumb's own host IS the deck-stage from the clone's
|
|
1068
|
+
* perspective, so alias deck-stage → :host to restore the match. The alias
|
|
1069
|
+
* also lands a page-level html/:root background right under the clone, a spot
|
|
1070
|
+
* it never occupies on the stage — _mountCloneStyles covers that. */
|
|
1050
1071
|
_applyAuthorCss(rawCss) {
|
|
1051
1072
|
const authorCss = rawCss
|
|
1052
1073
|
// The shadow host is featureless outside the functional :host(...)
|
|
@@ -1090,6 +1111,42 @@
|
|
|
1090
1111
|
}
|
|
1091
1112
|
}
|
|
1092
1113
|
|
|
1114
|
+
/** Not just .canvas: mobile browse and print clear it on purpose to expose the
|
|
1115
|
+
* layer behind, so walk the same layers the stage composites — and stop at the
|
|
1116
|
+
* host, because the next one up is the author's page background, the thing
|
|
1117
|
+
* that must never become a substrate. '' when nothing paints; only happens in
|
|
1118
|
+
* modes that render no clone, and the caller then adds no rule. */
|
|
1119
|
+
_slideSubstrate() {
|
|
1120
|
+
for (const el of [this._canvas, this._stage, this]) {
|
|
1121
|
+
if (!el) continue;
|
|
1122
|
+
const bg = getComputedStyle(el).backgroundColor;
|
|
1123
|
+
if (bg && bg !== 'transparent' && !NO_PAINT_RE.test(bg)) return bg;
|
|
1124
|
+
}
|
|
1125
|
+
return '';
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/** One base sheet shared by reference across every clone, so re-reading it on
|
|
1129
|
+
* each mount also re-levels clones built earlier — that is what carries a
|
|
1130
|
+
* mid-session theme change to thumbs already on screen. */
|
|
1131
|
+
_mountCloneStyles(sr) {
|
|
1132
|
+
const substrate = this._slideSubstrate();
|
|
1133
|
+
const baseCss = substrate ? cloneBaseCss(substrate) : '';
|
|
1134
|
+
if (this._adoptedSheet) {
|
|
1135
|
+
if (!this._cloneBaseSheet) this._cloneBaseSheet = new CSSStyleSheet();
|
|
1136
|
+
this._cloneBaseSheet.replaceSync(baseCss);
|
|
1137
|
+
sr.adoptedStyleSheets = [this._adoptedSheet, this._cloneBaseSheet];
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
// replaceSync threw — fall back to inline <style>, one per sheet so the
|
|
1141
|
+
// author's text stays a verbatim block.
|
|
1142
|
+
const author = document.createElement('style');
|
|
1143
|
+
author.textContent = this._authorCss || '';
|
|
1144
|
+
sr.appendChild(author);
|
|
1145
|
+
const base = document.createElement('style');
|
|
1146
|
+
base.textContent = baseCss;
|
|
1147
|
+
sr.appendChild(base);
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1093
1150
|
_syncThumbHostAttrs(host, cs) {
|
|
1094
1151
|
const de = document.documentElement;
|
|
1095
1152
|
// setAttribute overwrites but can't delete — an attr removed from
|
|
@@ -2368,12 +2425,7 @@
|
|
|
2368
2425
|
host.style.cssText = 'position:absolute;inset:0;';
|
|
2369
2426
|
this._syncThumbHostAttrs(host);
|
|
2370
2427
|
const sr = host.attachShadow({ mode: 'open' });
|
|
2371
|
-
|
|
2372
|
-
else {
|
|
2373
|
-
const st = document.createElement('style');
|
|
2374
|
-
st.textContent = this._authorCss || '';
|
|
2375
|
-
sr.appendChild(st);
|
|
2376
|
-
}
|
|
2428
|
+
this._mountCloneStyles(sr);
|
|
2377
2429
|
if (entry.clone) sr.appendChild(entry.clone.cloneNode(true));
|
|
2378
2430
|
card.appendChild(host);
|
|
2379
2431
|
wrap.appendChild(card);
|
|
@@ -2480,12 +2532,7 @@
|
|
|
2480
2532
|
host.style.cssText = 'position:absolute;inset:0;';
|
|
2481
2533
|
this._syncThumbHostAttrs(host);
|
|
2482
2534
|
const sr = host.attachShadow({ mode: 'open' });
|
|
2483
|
-
|
|
2484
|
-
else {
|
|
2485
|
-
const st = document.createElement('style');
|
|
2486
|
-
st.textContent = this._authorCss || '';
|
|
2487
|
-
sr.appendChild(st);
|
|
2488
|
-
}
|
|
2535
|
+
this._mountCloneStyles(sr);
|
|
2489
2536
|
sr.appendChild(clone);
|
|
2490
2537
|
entry.frame.appendChild(host);
|
|
2491
2538
|
entry.host = host;
|