@bstage-sdk/design 0.14.2 → 0.15.1

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.
@@ -691,11 +691,13 @@ function renderFallbackCss(t, opts) {
691
691
  const p = opts.prefix;
692
692
  const flat = Object.entries(t.flatColors).map(([slug, v]) => ` ${cssVarName(slug, p, "flat")}: ${v};`).join("\n");
693
693
  const lightColors = colorLines(t, p, "light");
694
- let css = `/* ================================================================
694
+ const frame = opts.target === "frame";
695
+ const header = frame ? `/* bstage \uB514\uC790\uC778 \uD1A0\uD070 \u2014 \uACA9\uB9AC \uD504\uB808\uC784 (${p}). \uD638\uC2A4\uD2B8 :root\uB97C \uC0C1\uC18D\uD558\uC9C0 \uBABB\uD558\uB294 \uD504\uB808\uC784 \uBB38\uC11C\uC6A9 */` : `/* ================================================================
695
696
  * bstage \uB514\uC790\uC778 \uD1A0\uD070 \u2014 dev fallback (${p})
696
697
  * @bstage-sdk/design \uC0DD\uC131\uBB3C. \uAC1C\uBC1C/\uBBF8\uB9AC\uBCF4\uAE30 \uC804\uC6A9(:root fallback).
697
698
  * \uBC30\uD3EC \uC2DC\uC5D4 \uD50C\uB7AB\uD3FC :root \uAC12\uC744 \uC0C1\uC18D\uD558\uBA70 \uC774 \uD30C\uC77C\uC740 \uBC88\uB4E4\uB418\uC9C0 \uC54A\uB294\uB2E4.
698
- * ================================================================ */
699
+ * ================================================================ */`;
700
+ let css = `${header}
699
701
 
700
702
  :root {
701
703
  ${lightColors}
@@ -707,13 +709,16 @@ ${flat}
707
709
  `;
708
710
  if (opts.dark) {
709
711
  const darkColors = colorLines(t, p, "dark");
710
- css += `
712
+ if (!frame) {
713
+ css += `
711
714
  @media (prefers-color-scheme: dark) {
712
715
  :root:not([data-bspoke="light"]) {
713
716
  ${darkColors.replace(/^ {2}/gm, " ")}
714
717
  }
715
718
  }
716
-
719
+ `;
720
+ }
721
+ css += `
717
722
  :root[data-bspoke="dark"],
718
723
  :root.dark {
719
724
  ${darkColors}
@@ -655,11 +655,13 @@ function renderFallbackCss(t, opts) {
655
655
  const p = opts.prefix;
656
656
  const flat = Object.entries(t.flatColors).map(([slug, v]) => ` ${cssVarName(slug, p, "flat")}: ${v};`).join("\n");
657
657
  const lightColors = colorLines(t, p, "light");
658
- let css = `/* ================================================================
658
+ const frame = opts.target === "frame";
659
+ const header = frame ? `/* bstage \uB514\uC790\uC778 \uD1A0\uD070 \u2014 \uACA9\uB9AC \uD504\uB808\uC784 (${p}). \uD638\uC2A4\uD2B8 :root\uB97C \uC0C1\uC18D\uD558\uC9C0 \uBABB\uD558\uB294 \uD504\uB808\uC784 \uBB38\uC11C\uC6A9 */` : `/* ================================================================
659
660
  * bstage \uB514\uC790\uC778 \uD1A0\uD070 \u2014 dev fallback (${p})
660
661
  * @bstage-sdk/design \uC0DD\uC131\uBB3C. \uAC1C\uBC1C/\uBBF8\uB9AC\uBCF4\uAE30 \uC804\uC6A9(:root fallback).
661
662
  * \uBC30\uD3EC \uC2DC\uC5D4 \uD50C\uB7AB\uD3FC :root \uAC12\uC744 \uC0C1\uC18D\uD558\uBA70 \uC774 \uD30C\uC77C\uC740 \uBC88\uB4E4\uB418\uC9C0 \uC54A\uB294\uB2E4.
662
- * ================================================================ */
663
+ * ================================================================ */`;
664
+ let css = `${header}
663
665
 
664
666
  :root {
665
667
  ${lightColors}
@@ -671,13 +673,16 @@ ${flat}
671
673
  `;
672
674
  if (opts.dark) {
673
675
  const darkColors = colorLines(t, p, "dark");
674
- css += `
676
+ if (!frame) {
677
+ css += `
675
678
  @media (prefers-color-scheme: dark) {
676
679
  :root:not([data-bspoke="light"]) {
677
680
  ${darkColors.replace(/^ {2}/gm, " ")}
678
681
  }
679
682
  }
680
-
683
+ `;
684
+ }
685
+ css += `
681
686
  :root[data-bspoke="dark"],
682
687
  :root.dark {
683
688
  ${darkColors}
@@ -27,6 +27,7 @@ __export(user_exports, {
27
27
  fontWeightMap: () => fontWeightMap,
28
28
  modeColors: () => modeColors,
29
29
  renderCss: () => renderCss,
30
+ renderFrameCss: () => renderFrameCss,
30
31
  shadow: () => shadow,
31
32
  shadowTokens: () => shadowTokens,
32
33
  textStyle: () => textStyle,
@@ -624,11 +625,13 @@ function renderFallbackCss(t, opts) {
624
625
  const p = opts.prefix;
625
626
  const flat = Object.entries(t.flatColors).map(([slug, v]) => ` ${cssVarName(slug, p, "flat")}: ${v};`).join("\n");
626
627
  const lightColors = colorLines(t, p, "light");
627
- let css = `/* ================================================================
628
+ const frame = opts.target === "frame";
629
+ const header = frame ? `/* bstage \uB514\uC790\uC778 \uD1A0\uD070 \u2014 \uACA9\uB9AC \uD504\uB808\uC784 (${p}). \uD638\uC2A4\uD2B8 :root\uB97C \uC0C1\uC18D\uD558\uC9C0 \uBABB\uD558\uB294 \uD504\uB808\uC784 \uBB38\uC11C\uC6A9 */` : `/* ================================================================
628
630
  * bstage \uB514\uC790\uC778 \uD1A0\uD070 \u2014 dev fallback (${p})
629
631
  * @bstage-sdk/design \uC0DD\uC131\uBB3C. \uAC1C\uBC1C/\uBBF8\uB9AC\uBCF4\uAE30 \uC804\uC6A9(:root fallback).
630
632
  * \uBC30\uD3EC \uC2DC\uC5D4 \uD50C\uB7AB\uD3FC :root \uAC12\uC744 \uC0C1\uC18D\uD558\uBA70 \uC774 \uD30C\uC77C\uC740 \uBC88\uB4E4\uB418\uC9C0 \uC54A\uB294\uB2E4.
631
- * ================================================================ */
633
+ * ================================================================ */`;
634
+ let css = `${header}
632
635
 
633
636
  :root {
634
637
  ${lightColors}
@@ -640,13 +643,16 @@ ${flat}
640
643
  `;
641
644
  if (opts.dark) {
642
645
  const darkColors = colorLines(t, p, "dark");
643
- css += `
646
+ if (!frame) {
647
+ css += `
644
648
  @media (prefers-color-scheme: dark) {
645
649
  :root:not([data-bspoke="light"]) {
646
650
  ${darkColors.replace(/^ {2}/gm, " ")}
647
651
  }
648
652
  }
649
-
653
+ `;
654
+ }
655
+ css += `
650
656
  :root[data-bspoke="dark"],
651
657
  :root.dark {
652
658
  ${darkColors}
@@ -707,6 +713,12 @@ function renderCss() {
707
713
  { prefix: PREFIX, dark: true }
708
714
  );
709
715
  }
716
+ function renderFrameCss() {
717
+ return renderFallbackCss(
718
+ { modeColors, flatColors, shadowTokens, fontFamily },
719
+ { prefix: PREFIX, dark: true, target: "frame" }
720
+ );
721
+ }
710
722
  // Annotate the CommonJS export names for ESM import in node:
711
723
  0 && (module.exports = {
712
724
  color,
@@ -716,6 +728,7 @@ function renderCss() {
716
728
  fontWeightMap,
717
729
  modeColors,
718
730
  renderCss,
731
+ renderFrameCss,
719
732
  shadow,
720
733
  shadowTokens,
721
734
  textStyle,
@@ -572,5 +572,12 @@ declare function textStyle(token: `${UserTypographyToken & string}/${UserFontWei
572
572
  * 프로덕션 번들에는 포함하지 않는다.
573
573
  */
574
574
  declare function renderCss(): string;
575
+ /**
576
+ * 격리 프레임(srcdoc) 문서용 토큰 CSS (`:root`-scoped, light + dark 토글).
577
+ * 프레임은 호스트 `:root`를 상속하지 못해 값을 문서 안에 직접 깐다. `renderCss`와 달리
578
+ * OS 다크 설정을 따르지 않고 `html.dark`로만 다크가 된다(호스트와 같은 규칙, 브리지 부트스트랩이 토글).
579
+ * 브리지 `createSrcdoc`가 인라인해 쓴다.
580
+ */
581
+ declare function renderFrameCss(): string;
575
582
 
576
- export { TextStyleResult, type UserColorSlug, type UserFontWeight, type UserTypographyToken, color, cssVar, flatColors, fontFamily, fontWeightMap, modeColors, renderCss, shadow, shadowTokens, textStyle, typographyTokens };
583
+ export { TextStyleResult, type UserColorSlug, type UserFontWeight, type UserTypographyToken, color, cssVar, flatColors, fontFamily, fontWeightMap, modeColors, renderCss, renderFrameCss, shadow, shadowTokens, textStyle, typographyTokens };
@@ -572,5 +572,12 @@ declare function textStyle(token: `${UserTypographyToken & string}/${UserFontWei
572
572
  * 프로덕션 번들에는 포함하지 않는다.
573
573
  */
574
574
  declare function renderCss(): string;
575
+ /**
576
+ * 격리 프레임(srcdoc) 문서용 토큰 CSS (`:root`-scoped, light + dark 토글).
577
+ * 프레임은 호스트 `:root`를 상속하지 못해 값을 문서 안에 직접 깐다. `renderCss`와 달리
578
+ * OS 다크 설정을 따르지 않고 `html.dark`로만 다크가 된다(호스트와 같은 규칙, 브리지 부트스트랩이 토글).
579
+ * 브리지 `createSrcdoc`가 인라인해 쓴다.
580
+ */
581
+ declare function renderFrameCss(): string;
575
582
 
576
- export { TextStyleResult, type UserColorSlug, type UserFontWeight, type UserTypographyToken, color, cssVar, flatColors, fontFamily, fontWeightMap, modeColors, renderCss, shadow, shadowTokens, textStyle, typographyTokens };
583
+ export { TextStyleResult, type UserColorSlug, type UserFontWeight, type UserTypographyToken, color, cssVar, flatColors, fontFamily, fontWeightMap, modeColors, renderCss, renderFrameCss, shadow, shadowTokens, textStyle, typographyTokens };
@@ -588,11 +588,13 @@ function renderFallbackCss(t, opts) {
588
588
  const p = opts.prefix;
589
589
  const flat = Object.entries(t.flatColors).map(([slug, v]) => ` ${cssVarName(slug, p, "flat")}: ${v};`).join("\n");
590
590
  const lightColors = colorLines(t, p, "light");
591
- let css = `/* ================================================================
591
+ const frame = opts.target === "frame";
592
+ const header = frame ? `/* bstage \uB514\uC790\uC778 \uD1A0\uD070 \u2014 \uACA9\uB9AC \uD504\uB808\uC784 (${p}). \uD638\uC2A4\uD2B8 :root\uB97C \uC0C1\uC18D\uD558\uC9C0 \uBABB\uD558\uB294 \uD504\uB808\uC784 \uBB38\uC11C\uC6A9 */` : `/* ================================================================
592
593
  * bstage \uB514\uC790\uC778 \uD1A0\uD070 \u2014 dev fallback (${p})
593
594
  * @bstage-sdk/design \uC0DD\uC131\uBB3C. \uAC1C\uBC1C/\uBBF8\uB9AC\uBCF4\uAE30 \uC804\uC6A9(:root fallback).
594
595
  * \uBC30\uD3EC \uC2DC\uC5D4 \uD50C\uB7AB\uD3FC :root \uAC12\uC744 \uC0C1\uC18D\uD558\uBA70 \uC774 \uD30C\uC77C\uC740 \uBC88\uB4E4\uB418\uC9C0 \uC54A\uB294\uB2E4.
595
- * ================================================================ */
596
+ * ================================================================ */`;
597
+ let css = `${header}
596
598
 
597
599
  :root {
598
600
  ${lightColors}
@@ -604,13 +606,16 @@ ${flat}
604
606
  `;
605
607
  if (opts.dark) {
606
608
  const darkColors = colorLines(t, p, "dark");
607
- css += `
609
+ if (!frame) {
610
+ css += `
608
611
  @media (prefers-color-scheme: dark) {
609
612
  :root:not([data-bspoke="light"]) {
610
613
  ${darkColors.replace(/^ {2}/gm, " ")}
611
614
  }
612
615
  }
613
-
616
+ `;
617
+ }
618
+ css += `
614
619
  :root[data-bspoke="dark"],
615
620
  :root.dark {
616
621
  ${darkColors}
@@ -671,6 +676,12 @@ function renderCss() {
671
676
  { prefix: PREFIX, dark: true }
672
677
  );
673
678
  }
679
+ function renderFrameCss() {
680
+ return renderFallbackCss(
681
+ { modeColors, flatColors, shadowTokens, fontFamily },
682
+ { prefix: PREFIX, dark: true, target: "frame" }
683
+ );
684
+ }
674
685
  export {
675
686
  color,
676
687
  cssVar,
@@ -679,6 +690,7 @@ export {
679
690
  fontWeightMap,
680
691
  modeColors,
681
692
  renderCss,
693
+ renderFrameCss,
682
694
  shadow,
683
695
  shadowTokens,
684
696
  textStyle,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bstage-sdk/design",
3
- "version": "0.14.2",
3
+ "version": "0.15.1",
4
4
  "description": "bstage 디자인 토큰 SDK — 커스텀 템플릿을 bstage 디자인 시스템에 맞춘다",
5
5
  "type": "module",
6
6
  "publishConfig": {