@popcraft/kit 0.53.17 → 0.53.19
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/chunks/{agent-76MOJF7H.js → agent-QQAYZ5WB.js} +1 -1
- package/dist/chunks/{builtin-O5D2Q6RV.js → builtin-KE5VRKPQ.js} +4 -4
- package/dist/chunks/{buy-credits-2RI5ALP3.js → buy-credits-R6PSWUM2.js} +2 -2
- package/dist/chunks/{check-template-5FJPJLKN.js → check-template-BMGDUIRP.js} +3 -3
- package/dist/chunks/{chunk-GZZNTUHF.js → chunk-2O3AJLC7.js} +5 -5
- package/dist/chunks/{chunk-MUOTQRR5.js → chunk-35ZHGX7R.js} +3 -3
- package/dist/chunks/{chunk-B4FB4B2M.js → chunk-5IRV2SAQ.js} +1 -1
- package/dist/chunks/{chunk-64TRA3OH.js → chunk-6DDTIGDY.js} +4 -4
- package/dist/chunks/{chunk-ZIOF5AO6.js → chunk-7G7UOKM4.js} +1 -1
- package/dist/chunks/{chunk-IAL55FGC.js → chunk-DSFTJ6BI.js} +2 -2
- package/dist/chunks/{chunk-YLNK64NW.js → chunk-DW7H5O5F.js} +12 -12
- package/dist/chunks/{chunk-N6T6XKGC.js → chunk-ERXWGXIF.js} +1 -1
- package/dist/chunks/{chunk-SELEMFEP.js → chunk-FIFDX2PJ.js} +1 -1
- package/dist/chunks/{chunk-NAXSGXBD.js → chunk-GYRYPM3N.js} +11 -11
- package/dist/chunks/{chunk-LVENLTN6.js → chunk-HC2BCDFS.js} +4 -4
- package/dist/chunks/{chunk-4UOE2QLJ.js → chunk-HE2HQQF7.js} +4 -4
- package/dist/chunks/{chunk-ZEERADTI.js → chunk-I5VBP754.js} +12 -12
- package/dist/chunks/{chunk-IIPH3CZZ.js → chunk-IY5UZMTO.js} +251 -2
- package/dist/chunks/{chunk-QJU5LRJX.js → chunk-J6Q7JXER.js} +2 -2
- package/dist/chunks/{chunk-NH42V7UK.js → chunk-JGJZXJRJ.js} +1 -1
- package/dist/chunks/{chunk-AMQ2XV6E.js → chunk-JUHBI75X.js} +10 -10
- package/dist/chunks/{chunk-UXNXHMBD.js → chunk-K3AZGLLD.js} +5 -7
- package/dist/chunks/{chunk-YZYQTXAK.js → chunk-KT3VWNJF.js} +4 -4
- package/dist/chunks/{chunk-U6OKU7J4.js → chunk-PIVR4JOX.js} +2 -2
- package/dist/chunks/{chunk-MEEB2X3B.js → chunk-RCYPJTDS.js} +54 -54
- package/dist/chunks/{chunk-QS4AT3DM.js → chunk-RPZJC2IG.js} +2 -4
- package/dist/chunks/{chunk-ROIDWBDQ.js → chunk-USXZ2Z7E.js} +4 -4
- package/dist/chunks/{chunk-SAUZ2HYM.js → chunk-VO5AERM4.js} +4 -4
- package/dist/chunks/{chunk-XKUI2K2V.js → chunk-X4JKF2JG.js} +214 -1
- package/dist/chunks/{chunk-K63NQAOB.js → chunk-XE6NJFI2.js} +89 -89
- package/dist/chunks/{chunk-VRGEEHBR.js → chunk-Y7SVEIXZ.js} +270 -50
- package/dist/chunks/{chunk-E4P2HVUD.js → chunk-ZDBDOXNF.js} +3 -1
- package/dist/chunks/{client-RIPJA5PK.js → client-6AZSG3ZL.js} +1 -1
- package/dist/chunks/{client-3EX4LVI6.js → client-DBACY2LR.js} +3 -3
- package/dist/chunks/{client-N525NCFB.js → client-R43QZ4QR.js} +2 -2
- package/dist/chunks/{client-actions-232DIA3G.js → client-actions-FBVLWSY2.js} +13 -14
- package/dist/chunks/{dangerous-2CPJMLP6.js → dangerous-N4RC6QXK.js} +4 -4
- package/dist/chunks/{delete-current-file-IVQD2M3K.js → delete-current-file-KB34A5H7.js} +9 -10
- package/dist/chunks/{editor-seams-AFXFNM6K.js → editor-seams-YTHZIEZ2.js} +18 -20
- package/dist/chunks/{editor-store-ZFR2ZHNM.js → editor-store-I7XK3PGQ.js} +5 -5
- package/dist/chunks/{export-FWVSW5AN.js → export-FZA6A6I6.js} +1 -1
- package/dist/chunks/{export-watermark-KT25FYVD.js → export-watermark-6YAEKDKK.js} +9 -10
- package/dist/chunks/{eyedropper-W6X2VHUB.js → eyedropper-UWISBVOX.js} +7 -11
- package/dist/chunks/{generate-media-Y3NYLLSS.js → generate-media-6VUWK57N.js} +4 -4
- package/dist/chunks/{host-PKGEIJZF.js → host-MIEETQXP.js} +14 -17
- package/dist/chunks/{integrations-4NFCLH3S.js → integrations-DWTRYAL5.js} +1 -1
- package/dist/chunks/{libraries-565L4UXX.js → libraries-LHFSA7JJ.js} +9 -10
- package/dist/chunks/{live-X3AP4MHF.js → live-6C5QKVRX.js} +5 -5
- package/dist/chunks/{lottie-AGAHYTZE.js → lottie-ZKR6H64U.js} +3 -4
- package/dist/chunks/{media-tool-HVMNAVAE.js → media-tool-Z6ND5SKE.js} +12 -126
- package/dist/chunks/{new-file-Z7EJFO2J.js → new-file-ZD27RMLG.js} +7 -7
- package/dist/chunks/{pdf-X3ZB6QKO.js → pdf-RPD6QHMP.js} +5 -7
- package/dist/chunks/{player-check-ZGWLAHXY.js → player-check-CZVWUJXW.js} +3 -4
- package/dist/chunks/{plugin-OLV3V7ZN.js → plugin-IIVMHWXJ.js} +3 -3
- package/dist/chunks/{plugin-import-SM3NLQ5A.js → plugin-import-VVPFCMMO.js} +23 -26
- package/dist/chunks/{pptx-OI7DTHPN.js → pptx-QZMA6SRM.js} +3 -4
- package/dist/chunks/{presence-TL24PA2T.js → presence-X4HNN2NN.js} +6 -6
- package/dist/chunks/{project-TS27R5XO.js → project-ZSZAT2MB.js} +3 -3
- package/dist/chunks/{publish-site-34NCZ274.js → publish-site-B36S2CS7.js} +10 -11
- package/dist/chunks/{publish-store-V27NWG4I.js → publish-store-7ZCGU56C.js} +5 -5
- package/dist/chunks/{raster-actions-PGNW6BX6.js → raster-actions-I5TJ5I7S.js} +7 -11
- package/dist/chunks/{reference-images-36D6WIRI.js → reference-images-RAJE3NRE.js} +2 -2
- package/dist/chunks/{resolvers-V6SR7XRN.js → resolvers-J3DRJJ7P.js} +5 -6
- package/dist/chunks/{runner-Q6HI2WVB.js → runner-7PSSJXP6.js} +25 -27
- package/dist/chunks/{store-SIAVD2I6.js → store-D7M2QNWT.js} +14 -15
- package/dist/chunks/{storefront-prepare-6WYLPH6E.js → storefront-prepare-S6A5FZXC.js} +1 -1
- package/dist/chunks/{svg-export-QTVHP7B2.js → svg-export-J23NHZWC.js} +4 -5
- package/dist/chunks/{sync-PQCW3ZLW.js → sync-GQHOTPE4.js} +9 -10
- package/dist/chunks/{tabs-HTDE6XGQ.js → tabs-ZRZQW5HB.js} +12 -12
- package/dist/chunks/{team-H4DYU4NF.js → team-GZOX67CF.js} +1 -1
- package/dist/chunks/{team-client-DW5CMJ4L.js → team-client-PQQV3564.js} +1 -1
- package/dist/chunks/{theme-store-FAYEXX7K.js → theme-store-CBS2LI4H.js} +2 -3
- package/dist/chunks/{tools-HBJ2I7YP.js → tools-KNCUAUHK.js} +2 -2
- package/dist/chunks/{ui-commands-NRTJFHI6.js → ui-commands-WNPLJR4F.js} +20 -22
- package/dist/chunks/{versions-22FL7N6P.js → versions-SFXXLEBS.js} +9 -10
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-C3QJHVOH.js +0 -269
- package/dist/chunks/chunk-I5REOOP7.js +0 -225
- package/dist/chunks/chunk-P4LE4WLR.js +0 -25
- package/dist/chunks/chunk-ZBANBY2Q.js +0 -27
|
@@ -577,9 +577,222 @@ var BUILTIN_THEMES = [popcraftDark, comicBase, comicYellow, comicBlack];
|
|
|
577
577
|
var PICKABLE_BUILTIN_IDS = [popcraftDark.id, comicYellow.id, comicBlack.id];
|
|
578
578
|
var INITIAL_THEME_ID = popcraftDark.id;
|
|
579
579
|
|
|
580
|
+
// lib/theme/resolve.ts
|
|
581
|
+
init_define_POPCRAFT_COMPONENT_IDS();
|
|
582
|
+
|
|
583
|
+
// lib/theme/tokens.ts
|
|
584
|
+
init_define_POPCRAFT_COMPONENT_IDS();
|
|
585
|
+
var c = (group, def, description) => ({ type: "color", group, default: def, description });
|
|
586
|
+
var TOKENS = {
|
|
587
|
+
// surface — an elevation ramp, darkest first. PopCraft Dark's defaults are the Dune IDE "Space Optimal" palette:
|
|
588
|
+
// a flat, near-black violet-grey (#0F0F13 chrome over a #131318 canvas) with lavender (#A78BFA) as the accent.
|
|
589
|
+
// The comic themes override every color they use, so these only shape PopCraft Dark.
|
|
590
|
+
"app.bg": c("surface", "#0F0F13", "Window background behind every panel."),
|
|
591
|
+
sunken: c("surface", "#0A0A0D", "Wells and focused inline fields sunk below a panel."),
|
|
592
|
+
base: c("surface", "#131318", "Recessed areas: previews, segmented-control tracks, dialog headers."),
|
|
593
|
+
window: c("surface", "#0F0F13", "Floating chips and cards over the canvas."),
|
|
594
|
+
overlay: c("surface", "#0F0F13", "Popovers, menus and dialogs."),
|
|
595
|
+
field: c("surface", "#16161C", "Compact inputs and context menus."),
|
|
596
|
+
"panel.bg": c("surface", "#0F0F13", "Side panels, top bar and toolbars."),
|
|
597
|
+
raised: c("surface", "#1B1B22", "Secondary buttons and list rows."),
|
|
598
|
+
"raised.hover": c("surface", "#262238", "Hovered secondary buttons and rows."),
|
|
599
|
+
control: c("surface", "#1B1B22", "Selects, steppers, and hovered icon buttons."),
|
|
600
|
+
"control.hover": c("surface", "#2A2A36", "Hovered controls, toggles and separators."),
|
|
601
|
+
border: c("surface", "rgba(228,227,238,0.075)", "Default hairline between regions."),
|
|
602
|
+
"border.strong": c("surface", "#322D48", "Borders around menus and cards."),
|
|
603
|
+
"border.faint": c("surface", "rgba(228,227,238,0.05)", "Barely-visible separators."),
|
|
604
|
+
"border.muted": c("surface", "#262238", "Secondary buttons and chips."),
|
|
605
|
+
"border.emph": c("surface", "rgba(228,227,238,0.15)", "Hovered chips and emphasised outlines."),
|
|
606
|
+
// text — brightest first
|
|
607
|
+
fg: c("text", "#E4E3EE", "Primary text and icons."),
|
|
608
|
+
"fg.bright": c("text", "#F4F3FA", "Headings in dialogs."),
|
|
609
|
+
"fg.soft": c("text", "rgba(228,227,238,0.85)", "Body text in panels and menus."),
|
|
610
|
+
"fg.dim": c("text", "rgba(228,227,238,0.74)", "Menu items and secondary body text."),
|
|
611
|
+
"fg.muted": c("text", "#A6A5B8", "Labels and inactive icons."),
|
|
612
|
+
"fg.subtle": c("text", "#85849A", "Hints, placeholders and section captions."),
|
|
613
|
+
"fg.disabled": c("text", "#585868", "Disabled controls and faint captions."),
|
|
614
|
+
"fg.faint": c("text", "#3E3E4C", "Decorative text that should barely show."),
|
|
615
|
+
"fg.onAccent": c("text", "#0A0A0D", "Text and icons on accent-colored surfaces."),
|
|
616
|
+
// accent
|
|
617
|
+
accent: c("accent", "#A78BFA", "Primary action color."),
|
|
618
|
+
"accent.hover": c("accent", "#C4A7FF", "Hovered primary action."),
|
|
619
|
+
focusRing: c("accent", "#A78BFA", "Keyboard focus outline."),
|
|
620
|
+
component: c("accent", "#7DD3FC", "Components and instances."),
|
|
621
|
+
ai: c("accent", "#F0ABFC", "AI features: sparkle icons and AI badges."),
|
|
622
|
+
prototype: c("accent", "#93C5FD", "Prototype connections and interactions in panels."),
|
|
623
|
+
danger: c("accent", "#FB7185", "Destructive actions and errors."),
|
|
624
|
+
warning: c("accent", "#FCD34D", "Warnings."),
|
|
625
|
+
success: c("accent", "#6EE7B7", "Success states."),
|
|
626
|
+
// shape
|
|
627
|
+
"radius.sm": { type: "length", group: "shape", default: "4px", description: "Small controls." },
|
|
628
|
+
"radius.md": { type: "length", group: "shape", default: "6px", description: "Inputs, buttons, menus and segmented controls." },
|
|
629
|
+
"radius.lg": { type: "length", group: "shape", default: "8px", description: "Menu surfaces and cards." },
|
|
630
|
+
"radius.xl": { type: "length", group: "shape", default: "10px", description: "Dialogs." },
|
|
631
|
+
"border.width": { type: "length", group: "shape", default: "1px", description: "Width of panel and input borders." },
|
|
632
|
+
"shadow.panel": { type: "shadow", group: "shape", default: "none", description: "Shadow under docked panels." },
|
|
633
|
+
"shadow.popover": { type: "shadow", group: "shape", default: "0 8px 24px rgba(0,0,0,0.6)", description: "Shadow under floating surfaces." },
|
|
634
|
+
"shadow.button": { type: "shadow", group: "shape", default: "none", description: "Shadow under buttons." },
|
|
635
|
+
// type
|
|
636
|
+
"font.ui": { type: "font", group: "type", default: "-apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable', 'Segoe UI', Inter, system-ui, sans-serif", description: "UI text." },
|
|
637
|
+
"font.heading": { type: "font", group: "type", default: "-apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable', 'Segoe UI', Inter, system-ui, sans-serif", description: "Section titles." },
|
|
638
|
+
"font.mono": { type: "font", group: "type", default: "'Monaspace Argon', 'Geist Mono Fallback'", description: "Code and numeric values." },
|
|
639
|
+
"letterSpacing.heading": { type: "length", group: "type", default: "0", description: "Tracking on section titles." },
|
|
640
|
+
"textTransform.heading": { type: "string", group: "type", default: "none", description: "none | uppercase for section titles." },
|
|
641
|
+
"heading.stroke": { type: "length", group: "type", default: "0px", description: "Outline width drawn around section titles (comic lettering); 0px for none." },
|
|
642
|
+
// decor
|
|
643
|
+
"panel.pattern": { type: "string", group: "decor", default: "none", description: "background-image layered on panels (e.g. halftone)." },
|
|
644
|
+
"tilt.popover": { type: "length", group: "decor", default: "0deg", description: "Rotation applied to popovers." },
|
|
645
|
+
"motion.enabled": { type: "string", group: "decor", default: "1", description: "1 to allow theme animations, 0 to turn them off (reduced-motion users never see them)." },
|
|
646
|
+
"decor.pop1": c("decor", "#A78BFA", "First flourish color: active-tool bursts, caption tags and halftone washes."),
|
|
647
|
+
"decor.pop1.fg": c("decor", "#0A0A0D", "Text and icons on `decor.pop1` surfaces (pressed tabs and buttons, hovered menu items, the active tool)."),
|
|
648
|
+
"decor.pop2": c("decor", "#F0ABFC", "Second flourish color: dialog bursts, focus pops and highlight bars."),
|
|
649
|
+
"decor.pop3": c("decor", "#7DD3FC", "Third flourish color: canvas-corner halftones and hover accents."),
|
|
650
|
+
// canvas — editor chrome drawn by WebGPU (lib/theme/chrome.ts). Must be hex or rgb()/rgba() colors.
|
|
651
|
+
"canvas.selection": c("canvas", "#A78BFA", "Selection outline, marquee, lasso, pen and vector-edit handles."),
|
|
652
|
+
"canvas.selection.component": c("canvas", "#7DD3FC", "Selection outline and labels on components."),
|
|
653
|
+
"canvas.handle.fill": c("canvas", "#ffffff", "Fill of resize, vector and gradient handles."),
|
|
654
|
+
"canvas.handle.stroke": c("canvas", "#A78BFA", "Outline of resize and corner-radius handles."),
|
|
655
|
+
"canvas.handle.strokeWidth": { type: "number", group: "canvas", default: "1", description: "Handle outline thickness, as a multiple of the default hairline (1\u20134)." },
|
|
656
|
+
"canvas.ruler.bg": c("canvas", "#0F0F13", "Ruler background."),
|
|
657
|
+
"canvas.ruler.tick": c("canvas", "#3E3E4C", "Ruler ticks."),
|
|
658
|
+
"canvas.ruler.label": c("canvas", "#A6A5B8", "Ruler numbers."),
|
|
659
|
+
"canvas.ruler.track": c("canvas", "#7DD3FC", "Selection span on the ruler, ruler guides and control points."),
|
|
660
|
+
"canvas.guide.hover": c("canvas", "#93C5FD", "Hovered ruler guide."),
|
|
661
|
+
"canvas.measure": c("canvas", "#FB7185", "Snap lines and distance measurements."),
|
|
662
|
+
"canvas.caret": c("canvas", "#C4A7FF", "Text caret, text selection, and auto-layout padding handles."),
|
|
663
|
+
"canvas.prototype": c("canvas", "#93C5FD", "Prototype connection arrows."),
|
|
664
|
+
"canvas.cursor.fill": c("canvas", "#0A0A0D", "Inside of the arrow and hand cursors."),
|
|
665
|
+
"canvas.cursor.outline": c("canvas", "#E4E3EE", "Cursor outlines, and the lines of the crosshair, text and resize cursors."),
|
|
666
|
+
"canvas.cursor.shadow": c("canvas", "rgba(0,0,0,0)", "Hard drop shadow under cursors; transparent for none. A visible shadow also makes cursor lines bolder."),
|
|
667
|
+
"canvas.backdrop.dots": c("canvas", "rgba(0,0,0,0)", "Halftone dots behind the canvas content, growing toward the bottom-right corner. The alpha is the strength; transparent turns them off."),
|
|
668
|
+
"canvas.backdrop.dotsAlt": c("canvas", "rgba(0,0,0,0)", "Second halftone layer, growing toward the top-left corner."),
|
|
669
|
+
"canvas.stage": c("canvas", "#0B0B0E", "Letterbox around the frame in Stage view (the active frame alone, fitted like a video)."),
|
|
670
|
+
"canvas.cursor.move": c("canvas", "#5EEAD4", "Pulsing crosshair shown while dragging selected layers."),
|
|
671
|
+
"canvas.cursor.resize": c("canvas", "#FB7185", "Throbbing glow shown while resizing."),
|
|
672
|
+
"canvas.cursor.rotate": c("canvas", "#F0ABFC", "Spinning dashed ring shown while rotating.")
|
|
673
|
+
};
|
|
674
|
+
var TOKEN_IDS = Object.keys(TOKENS);
|
|
675
|
+
function tokenVar(id) {
|
|
676
|
+
return "--pc-" + id.replace(/\./g, "-").replace(/[A-Z]/g, (m) => "-" + m.toLowerCase());
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// lib/theme/resolve.ts
|
|
680
|
+
function resolveTheme(themeId, lookup, overrides = {}) {
|
|
681
|
+
const chain = [];
|
|
682
|
+
const seen = /* @__PURE__ */ new Set();
|
|
683
|
+
for (let t = lookup(themeId); t && !seen.has(t.id); t = t.extends ? lookup(t.extends) : void 0) {
|
|
684
|
+
seen.add(t.id);
|
|
685
|
+
chain.unshift(t);
|
|
686
|
+
}
|
|
687
|
+
const out = {};
|
|
688
|
+
for (const id of TOKEN_IDS) out[id] = TOKENS[id].default;
|
|
689
|
+
const set = /* @__PURE__ */ new Set();
|
|
690
|
+
for (const t of chain) for (const [k, v] of Object.entries(t.tokens)) {
|
|
691
|
+
out[k] = v;
|
|
692
|
+
set.add(k);
|
|
693
|
+
}
|
|
694
|
+
for (const [k, v] of Object.entries(overrides)) {
|
|
695
|
+
out[k] = v;
|
|
696
|
+
set.add(k);
|
|
697
|
+
}
|
|
698
|
+
for (const [id, rule2] of DERIVED) {
|
|
699
|
+
if (set.has(id)) continue;
|
|
700
|
+
const from = rule2.from.filter((f) => set.has(f));
|
|
701
|
+
if (from.length === rule2.from.length) out[id] = rule2.make(out);
|
|
702
|
+
}
|
|
703
|
+
return out;
|
|
704
|
+
}
|
|
705
|
+
var mix = (a, b, pct) => `color-mix(in oklab, ${a} ${100 - pct}%, ${b} ${pct}%)`;
|
|
706
|
+
var rule = (from, make) => ({ from, make });
|
|
707
|
+
var DERIVED = [
|
|
708
|
+
["accent.hover", rule(["accent"], (t) => mix(t.accent, t.fg, 15))],
|
|
709
|
+
["focusRing", rule(["accent"], (t) => t["accent.hover"])],
|
|
710
|
+
["fg.bright", rule(["fg"], (t) => mix(t.fg, t["panel.bg"], 3))],
|
|
711
|
+
["fg.soft", rule(["fg"], (t) => mix(t.fg, t["panel.bg"], 8))],
|
|
712
|
+
["fg.dim", rule(["fg"], (t) => mix(t.fg, t["panel.bg"], 14))],
|
|
713
|
+
["fg.muted", rule(["fg"], (t) => mix(t.fg, t["panel.bg"], 32))],
|
|
714
|
+
["fg.subtle", rule(["fg"], (t) => mix(t.fg, t["panel.bg"], 48))],
|
|
715
|
+
["fg.disabled", rule(["fg"], (t) => mix(t.fg, t["panel.bg"], 62))],
|
|
716
|
+
["fg.faint", rule(["fg"], (t) => mix(t.fg, t["panel.bg"], 72))],
|
|
717
|
+
["field", rule(["panel.bg"], (t) => mix(t["panel.bg"], t.fg, 2))],
|
|
718
|
+
["control", rule(["panel.bg"], (t) => mix(t["panel.bg"], t.fg, 8))],
|
|
719
|
+
["control.hover", rule(["panel.bg"], (t) => mix(t["panel.bg"], t.fg, 14))],
|
|
720
|
+
["raised", rule(["panel.bg"], (t) => mix(t["panel.bg"], t.fg, 5))],
|
|
721
|
+
["raised.hover", rule(["panel.bg"], (t) => mix(t["panel.bg"], t.fg, 11))],
|
|
722
|
+
["overlay", rule(["panel.bg"], (t) => mix(t["panel.bg"], t["app.bg"], 25))],
|
|
723
|
+
["window", rule(["panel.bg"], (t) => mix(t["panel.bg"], t["app.bg"], 40))],
|
|
724
|
+
["base", rule(["panel.bg"], (t) => mix(t["panel.bg"], t["app.bg"], 55))],
|
|
725
|
+
["sunken", rule(["panel.bg"], (t) => mix(t["panel.bg"], t["app.bg"], 75))],
|
|
726
|
+
["border", rule(["panel.bg"], (t) => mix(t["panel.bg"], t.fg, 10))],
|
|
727
|
+
["border.strong", rule(["panel.bg"], (t) => mix(t["panel.bg"], t.fg, 16))],
|
|
728
|
+
["border.faint", rule(["panel.bg"], (t) => mix(t["panel.bg"], t.fg, 6))],
|
|
729
|
+
["border.muted", rule(["panel.bg"], (t) => mix(t["panel.bg"], t.fg, 12))],
|
|
730
|
+
["border.emph", rule(["panel.bg"], (t) => mix(t["panel.bg"], t.fg, 22))]
|
|
731
|
+
];
|
|
732
|
+
function collectFonts(themeId, lookup) {
|
|
733
|
+
const fonts = [];
|
|
734
|
+
const seen = /* @__PURE__ */ new Set();
|
|
735
|
+
for (let t = lookup(themeId); t && !seen.has(t.id); t = t.extends ? lookup(t.extends) : void 0) {
|
|
736
|
+
seen.add(t.id);
|
|
737
|
+
if (t.fonts) fonts.unshift(...t.fonts);
|
|
738
|
+
}
|
|
739
|
+
return fonts;
|
|
740
|
+
}
|
|
741
|
+
function collectCss(themeId, lookup) {
|
|
742
|
+
const css = [];
|
|
743
|
+
const seen = /* @__PURE__ */ new Set();
|
|
744
|
+
for (let t = lookup(themeId); t && !seen.has(t.id); t = t.extends ? lookup(t.extends) : void 0) {
|
|
745
|
+
seen.add(t.id);
|
|
746
|
+
if (t.css) css.unshift(t.css);
|
|
747
|
+
}
|
|
748
|
+
return css;
|
|
749
|
+
}
|
|
750
|
+
function toCssVars(tokens) {
|
|
751
|
+
return TOKEN_IDS.map((id) => `${tokenVar(id)}: ${tokens[id]};`).join("\n");
|
|
752
|
+
}
|
|
753
|
+
function parseColor(value) {
|
|
754
|
+
const v = value.trim();
|
|
755
|
+
const hex = /^#([0-9a-f]{3,8})$/i.exec(v);
|
|
756
|
+
if (hex) {
|
|
757
|
+
let h = hex[1];
|
|
758
|
+
if (h.length === 3 || h.length === 4) h = [...h].map((ch) => ch + ch).join("");
|
|
759
|
+
if (h.length !== 6 && h.length !== 8) return null;
|
|
760
|
+
const n = (i) => parseInt(h.slice(i, i + 2), 16) / 255;
|
|
761
|
+
return { r: n(0), g: n(2), b: n(4), a: h.length === 8 ? n(6) : 1 };
|
|
762
|
+
}
|
|
763
|
+
const rgb = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?\s*\)$/i.exec(v);
|
|
764
|
+
if (rgb) {
|
|
765
|
+
const a = rgb[4] === void 0 ? 1 : rgb[4].endsWith("%") ? parseFloat(rgb[4]) / 100 : parseFloat(rgb[4]);
|
|
766
|
+
return { r: +rgb[1] / 255, g: +rgb[2] / 255, b: +rgb[3] / 255, a };
|
|
767
|
+
}
|
|
768
|
+
const srgb = /^color\(\s*srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+%?))?\s*\)$/i.exec(v);
|
|
769
|
+
if (srgb) {
|
|
770
|
+
const a = srgb[4] === void 0 ? 1 : srgb[4].endsWith("%") ? parseFloat(srgb[4]) / 100 : parseFloat(srgb[4]);
|
|
771
|
+
return { r: +srgb[1], g: +srgb[2], b: +srgb[3], a };
|
|
772
|
+
}
|
|
773
|
+
return null;
|
|
774
|
+
}
|
|
775
|
+
function canvasColors(tokens) {
|
|
776
|
+
const out = {};
|
|
777
|
+
for (const id of TOKEN_IDS) {
|
|
778
|
+
if (TOKENS[id].group !== "canvas" || TOKENS[id].type !== "color") continue;
|
|
779
|
+
out[id] = parseColor(tokens[id]) ?? parseColor(TOKENS[id].default);
|
|
780
|
+
}
|
|
781
|
+
return out;
|
|
782
|
+
}
|
|
783
|
+
|
|
580
784
|
export {
|
|
581
785
|
DEFAULT_THEME_ID,
|
|
582
786
|
BUILTIN_THEMES,
|
|
583
787
|
PICKABLE_BUILTIN_IDS,
|
|
584
|
-
INITIAL_THEME_ID
|
|
788
|
+
INITIAL_THEME_ID,
|
|
789
|
+
TOKENS,
|
|
790
|
+
TOKEN_IDS,
|
|
791
|
+
tokenVar,
|
|
792
|
+
resolveTheme,
|
|
793
|
+
collectFonts,
|
|
794
|
+
collectCss,
|
|
795
|
+
toCssVars,
|
|
796
|
+
parseColor,
|
|
797
|
+
canvasColors
|
|
585
798
|
};
|
|
@@ -36,6 +36,90 @@ import {
|
|
|
36
36
|
init_define_POPCRAFT_COMPONENT_IDS
|
|
37
37
|
} from "./chunk-63KP74KB.js";
|
|
38
38
|
|
|
39
|
+
// lib/editor/stage-view.ts
|
|
40
|
+
init_define_POPCRAFT_COMPONENT_IDS();
|
|
41
|
+
init_scene_graph();
|
|
42
|
+
var NO_INSETS = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
43
|
+
var STAGE_PADDING = 24;
|
|
44
|
+
var STAGE_TYPES = /* @__PURE__ */ new Set(["FRAME", "COMPONENT", "COMPONENT_SET", "INSTANCE"]);
|
|
45
|
+
function rootOf(nodes, pageId, id) {
|
|
46
|
+
let n = nodes[id.split("::")[0]];
|
|
47
|
+
while (n && n.parentId && n.parentId !== pageId) n = nodes[n.parentId];
|
|
48
|
+
return n && n.parentId === pageId ? n : null;
|
|
49
|
+
}
|
|
50
|
+
var isStageRoot = (n, pageId) => !!n && n.parentId === pageId && STAGE_TYPES.has(n.type) && n.visible !== false;
|
|
51
|
+
function openComposition(s) {
|
|
52
|
+
const t = s.transport.target;
|
|
53
|
+
return s.mode === "ANIMATE" && t?.kind === "composition" ? s.document.compositions?.[t.compositionId] ?? null : null;
|
|
54
|
+
}
|
|
55
|
+
function stageFrameId(s) {
|
|
56
|
+
const nodes = s.document.nodes, pageId = s.currentPageId;
|
|
57
|
+
if (openComposition(s)) return null;
|
|
58
|
+
const t = s.transport.target;
|
|
59
|
+
if (s.mode === "ANIMATE" && t?.kind === "frame" && isStageRoot(nodes[t.frameId], pageId)) return t.frameId;
|
|
60
|
+
for (const id of s.selection) {
|
|
61
|
+
const root = rootOf(nodes, pageId, id);
|
|
62
|
+
if (isStageRoot(root, pageId)) return root.id;
|
|
63
|
+
}
|
|
64
|
+
if (s.stageFrameId && isStageRoot(nodes[s.stageFrameId], pageId)) return s.stageFrameId;
|
|
65
|
+
const page = nodes[pageId];
|
|
66
|
+
let best = null, bestD = Infinity;
|
|
67
|
+
for (const id of page?.childIds ?? []) {
|
|
68
|
+
if (!isStageRoot(nodes[id], pageId)) continue;
|
|
69
|
+
const w = getWorldTransform({ nodes }, id);
|
|
70
|
+
const d = Math.hypot(w.cx - s.camera.x, w.cy - s.camera.y);
|
|
71
|
+
if (d < bestD) {
|
|
72
|
+
bestD = d;
|
|
73
|
+
best = id;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return best;
|
|
77
|
+
}
|
|
78
|
+
function stageTarget(s, doc = s.document) {
|
|
79
|
+
const nodes = doc.nodes;
|
|
80
|
+
const comp = openComposition(s);
|
|
81
|
+
if (comp) {
|
|
82
|
+
const rect = compositionStage(comp, (id) => {
|
|
83
|
+
if (!nodes[id]) return null;
|
|
84
|
+
const w = getWorldTransform({ nodes }, id);
|
|
85
|
+
return { x: w.cx, y: w.cy };
|
|
86
|
+
});
|
|
87
|
+
return rect ? { kind: "composition", compositionId: comp.id, rect } : null;
|
|
88
|
+
}
|
|
89
|
+
const frameId = stageFrameId(s);
|
|
90
|
+
const b = frameId ? selectionWorldBounds(nodes, [frameId]) : null;
|
|
91
|
+
if (!frameId || !b) return null;
|
|
92
|
+
return { kind: "frame", frameId, rect: { x: b.minX, y: b.minY, width: b.maxX - b.minX, height: b.maxY - b.minY } };
|
|
93
|
+
}
|
|
94
|
+
function stageFit(rect, view, insets = NO_INSETS, padding = 0) {
|
|
95
|
+
const availW = view.width - insets.left - insets.right - padding * 2;
|
|
96
|
+
const availH = view.height - insets.top - insets.bottom - padding * 2;
|
|
97
|
+
if (!(rect.width > 0) || !(rect.height > 0) || availW <= 0 || availH <= 0) return null;
|
|
98
|
+
const zoom = Math.max(0.01, Math.min(64, availW / rect.width, availH / rect.height));
|
|
99
|
+
const dx = (insets.left - insets.right) / 2, dy = (insets.top - insets.bottom) / 2;
|
|
100
|
+
return { x: rect.x + rect.width / 2 - dx / zoom, y: rect.y + rect.height / 2 - dy / zoom, zoom };
|
|
101
|
+
}
|
|
102
|
+
function occluderInsets(canvas, boxes) {
|
|
103
|
+
const out = { ...NO_INSETS };
|
|
104
|
+
const w = canvas.right - canvas.left, h = canvas.bottom - canvas.top;
|
|
105
|
+
if (w <= 0 || h <= 0) return out;
|
|
106
|
+
const midY = (canvas.top + canvas.bottom) / 2;
|
|
107
|
+
for (const b of boxes) {
|
|
108
|
+
const left = Math.max(b.left, canvas.left), right = Math.min(b.right, canvas.right);
|
|
109
|
+
const top = Math.max(b.top, canvas.top), bottom = Math.min(b.bottom, canvas.bottom);
|
|
110
|
+
if (right - left < 1 || bottom - top < 1) continue;
|
|
111
|
+
if ((top + bottom) / 2 >= midY) out.bottom = Math.max(out.bottom, canvas.bottom - top);
|
|
112
|
+
else out.top = Math.max(out.top, bottom - canvas.top);
|
|
113
|
+
}
|
|
114
|
+
const cap = h * (2 / 3);
|
|
115
|
+
if (out.top + out.bottom > cap) {
|
|
116
|
+
const k = cap / (out.top + out.bottom);
|
|
117
|
+
out.top *= k;
|
|
118
|
+
out.bottom *= k;
|
|
119
|
+
}
|
|
120
|
+
return out;
|
|
121
|
+
}
|
|
122
|
+
|
|
39
123
|
// lib/document/z-order.ts
|
|
40
124
|
init_define_POPCRAFT_COMPONENT_IDS();
|
|
41
125
|
function reorderSelection(doc, ids, dir) {
|
|
@@ -133,90 +217,6 @@ function relinkCopies(doc, copies) {
|
|
|
133
217
|
return nodes ? { ...doc, nodes } : doc;
|
|
134
218
|
}
|
|
135
219
|
|
|
136
|
-
// lib/editor/stage-view.ts
|
|
137
|
-
init_define_POPCRAFT_COMPONENT_IDS();
|
|
138
|
-
init_scene_graph();
|
|
139
|
-
var NO_INSETS = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
140
|
-
var STAGE_PADDING = 24;
|
|
141
|
-
var STAGE_TYPES = /* @__PURE__ */ new Set(["FRAME", "COMPONENT", "COMPONENT_SET", "INSTANCE"]);
|
|
142
|
-
function rootOf(nodes, pageId, id) {
|
|
143
|
-
let n = nodes[id.split("::")[0]];
|
|
144
|
-
while (n && n.parentId && n.parentId !== pageId) n = nodes[n.parentId];
|
|
145
|
-
return n && n.parentId === pageId ? n : null;
|
|
146
|
-
}
|
|
147
|
-
var isStageRoot = (n, pageId) => !!n && n.parentId === pageId && STAGE_TYPES.has(n.type) && n.visible !== false;
|
|
148
|
-
function openComposition(s) {
|
|
149
|
-
const t = s.transport.target;
|
|
150
|
-
return s.mode === "ANIMATE" && t?.kind === "composition" ? s.document.compositions?.[t.compositionId] ?? null : null;
|
|
151
|
-
}
|
|
152
|
-
function stageFrameId(s) {
|
|
153
|
-
const nodes = s.document.nodes, pageId = s.currentPageId;
|
|
154
|
-
if (openComposition(s)) return null;
|
|
155
|
-
const t = s.transport.target;
|
|
156
|
-
if (s.mode === "ANIMATE" && t?.kind === "frame" && isStageRoot(nodes[t.frameId], pageId)) return t.frameId;
|
|
157
|
-
for (const id of s.selection) {
|
|
158
|
-
const root = rootOf(nodes, pageId, id);
|
|
159
|
-
if (isStageRoot(root, pageId)) return root.id;
|
|
160
|
-
}
|
|
161
|
-
if (s.stageFrameId && isStageRoot(nodes[s.stageFrameId], pageId)) return s.stageFrameId;
|
|
162
|
-
const page = nodes[pageId];
|
|
163
|
-
let best = null, bestD = Infinity;
|
|
164
|
-
for (const id of page?.childIds ?? []) {
|
|
165
|
-
if (!isStageRoot(nodes[id], pageId)) continue;
|
|
166
|
-
const w = getWorldTransform({ nodes }, id);
|
|
167
|
-
const d = Math.hypot(w.cx - s.camera.x, w.cy - s.camera.y);
|
|
168
|
-
if (d < bestD) {
|
|
169
|
-
bestD = d;
|
|
170
|
-
best = id;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return best;
|
|
174
|
-
}
|
|
175
|
-
function stageTarget(s, doc = s.document) {
|
|
176
|
-
const nodes = doc.nodes;
|
|
177
|
-
const comp = openComposition(s);
|
|
178
|
-
if (comp) {
|
|
179
|
-
const rect = compositionStage(comp, (id) => {
|
|
180
|
-
if (!nodes[id]) return null;
|
|
181
|
-
const w = getWorldTransform({ nodes }, id);
|
|
182
|
-
return { x: w.cx, y: w.cy };
|
|
183
|
-
});
|
|
184
|
-
return rect ? { kind: "composition", compositionId: comp.id, rect } : null;
|
|
185
|
-
}
|
|
186
|
-
const frameId = stageFrameId(s);
|
|
187
|
-
const b = frameId ? selectionWorldBounds(nodes, [frameId]) : null;
|
|
188
|
-
if (!frameId || !b) return null;
|
|
189
|
-
return { kind: "frame", frameId, rect: { x: b.minX, y: b.minY, width: b.maxX - b.minX, height: b.maxY - b.minY } };
|
|
190
|
-
}
|
|
191
|
-
function stageFit(rect, view, insets = NO_INSETS, padding = 0) {
|
|
192
|
-
const availW = view.width - insets.left - insets.right - padding * 2;
|
|
193
|
-
const availH = view.height - insets.top - insets.bottom - padding * 2;
|
|
194
|
-
if (!(rect.width > 0) || !(rect.height > 0) || availW <= 0 || availH <= 0) return null;
|
|
195
|
-
const zoom = Math.max(0.01, Math.min(64, availW / rect.width, availH / rect.height));
|
|
196
|
-
const dx = (insets.left - insets.right) / 2, dy = (insets.top - insets.bottom) / 2;
|
|
197
|
-
return { x: rect.x + rect.width / 2 - dx / zoom, y: rect.y + rect.height / 2 - dy / zoom, zoom };
|
|
198
|
-
}
|
|
199
|
-
function occluderInsets(canvas, boxes) {
|
|
200
|
-
const out = { ...NO_INSETS };
|
|
201
|
-
const w = canvas.right - canvas.left, h = canvas.bottom - canvas.top;
|
|
202
|
-
if (w <= 0 || h <= 0) return out;
|
|
203
|
-
const midY = (canvas.top + canvas.bottom) / 2;
|
|
204
|
-
for (const b of boxes) {
|
|
205
|
-
const left = Math.max(b.left, canvas.left), right = Math.min(b.right, canvas.right);
|
|
206
|
-
const top = Math.max(b.top, canvas.top), bottom = Math.min(b.bottom, canvas.bottom);
|
|
207
|
-
if (right - left < 1 || bottom - top < 1) continue;
|
|
208
|
-
if ((top + bottom) / 2 >= midY) out.bottom = Math.max(out.bottom, canvas.bottom - top);
|
|
209
|
-
else out.top = Math.max(out.top, bottom - canvas.top);
|
|
210
|
-
}
|
|
211
|
-
const cap = h * (2 / 3);
|
|
212
|
-
if (out.top + out.bottom > cap) {
|
|
213
|
-
const k = cap / (out.top + out.bottom);
|
|
214
|
-
out.top *= k;
|
|
215
|
-
out.bottom *= k;
|
|
216
|
-
}
|
|
217
|
-
return out;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
220
|
// lib/editor/crop.ts
|
|
221
221
|
init_define_POPCRAFT_COMPONENT_IDS();
|
|
222
222
|
init_dist_node();
|
|
@@ -325,6 +325,10 @@ export {
|
|
|
325
325
|
resetCrop,
|
|
326
326
|
setCropAspect,
|
|
327
327
|
resizeWindow,
|
|
328
|
+
STAGE_PADDING,
|
|
329
|
+
stageTarget,
|
|
330
|
+
stageFit,
|
|
331
|
+
occluderInsets,
|
|
328
332
|
reorderSelection,
|
|
329
333
|
isPathSource,
|
|
330
334
|
isClosedOutline,
|
|
@@ -332,9 +336,5 @@ export {
|
|
|
332
336
|
textLinkSource,
|
|
333
337
|
linkedTexts,
|
|
334
338
|
reboxed,
|
|
335
|
-
relinkCopies
|
|
336
|
-
STAGE_PADDING,
|
|
337
|
-
stageTarget,
|
|
338
|
-
stageFit,
|
|
339
|
-
occluderInsets
|
|
339
|
+
relinkCopies
|
|
340
340
|
};
|