@channel.io/bezier-react 1.13.0 → 1.14.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.
Files changed (35) hide show
  1. package/dist/cjs/features/Feature.js +0 -9
  2. package/dist/cjs/features/Feature.js.map +1 -1
  3. package/dist/cjs/features/SmoothCornersFeature/SmoothCornersFeature.js +33 -16
  4. package/dist/cjs/features/SmoothCornersFeature/SmoothCornersFeature.js.map +1 -1
  5. package/dist/cjs/foundation/FoundationStyledComponent.js +4 -0
  6. package/dist/cjs/foundation/FoundationStyledComponent.js.map +1 -1
  7. package/dist/cjs/foundation/Mixins.js +1 -1
  8. package/dist/cjs/foundation/Mixins.js.map +1 -1
  9. package/dist/cjs/index.js +4 -0
  10. package/dist/cjs/index.js.map +1 -1
  11. package/dist/cjs/node_modules/uuid/dist/esm-browser/stringify.js +1 -1
  12. package/dist/cjs/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -1
  13. package/dist/esm/features/Feature.mjs +1 -9
  14. package/dist/esm/features/Feature.mjs.map +1 -1
  15. package/dist/esm/features/SmoothCornersFeature/SmoothCornersFeature.mjs +34 -17
  16. package/dist/esm/features/SmoothCornersFeature/SmoothCornersFeature.mjs.map +1 -1
  17. package/dist/esm/foundation/FoundationStyledComponent.mjs +1 -1
  18. package/dist/esm/foundation/FoundationStyledComponent.mjs.map +1 -1
  19. package/dist/esm/foundation/Mixins.mjs +1 -1
  20. package/dist/esm/foundation/Mixins.mjs.map +1 -1
  21. package/dist/esm/index.mjs +1 -1
  22. package/dist/esm/node_modules/uuid/dist/esm-browser/stringify.mjs +1 -1
  23. package/dist/esm/node_modules/uuid/dist/esm-browser/stringify.mjs.map +1 -1
  24. package/dist/types/features/Feature.d.ts +3 -4
  25. package/dist/types/features/Feature.d.ts.map +1 -1
  26. package/dist/types/features/SmoothCornersFeature/SmoothCornersFeature.d.ts +27 -4
  27. package/dist/types/features/SmoothCornersFeature/SmoothCornersFeature.d.ts.map +1 -1
  28. package/dist/types/foundation/FoundationStyledComponent.d.ts +2 -2
  29. package/dist/types/foundation/FoundationStyledComponent.d.ts.map +1 -1
  30. package/package.json +3 -3
  31. package/src/features/Feature.ts +3 -10
  32. package/src/features/SmoothCornersFeature/SmoothCornersFeature.ts +54 -23
  33. package/src/features/SmoothCornersFeature/SmoothCornersFeatures.test.ts +34 -0
  34. package/src/foundation/FoundationStyledComponent.tsx +2 -0
  35. package/src/foundation/Mixins.ts +1 -1
@@ -4,15 +4,6 @@ let FeatureType = /*#__PURE__*/function (FeatureType) {
4
4
  FeatureType["SmoothCorners"] = "smooth-corners";
5
5
  return FeatureType;
6
6
  }({});
7
- class Feature {
8
- constructor(name) {
9
- this.name = name;
10
- }
11
- async activate() {
12
- return Promise.resolve(false);
13
- }
14
- }
15
7
 
16
- exports.Feature = Feature;
17
8
  exports.FeatureType = FeatureType;
18
9
  //# sourceMappingURL=Feature.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Feature.js","sources":["../../../src/features/Feature.ts"],"sourcesContent":["export enum FeatureType {\n SmoothCorners = 'smooth-corners',\n}\n\nexport class Feature {\n name: FeatureType\n\n constructor(name: FeatureType) {\n this.name = name\n }\n\n async activate() {\n return Promise.resolve(false)\n }\n}\n"],"names":["FeatureType","Feature","constructor","name","activate","Promise","resolve"],"mappings":";;AAAYA,IAAAA,WAAW,0BAAXA,WAAW,EAAA;EAAXA,WAAW,CAAA,eAAA,CAAA,GAAA,gBAAA,CAAA;AAAA,EAAA,OAAXA,WAAW,CAAA;AAAA,CAAA,CAAA,EAAA,EAAA;AAIhB,MAAMC,OAAO,CAAC;EAGnBC,WAAWA,CAACC,IAAiB,EAAE;IAC7B,IAAI,CAACA,IAAI,GAAGA,IAAI,CAAA;AAClB,GAAA;EAEA,MAAMC,QAAQA,GAAG;AACf,IAAA,OAAOC,OAAO,CAACC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC/B,GAAA;AACF;;;;;"}
1
+ {"version":3,"file":"Feature.js","sources":["../../../src/features/Feature.ts"],"sourcesContent":["export enum FeatureType {\n SmoothCorners = 'smooth-corners',\n}\n\nexport interface Feature {\n readonly name: FeatureType\n activate: () => Promise<boolean>\n}\n"],"names":["FeatureType"],"mappings":";;AAAYA,IAAAA,WAAW,0BAAXA,WAAW,EAAA;EAAXA,WAAW,CAAA,eAAA,CAAA,GAAA,gBAAA,CAAA;AAAA,EAAA,OAAXA,WAAW,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
@@ -7,38 +7,55 @@ var smoothCornersScript = require('./smoothCornersScript.js');
7
7
 
8
8
  // eslint-disable-next-line no-restricted-imports
9
9
 
10
+ /**
11
+ * @see {@link https://fetch.spec.whatwg.org/#requestcredentials}
12
+ */
13
+
14
+ /**
15
+ * @see {@link https://html.spec.whatwg.org/multipage/worklets.html#worklets-worklet}
16
+ */
17
+
10
18
  /**
11
19
  * 🚨 This is an experimental feature! It may not be suitable for use in production.
12
20
  *
13
21
  * Instead of CSS border-radius, Use *Superellipse* masking using the CSS Houdini API.
14
22
  * When enabled, the feature will be applied to components with the `smoothCorners` property set to `true`.
15
23
  */
16
- class SmoothCornersFeature extends Feature.Feature {
24
+ class SmoothCornersFeature {
25
+ name = Feature.FeatureType.SmoothCorners;
26
+ globalObject = null;
27
+
17
28
  /**
18
29
  * @deprecated (@ed) Upcoming improvements
19
30
  * Changed to private property, and will be referenced via the useFeatureFlag context rather than directly externally.
20
31
  */
21
- activated = false;
22
- async activate() {
23
- if (!this.activated && typeof CSS !== 'undefined' && 'paintWorklet' in CSS) {
32
+ activated = new WeakMap([[globalThis, false]]);
33
+ updateCurrentGlobalObject(globalObject) {
34
+ this.globalObject = globalObject;
35
+ }
36
+ isGlobalObjectIdentical(globalObject) {
37
+ return Object.is(this.globalObject, globalObject);
38
+ }
39
+ supportCSSPaintWorklet(globalObject) {
40
+ return typeof globalObject.CSS !== 'undefined' && 'paintWorklet' in globalObject.CSS;
41
+ }
42
+ async activate(globalObject = globalThis) {
43
+ if (!this.isGlobalObjectIdentical(globalObject) && this.supportCSSPaintWorklet(globalObject)) {
24
44
  const workletURL = URL.createObjectURL(new Blob([smoothCornersScript.smoothCornersScript], {
25
45
  type: 'application/javascript'
26
46
  }));
27
-
28
- // @ts-ignore
29
- const promise = CSS.paintWorklet.addModule(workletURL);
30
- return promise.then(() => {
31
- this.activated = true;
32
- return this.activated;
33
- }).catch(() => {
34
- this.activated = false;
35
- return this.activated;
36
- });
47
+ try {
48
+ await globalObject.CSS.paintWorklet.addModule(workletURL);
49
+ this.activated.set(globalObject, true);
50
+ } catch {
51
+ this.activated.set(globalObject, false);
52
+ }
37
53
  }
38
- return this.activated;
54
+ this.updateCurrentGlobalObject(globalObject);
55
+ return this.activated.get(globalObject);
39
56
  }
40
57
  }
41
- var SmoothCornersFeature$1 = new SmoothCornersFeature(Feature.FeatureType.SmoothCorners);
58
+ var SmoothCornersFeature$1 = new SmoothCornersFeature();
42
59
 
43
60
  exports.default = SmoothCornersFeature$1;
44
61
  //# sourceMappingURL=SmoothCornersFeature.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SmoothCornersFeature.js","sources":["../../../../src/features/SmoothCornersFeature/SmoothCornersFeature.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport {\n Feature,\n FeatureType,\n} from '../Feature'\n\nimport { smoothCornersScript } from './smoothCornersScript'\n\n/**\n * 🚨 This is an experimental feature! It may not be suitable for use in production.\n *\n * Instead of CSS border-radius, Use *Superellipse* masking using the CSS Houdini API.\n * When enabled, the feature will be applied to components with the `smoothCorners` property set to `true`.\n */\nclass SmoothCornersFeature extends Feature {\n /**\n * @deprecated (@ed) Upcoming improvements\n * Changed to private property, and will be referenced via the useFeatureFlag context rather than directly externally.\n */\n activated = false\n\n async activate() {\n if (\n !this.activated\n && typeof CSS !== 'undefined'\n && 'paintWorklet' in CSS\n ) {\n const workletURL = URL.createObjectURL(\n new Blob([smoothCornersScript], { type: 'application/javascript' }),\n )\n\n // @ts-ignore\n const promise = CSS.paintWorklet.addModule(workletURL) as Promise<void>\n\n return promise\n .then(() => {\n this.activated = true\n return this.activated\n }).catch(() => {\n this.activated = false\n return this.activated\n })\n }\n\n return this.activated\n }\n}\n\nexport default new SmoothCornersFeature(FeatureType.SmoothCorners)\n"],"names":["SmoothCornersFeature","Feature","activated","activate","CSS","workletURL","URL","createObjectURL","Blob","smoothCornersScript","type","promise","paintWorklet","addModule","then","catch","FeatureType","SmoothCorners"],"mappings":";;;;;;;AAAA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,oBAAoB,SAASC,eAAO,CAAC;AACzC;AACF;AACA;AACA;AACEC,EAAAA,SAAS,GAAG,KAAK,CAAA;EAEjB,MAAMC,QAAQA,GAAG;AACf,IAAA,IACE,CAAC,IAAI,CAACD,SAAS,IACZ,OAAOE,GAAG,KAAK,WAAW,IAC1B,cAAc,IAAIA,GAAG,EACxB;AACA,MAAA,MAAMC,UAAU,GAAGC,GAAG,CAACC,eAAe,CACpC,IAAIC,IAAI,CAAC,CAACC,uCAAmB,CAAC,EAAE;AAAEC,QAAAA,IAAI,EAAE,wBAAA;AAAyB,OAAC,CACpE,CAAC,CAAA;;AAED;MACA,MAAMC,OAAO,GAAGP,GAAG,CAACQ,YAAY,CAACC,SAAS,CAACR,UAAU,CAAkB,CAAA;AAEvE,MAAA,OAAOM,OAAO,CACXG,IAAI,CAAC,MAAM;QACV,IAAI,CAACZ,SAAS,GAAG,IAAI,CAAA;QACrB,OAAO,IAAI,CAACA,SAAS,CAAA;AACvB,OAAC,CAAC,CAACa,KAAK,CAAC,MAAM;QACb,IAAI,CAACb,SAAS,GAAG,KAAK,CAAA;QACtB,OAAO,IAAI,CAACA,SAAS,CAAA;AACvB,OAAC,CAAC,CAAA;AACN,KAAA;IAEA,OAAO,IAAI,CAACA,SAAS,CAAA;AACvB,GAAA;AACF,CAAA;AAEA,6BAAe,IAAIF,oBAAoB,CAACgB,mBAAW,CAACC,aAAa,CAAC;;;;"}
1
+ {"version":3,"file":"SmoothCornersFeature.js","sources":["../../../../src/features/SmoothCornersFeature/SmoothCornersFeature.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport {\n type Feature,\n FeatureType,\n} from '../Feature'\n\nimport { smoothCornersScript } from './smoothCornersScript'\n\n/**\n * @see {@link https://fetch.spec.whatwg.org/#requestcredentials}\n */\ntype RequestCredentials = 'omit' | 'same-origin' | 'include'\n\ntype WorkletOptions = {\n credentials: RequestCredentials\n}\n\n/**\n * @see {@link https://html.spec.whatwg.org/multipage/worklets.html#worklets-worklet}\n */\ninterface Worklet {\n addModule: (moduleURL: string, options?: WorkletOptions) => Promise<void>\n}\n\ndeclare global {\n namespace CSS {\n export const paintWorklet: Worklet\n }\n}\n\n/**\n * 🚨 This is an experimental feature! It may not be suitable for use in production.\n *\n * Instead of CSS border-radius, Use *Superellipse* masking using the CSS Houdini API.\n * When enabled, the feature will be applied to components with the `smoothCorners` property set to `true`.\n */\nclass SmoothCornersFeature implements Feature {\n readonly name = FeatureType.SmoothCorners\n\n private globalObject: typeof globalThis | null = null\n\n /**\n * @deprecated (@ed) Upcoming improvements\n * Changed to private property, and will be referenced via the useFeatureFlag context rather than directly externally.\n */\n activated: WeakMap<typeof globalThis, boolean> = new WeakMap([[globalThis, false]])\n\n private updateCurrentGlobalObject(globalObject: typeof globalThis) {\n this.globalObject = globalObject\n }\n\n private isGlobalObjectIdentical(globalObject: typeof globalThis) {\n return Object.is(this.globalObject, globalObject)\n }\n\n private supportCSSPaintWorklet(globalObject: typeof globalThis) {\n return typeof globalObject.CSS !== 'undefined' && 'paintWorklet' in globalObject.CSS\n }\n\n async activate(globalObject: typeof globalThis = globalThis) {\n if (!this.isGlobalObjectIdentical(globalObject) && this.supportCSSPaintWorklet(globalObject)) {\n const workletURL = URL.createObjectURL(\n new Blob([smoothCornersScript], { type: 'application/javascript' }),\n )\n\n try {\n await globalObject.CSS.paintWorklet.addModule(workletURL)\n this.activated.set(globalObject, true)\n } catch {\n this.activated.set(globalObject, false)\n }\n }\n\n this.updateCurrentGlobalObject(globalObject)\n\n return this.activated.get(globalObject) as boolean\n }\n}\n\nexport default new SmoothCornersFeature()\n"],"names":["SmoothCornersFeature","name","FeatureType","SmoothCorners","globalObject","activated","WeakMap","globalThis","updateCurrentGlobalObject","isGlobalObjectIdentical","Object","is","supportCSSPaintWorklet","CSS","activate","workletURL","URL","createObjectURL","Blob","smoothCornersScript","type","paintWorklet","addModule","set","get"],"mappings":";;;;;;;AAAA;;AAQA;AACA;AACA;;AAOA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,oBAAoB,CAAoB;EACnCC,IAAI,GAAGC,mBAAW,CAACC,aAAa,CAAA;AAEjCC,EAAAA,YAAY,GAA6B,IAAI,CAAA;;AAErD;AACF;AACA;AACA;EACEC,SAAS,GAAwC,IAAIC,OAAO,CAAC,CAAC,CAACC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;EAE3EC,yBAAyBA,CAACJ,YAA+B,EAAE;IACjE,IAAI,CAACA,YAAY,GAAGA,YAAY,CAAA;AAClC,GAAA;EAEQK,uBAAuBA,CAACL,YAA+B,EAAE;IAC/D,OAAOM,MAAM,CAACC,EAAE,CAAC,IAAI,CAACP,YAAY,EAAEA,YAAY,CAAC,CAAA;AACnD,GAAA;EAEQQ,sBAAsBA,CAACR,YAA+B,EAAE;IAC9D,OAAO,OAAOA,YAAY,CAACS,GAAG,KAAK,WAAW,IAAI,cAAc,IAAIT,YAAY,CAACS,GAAG,CAAA;AACtF,GAAA;AAEA,EAAA,MAAMC,QAAQA,CAACV,YAA+B,GAAGG,UAAU,EAAE;AAC3D,IAAA,IAAI,CAAC,IAAI,CAACE,uBAAuB,CAACL,YAAY,CAAC,IAAI,IAAI,CAACQ,sBAAsB,CAACR,YAAY,CAAC,EAAE;AAC5F,MAAA,MAAMW,UAAU,GAAGC,GAAG,CAACC,eAAe,CACpC,IAAIC,IAAI,CAAC,CAACC,uCAAmB,CAAC,EAAE;AAAEC,QAAAA,IAAI,EAAE,wBAAA;AAAyB,OAAC,CACpE,CAAC,CAAA;MAED,IAAI;QACF,MAAMhB,YAAY,CAACS,GAAG,CAACQ,YAAY,CAACC,SAAS,CAACP,UAAU,CAAC,CAAA;QACzD,IAAI,CAACV,SAAS,CAACkB,GAAG,CAACnB,YAAY,EAAE,IAAI,CAAC,CAAA;AACxC,OAAC,CAAC,MAAM;QACN,IAAI,CAACC,SAAS,CAACkB,GAAG,CAACnB,YAAY,EAAE,KAAK,CAAC,CAAA;AACzC,OAAA;AACF,KAAA;AAEA,IAAA,IAAI,CAACI,yBAAyB,CAACJ,YAAY,CAAC,CAAA;AAE5C,IAAA,OAAO,IAAI,CAACC,SAAS,CAACmB,GAAG,CAACpB,YAAY,CAAC,CAAA;AACzC,GAAA;AACF,CAAA;AAEA,6BAAe,IAAIJ,oBAAoB,EAAE;;;;"}
@@ -87,6 +87,10 @@ Object.defineProperty(exports, 'ServerStyleSheet', {
87
87
  enumerable: true,
88
88
  get: function () { return styled.ServerStyleSheet; }
89
89
  });
90
+ Object.defineProperty(exports, 'StyleSheetManager', {
91
+ enumerable: true,
92
+ get: function () { return styled.StyleSheetManager; }
93
+ });
90
94
  Object.defineProperty(exports, 'keyframes', {
91
95
  enumerable: true,
92
96
  get: function () { return styled.keyframes; }
@@ -1 +1 @@
1
- {"version":3,"file":"FoundationStyledComponent.js","sources":["../../../src/foundation/FoundationStyledComponent.tsx"],"sourcesContent":["/**\n * NOTE:\n * 이 모듈은 Text, Icon 등 뿐 아니라 Colors, Elevation 등에서도 import 하고 있습니다.\n * 이로 인해 Colors(Elevation 등) -> ThemedStyledComponent -> Theme -> Colors(Elevation 등)\n * 의 Circular dependency 가 발생합니다.\n * 하지만 ThemedStyledComponent 에서 사용하는 Theme 은 단순한 interface 로\n * 동작에는 문제가 없으며, type checking 도 올바르게 됩니다.\n */\n\nimport React, {\n createContext,\n forwardRef,\n useContext,\n} from 'react'\n\nimport styled, {\n type AnyStyledComponent,\n type CSSObject,\n type FlattenInterpolation,\n type FlattenSimpleInterpolation,\n type GlobalStyleComponent,\n type Interpolation,\n type InterpolationFunction,\n ServerStyleSheet,\n type SimpleInterpolation,\n type StyledComponentInnerAttrs,\n type StyledComponentInnerComponent,\n type StyledComponentInnerOtherProps,\n type StyledInterface,\n type ThemedStyledFunction,\n type ThemedStyledProps,\n css as baseCSS,\n createGlobalStyle as baseCreateGlobalStyle,\n keyframes,\n} from 'styled-components'\n\nimport { type Foundation } from './Foundation'\nimport domElements from './utils/domElements'\n\n/**\n * When interpreting the `.mjs` extension in the Next.js environment,\n * default imported `styled` function are not interpreted correctly.\n *\n * We add `.default` to cover situation where the module is interpreted in CJS.\n *\n * This is code that can be removed when the major version of `styled-components` is updated (v6)\n * and `styled` functions are changed to named import.\n *\n * @see https://github.com/rollup/rollup/issues/4438\n * @see https://github.com/styled-components/styled-components/issues/115\n */\n// @ts-expect-error\nconst safetyStyledInNextJs = (styled.default ?? styled) as StyledInterface\n\nconst FoundationContext = createContext<Foundation | null>(null)\n\ninterface FoundationProviderProps {\n foundation: Foundation\n children: React.ReactNode\n}\n\nfunction FoundationProvider({\n foundation,\n children,\n}: FoundationProviderProps) {\n return (\n <FoundationContext.Provider value={foundation}>\n { children }\n </FoundationContext.Provider>\n )\n}\n\n/**\n * NOTE:\n * styled component 는 theme Context 를 갖고 있습니다. 하지만 이 context 를 사용할때는 반드시 'theme' 이라는 이름으로밖에 접근할 수 없습니다.\n * Theme 이라는 용어는 내부적으로 이미 사용하고 있거니와, styled 의 theme 에 해당하는 개념에 Mondrian 은 Foundation 이라는 이름을 붙여주었습니다.\n * 이 괴리를 해소하기 위해 styled 함수를 wrapping 하고 커스텀 context 를 강제 주입합니다.\n * 아래의 interface, type 들은 타입체크 에러를 해소하기 위해 작성되었습니다. 제거 가능한 방법을 찾을 경우 가급적 제거하는 것이 필요합니다.\n */\n\ntype FoundationStyledComponentFactories = {\n [TTag in keyof JSX.IntrinsicElements]: ThemedStyledFunction<TTag, Foundation, { foundation?: Foundation }>\n}\n\ninterface FoundationStyledInterface extends FoundationStyledComponentFactories {\n <C extends AnyStyledComponent>(component: C): ThemedStyledFunction<\n StyledComponentInnerComponent<C>,\n Foundation,\n StyledComponentInnerOtherProps<C> & { foundation?: Foundation },\n StyledComponentInnerAttrs<C>\n >\n <C extends keyof JSX.IntrinsicElements | React.ComponentType<any>>(\n // unfortunately using a conditional type to validate that it can receive a `theme?: Theme`\n // causes tests to fail in TS 3.1\n component: C\n ): ThemedStyledFunction<C, Foundation, { foundation?: Foundation }>\n}\n\nfunction templateFunctionGenerator(BaseComponentGenerator: ThemedStyledFunction<any, any, object, string | number | symbol>) {\n const customTemplateFn = (...args: TemplateStringsArray) => {\n // @ts-ignore\n const BaseComponent = BaseComponentGenerator(...args)\n const BaseRefComponent = forwardRef((props, ref) => {\n const currentFoundation = useContext(FoundationContext)\n return (\n <BaseComponent\n ref={ref}\n key={args.toString()}\n foundation={currentFoundation}\n {...props}\n />\n )\n })\n BaseRefComponent.toString = BaseComponent.toString\n return BaseRefComponent\n }\n customTemplateFn.attrs = (attrs) => templateFunctionGenerator(BaseComponentGenerator.attrs(attrs))\n customTemplateFn.withConfig = (config) => templateFunctionGenerator(BaseComponentGenerator.withConfig(config))\n return customTemplateFn\n}\n\n/* eslint-disable-next-line func-names */ /* @ts-ignore */\nconst FoundationStyled: FoundationStyledInterface = (tag) => {\n const tagTemplate = safetyStyledInNextJs(tag)\n return templateFunctionGenerator(tagTemplate)\n};\n\n(domElements as Array<AnyStyledComponent>).forEach(element => {\n FoundationStyled[element] = FoundationStyled(element)\n})\n\ninterface FoundationCSSInterface {\n (\n first: TemplateStringsArray | CSSObject,\n ...interpolations: SimpleInterpolation[]\n ): FlattenSimpleInterpolation\n (\n first:\n | TemplateStringsArray\n | CSSObject\n | InterpolationFunction<ThemedStyledProps<{ foundation?: Foundation }, Foundation>>,\n ...interpolations: Array<Interpolation<ThemedStyledProps<{ foundation?: Foundation }, Foundation>>>\n ): FlattenInterpolation<ThemedStyledProps<{ foundation?: Foundation }, Foundation>>\n <P extends object>(\n first:\n | TemplateStringsArray\n | CSSObject\n | InterpolationFunction<ThemedStyledProps<P & { foundation?: Foundation }, Foundation>>,\n ...interpolations: Array<Interpolation<ThemedStyledProps<P & { foundation?: Foundation }, Foundation>>>\n ): FlattenInterpolation<ThemedStyledProps<P & { foundation?: Foundation }, Foundation>>\n}\n\n/* eslint-disable-next-line func-names */\nconst FoundationCSS: FoundationCSSInterface = baseCSS\n\nfunction useFoundation() {\n return useContext(FoundationContext)\n}\n\ntype GlobalStyleProp = {\n global?: CSSObject\n}\n\ntype FoundationWithGlobalStyle = Foundation & GlobalStyleProp\ninterface CreateFoundationGlobalStyle {\n <P extends object>(\n first:\n | TemplateStringsArray\n | CSSObject\n | InterpolationFunction<ThemedStyledProps<P & { foundation?: FoundationWithGlobalStyle }, Foundation>>,\n ...interpolations: Array<Interpolation<ThemedStyledProps<P & { foundation?: FoundationWithGlobalStyle }, Foundation>>>\n ): GlobalStyleComponent<\n // @ts-ignore\n P & { foundation: FoundationWithGlobalStyle },\n ThemedStyledProps<P & { foundation: FoundationWithGlobalStyle }, Foundation>\n >\n}\n\n/* eslint-disable-next-line func-names */ /* @ts-ignore */\nconst createFoundationGlobalStyle: CreateFoundationGlobalStyle = baseCreateGlobalStyle\n\nexport type {\n GlobalStyleProp,\n}\n\nexport {\n createFoundationGlobalStyle as createGlobalStyle,\n FoundationStyled as styled,\n FoundationCSS as css,\n FoundationProvider,\n useFoundation,\n keyframes,\n ServerStyleSheet,\n}\n"],"names":["safetyStyledInNextJs","styled","default","FoundationContext","createContext","FoundationProvider","foundation","children","React","createElement","Provider","value","templateFunctionGenerator","BaseComponentGenerator","customTemplateFn","args","BaseComponent","BaseRefComponent","forwardRef","props","ref","currentFoundation","useContext","Object","assign","key","toString","attrs","withConfig","config","FoundationStyled","tag","tagTemplate","domElements","forEach","element","FoundationCSS","baseCSS","useFoundation","createFoundation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B,CAAA;GACxB,CAAA;AACDH,EAAAA,gBAAgB,CAACa,KAAK,GAAIA,KAAK,IAAKf,yBAAyB,CAACC,sBAAsB,CAACc,KAAK,CAACA,KAAK,CAAC,CAAC,CAAA;AAClGb,EAAAA,gBAAgB,CAACc,UAAU,GAAIC,MAAM,IAAKjB,yBAAyB,CAACC,sBAAsB,CAACe,UAAU,CAACC,MAAM,CAAC,CAAC,CAAA;AAC9G,EAAA,OAAOf,gBAAgB,CAAA;AACzB,CAAA;;AAEA;AACMgB,MAAAA,gBAA2C,GAAIC,GAAG,IAAK;AAC3D,EAAA,MAAMC,WAAW,GAAGhC,oBAAoB,CAAC+B,GAAG,CAAC,CAAA;EAC7C,OAAOnB,yBAAyB,CAACoB,WAAW,CAAC,CAAA;AAC/C,EAAC;AAEAC,mBAAW,CAA+BC,OAAO,CAACC,OAAO,IAAI;AAC5DL,EAAAA,gBAAgB,CAACK,OAAO,CAAC,GAAGL,gBAAgB,CAACK,OAAO,CAAC,CAAA;AACvD,CAAC,CAAC,CAAA;AAuBF;AACMC,MAAAA,aAAqC,GAAGC,WAAO;AAErD,SAASC,aAAaA,GAAG;EACvB,OAAOhB,gBAAU,CAACnB,iBAAiB,CAAC,CAAA;AACtC,CAAA;AAqBA;AAA0C;AACpCoC,MAAAA,2BAAwD,GAAGC;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"FoundationStyledComponent.js","sources":["../../../src/foundation/FoundationStyledComponent.tsx"],"sourcesContent":["/**\n * NOTE:\n * 이 모듈은 Text, Icon 등 뿐 아니라 Colors, Elevation 등에서도 import 하고 있습니다.\n * 이로 인해 Colors(Elevation 등) -> ThemedStyledComponent -> Theme -> Colors(Elevation 등)\n * 의 Circular dependency 가 발생합니다.\n * 하지만 ThemedStyledComponent 에서 사용하는 Theme 은 단순한 interface 로\n * 동작에는 문제가 없으며, type checking 도 올바르게 됩니다.\n */\n\nimport React, {\n createContext,\n forwardRef,\n useContext,\n} from 'react'\n\nimport styled, {\n type AnyStyledComponent,\n type CSSObject,\n type FlattenInterpolation,\n type FlattenSimpleInterpolation,\n type GlobalStyleComponent,\n type Interpolation,\n type InterpolationFunction,\n ServerStyleSheet,\n type SimpleInterpolation,\n StyleSheetManager,\n type StyledComponentInnerAttrs,\n type StyledComponentInnerComponent,\n type StyledComponentInnerOtherProps,\n type StyledInterface,\n type ThemedStyledFunction,\n type ThemedStyledProps,\n css as baseCSS,\n createGlobalStyle as baseCreateGlobalStyle,\n keyframes,\n} from 'styled-components'\n\nimport { type Foundation } from './Foundation'\nimport domElements from './utils/domElements'\n\n/**\n * When interpreting the `.mjs` extension in the Next.js environment,\n * default imported `styled` function are not interpreted correctly.\n *\n * We add `.default` to cover situation where the module is interpreted in CJS.\n *\n * This is code that can be removed when the major version of `styled-components` is updated (v6)\n * and `styled` functions are changed to named import.\n *\n * @see https://github.com/rollup/rollup/issues/4438\n * @see https://github.com/styled-components/styled-components/issues/115\n */\n// @ts-expect-error\nconst safetyStyledInNextJs = (styled.default ?? styled) as StyledInterface\n\nconst FoundationContext = createContext<Foundation | null>(null)\n\ninterface FoundationProviderProps {\n foundation: Foundation\n children: React.ReactNode\n}\n\nfunction FoundationProvider({\n foundation,\n children,\n}: FoundationProviderProps) {\n return (\n <FoundationContext.Provider value={foundation}>\n { children }\n </FoundationContext.Provider>\n )\n}\n\n/**\n * NOTE:\n * styled component 는 theme Context 를 갖고 있습니다. 하지만 이 context 를 사용할때는 반드시 'theme' 이라는 이름으로밖에 접근할 수 없습니다.\n * Theme 이라는 용어는 내부적으로 이미 사용하고 있거니와, styled 의 theme 에 해당하는 개념에 Mondrian 은 Foundation 이라는 이름을 붙여주었습니다.\n * 이 괴리를 해소하기 위해 styled 함수를 wrapping 하고 커스텀 context 를 강제 주입합니다.\n * 아래의 interface, type 들은 타입체크 에러를 해소하기 위해 작성되었습니다. 제거 가능한 방법을 찾을 경우 가급적 제거하는 것이 필요합니다.\n */\n\ntype FoundationStyledComponentFactories = {\n [TTag in keyof JSX.IntrinsicElements]: ThemedStyledFunction<TTag, Foundation, { foundation?: Foundation }>\n}\n\ninterface FoundationStyledInterface extends FoundationStyledComponentFactories {\n <C extends AnyStyledComponent>(component: C): ThemedStyledFunction<\n StyledComponentInnerComponent<C>,\n Foundation,\n StyledComponentInnerOtherProps<C> & { foundation?: Foundation },\n StyledComponentInnerAttrs<C>\n >\n <C extends keyof JSX.IntrinsicElements | React.ComponentType<any>>(\n // unfortunately using a conditional type to validate that it can receive a `theme?: Theme`\n // causes tests to fail in TS 3.1\n component: C\n ): ThemedStyledFunction<C, Foundation, { foundation?: Foundation }>\n}\n\nfunction templateFunctionGenerator(BaseComponentGenerator: ThemedStyledFunction<any, any, object, string | number | symbol>) {\n const customTemplateFn = (...args: TemplateStringsArray) => {\n // @ts-ignore\n const BaseComponent = BaseComponentGenerator(...args)\n const BaseRefComponent = forwardRef((props, ref) => {\n const currentFoundation = useContext(FoundationContext)\n return (\n <BaseComponent\n ref={ref}\n key={args.toString()}\n foundation={currentFoundation}\n {...props}\n />\n )\n })\n BaseRefComponent.toString = BaseComponent.toString\n return BaseRefComponent\n }\n customTemplateFn.attrs = (attrs) => templateFunctionGenerator(BaseComponentGenerator.attrs(attrs))\n customTemplateFn.withConfig = (config) => templateFunctionGenerator(BaseComponentGenerator.withConfig(config))\n return customTemplateFn\n}\n\n/* eslint-disable-next-line func-names */ /* @ts-ignore */\nconst FoundationStyled: FoundationStyledInterface = (tag) => {\n const tagTemplate = safetyStyledInNextJs(tag)\n return templateFunctionGenerator(tagTemplate)\n};\n\n(domElements as Array<AnyStyledComponent>).forEach(element => {\n FoundationStyled[element] = FoundationStyled(element)\n})\n\ninterface FoundationCSSInterface {\n (\n first: TemplateStringsArray | CSSObject,\n ...interpolations: SimpleInterpolation[]\n ): FlattenSimpleInterpolation\n (\n first:\n | TemplateStringsArray\n | CSSObject\n | InterpolationFunction<ThemedStyledProps<{ foundation?: Foundation }, Foundation>>,\n ...interpolations: Array<Interpolation<ThemedStyledProps<{ foundation?: Foundation }, Foundation>>>\n ): FlattenInterpolation<ThemedStyledProps<{ foundation?: Foundation }, Foundation>>\n <P extends object>(\n first:\n | TemplateStringsArray\n | CSSObject\n | InterpolationFunction<ThemedStyledProps<P & { foundation?: Foundation }, Foundation>>,\n ...interpolations: Array<Interpolation<ThemedStyledProps<P & { foundation?: Foundation }, Foundation>>>\n ): FlattenInterpolation<ThemedStyledProps<P & { foundation?: Foundation }, Foundation>>\n}\n\n/* eslint-disable-next-line func-names */\nconst FoundationCSS: FoundationCSSInterface = baseCSS\n\nfunction useFoundation() {\n return useContext(FoundationContext)\n}\n\ntype GlobalStyleProp = {\n global?: CSSObject\n}\n\ntype FoundationWithGlobalStyle = Foundation & GlobalStyleProp\ninterface CreateFoundationGlobalStyle {\n <P extends object>(\n first:\n | TemplateStringsArray\n | CSSObject\n | InterpolationFunction<ThemedStyledProps<P & { foundation?: FoundationWithGlobalStyle }, Foundation>>,\n ...interpolations: Array<Interpolation<ThemedStyledProps<P & { foundation?: FoundationWithGlobalStyle }, Foundation>>>\n ): GlobalStyleComponent<\n // @ts-ignore\n P & { foundation: FoundationWithGlobalStyle },\n ThemedStyledProps<P & { foundation: FoundationWithGlobalStyle }, Foundation>\n >\n}\n\n/* eslint-disable-next-line func-names */ /* @ts-ignore */\nconst createFoundationGlobalStyle: CreateFoundationGlobalStyle = baseCreateGlobalStyle\n\nexport type {\n GlobalStyleProp,\n}\n\nexport {\n createFoundationGlobalStyle as createGlobalStyle,\n FoundationStyled as styled,\n FoundationCSS as css,\n FoundationProvider,\n useFoundation,\n keyframes,\n StyleSheetManager,\n ServerStyleSheet,\n}\n"],"names":["safetyStyledInNextJs","styled","default","FoundationContext","createContext","FoundationProvider","foundation","children","React","createElement","Provider","value","templateFunctionGenerator","BaseComponentGenerator","customTemplateFn","args","BaseComponent","BaseRefComponent","forwardRef","props","ref","currentFoundation","useContext","Object","assign","key","toString","attrs","withConfig","config","FoundationStyled","tag","tagTemplate","domElements","forEach","element","FoundationCSS","baseCSS","useFoundation","createFoundationGlobalStyle","baseCreateGlobalStyle"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAiCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,oBAAoB,GAAIC,MAAM,CAACC,OAAO,IAAID,MAA0B,CAAA;AAE1E,MAAME,iBAAiB,gBAAGC,mBAAa,CAAoB,IAAI,CAAC,CAAA;AAOhE,SAASC,kBAAkBA,CAAC;EAC1BC,UAAU;AACVC,EAAAA,QAAAA;AACuB,CAAC,EAAE;AAC1B,EAAA,oBACEC,KAAA,CAAAC,aAAA,CAACN,iBAAiB,CAACO,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAEL,UAAAA;AAAW,GAAA,EAC1CC,QACwB,CAAC,CAAA;AAEjC,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA,SAASK,yBAAyBA,CAACC,sBAAwF,EAAE;AAC3H,EAAA,MAAMC,gBAAgB,GAAGA,CAAC,GAAGC,IAA0B,KAAK;AAC1D;AACA,IAAA,MAAMC,aAAa,GAAGH,sBAAsB,CAAC,GAAGE,IAAI,CAAC,CAAA;IACrD,MAAME,gBAAgB,gBAAGC,gBAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;AAClD,MAAA,MAAMC,iBAAiB,GAAGC,gBAAU,CAACnB,iBAAiB,CAAC,CAAA;MACvD,oBACEK,KAAA,CAAAC,aAAA,CAACO,aAAa,EAAAO,MAAA,CAAAC,MAAA,CAAA;AACZJ,QAAAA,GAAG,EAAEA,GAAI;AACTK,QAAAA,GAAG,EAAEV,IAAI,CAACW,QAAQ,EAAG;AACrBpB,QAAAA,UAAU,EAAEe,iBAAAA;OACRF,EAAAA,KAAK,CACV,CAAC,CAAA;AAEN,KAAC,CAAC,CAAA;AACFF,IAAAA,gBAAgB,CAACS,QAAQ,GAAGV,aAAa,CAACU,QAAQ,CAAA;AAClD,IAAA,OAAOT,gBAAgB,CAAA;GACxB,CAAA;AACDH,EAAAA,gBAAgB,CAACa,KAAK,GAAIA,KAAK,IAAKf,yBAAyB,CAACC,sBAAsB,CAACc,KAAK,CAACA,KAAK,CAAC,CAAC,CAAA;AAClGb,EAAAA,gBAAgB,CAACc,UAAU,GAAIC,MAAM,IAAKjB,yBAAyB,CAACC,sBAAsB,CAACe,UAAU,CAACC,MAAM,CAAC,CAAC,CAAA;AAC9G,EAAA,OAAOf,gBAAgB,CAAA;AACzB,CAAA;;AAEA;AACMgB,MAAAA,gBAA2C,GAAIC,GAAG,IAAK;AAC3D,EAAA,MAAMC,WAAW,GAAGhC,oBAAoB,CAAC+B,GAAG,CAAC,CAAA;EAC7C,OAAOnB,yBAAyB,CAACoB,WAAW,CAAC,CAAA;AAC/C,EAAC;AAEAC,mBAAW,CAA+BC,OAAO,CAACC,OAAO,IAAI;AAC5DL,EAAAA,gBAAgB,CAACK,OAAO,CAAC,GAAGL,gBAAgB,CAACK,OAAO,CAAC,CAAA;AACvD,CAAC,CAAC,CAAA;AAuBF;AACMC,MAAAA,aAAqC,GAAGC,WAAO;AAErD,SAASC,aAAaA,GAAG;EACvB,OAAOhB,gBAAU,CAACnB,iBAAiB,CAAC,CAAA;AACtC,CAAA;AAqBA;AAA0C;AACpCoC,MAAAA,2BAAwD,GAAGC;;;;;;;;;;;;;;;;;;;;"}
@@ -83,7 +83,7 @@ const smoothCorners = ({
83
83
  border-radius: ${borderRadius};
84
84
  `}
85
85
 
86
- ${SmoothCornersFeature.default.activated && FoundationStyledComponent.css`
86
+ ${SmoothCornersFeature.default.activated.get(globalThis) && FoundationStyledComponent.css`
87
87
  @supports (background: paint(smooth-corners)) {
88
88
  padding: ${shadowBlur * 2}px;
89
89
  margin: ${-(shadowBlur * 2) + margin}px;
@@ -1 +1 @@
1
- {"version":3,"file":"Mixins.js","sources":["../../../src/foundation/Mixins.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\n\nimport type { SimpleInterpolation } from 'styled-components'\n\nimport { SmoothCornersFeature } from '~/src/features'\nimport { isNil } from '~/src/utils/typeUtils'\n\nimport { css } from './FoundationStyledComponent'\n\nexport const absoluteCenter = (otherTransforms?: SimpleInterpolation) => css`\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) ${otherTransforms};\n`\n\n// eslint-disable-next-line max-len\nexport const centeredBackgroundImage = <Type extends number | string>(...sizes: [Type] | [Type, Type]): ReturnType<typeof css> => {\n const [width, height = width] = sizes\n\n return css`\n background-image: var(--background-image);\n background-position: center;\n background-repeat: no-repeat;\n background-size: ${width}px, ${height}px;\n background-clip: content-box;\n `\n}\n\nexport const disableAutoMinimum = css`\n min-width: 0;\n min-height: 0;\n`\n\nexport const hideScrollbars = () => css`\n -ms-overflow-style: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n`\n\n/* line이 1이거나 undefined일때는 lineheight가 optional이지만, 1보다 큰 숫자일 경우 lineHeight를 명시하도록 합니다. */\ntype One = 1\nexport function ellipsis(line?: undefined, lineHeight?: undefined): ReturnType<typeof css>\nexport function ellipsis(line?: One, lineHeight?: undefined): ReturnType<typeof css>\nexport function ellipsis(line: number, lineHeight: number): ReturnType<typeof css>\nexport function ellipsis(line?: number, lineHeight?: number): ReturnType<typeof css> {\n if (isNil(line) || line <= 1) {\n return css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `\n }\n\n if (isNil(lineHeight)) {\n // eslint-disable-next-line no-console\n console.warn('lineHeight required')\n return css``\n }\n\n /* stylelint-disable value-no-vendor-prefix, property-no-vendor-prefix */\n return css`\n display: -webkit-box;\n max-height: ${(line * lineHeight)}rem;\n overflow: hidden;\n line-height: ${lineHeight}rem;\n text-overflow: ellipsis;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: ${line};\n `\n /* stylelint-enable value-no-vendor-prefix, property-no-vendor-prefix */\n}\n\ninterface SmoothCornersOptions {\n borderRadius?: number | string\n shadow?: string\n backgroundColor?: string\n hasBackgroundImage?: boolean\n shadowBlur?: number\n margin?: number\n}\n\nexport const smoothCorners = ({\n borderRadius = 0,\n shadow = '0 0 0 0 transparent',\n backgroundColor = 'white',\n hasBackgroundImage = false,\n shadowBlur = 0,\n margin = 0,\n}: SmoothCornersOptions) => css`\n margin: ${margin}px;\n background-color: ${backgroundColor};\n\n ${hasBackgroundImage && css`\n background-image: var(--background-image);\n background-size: cover;\n `}\n\n ${borderRadius && css`\n border-radius: ${borderRadius};\n `}\n\n ${SmoothCornersFeature.activated && css`\n @supports (background: paint(smooth-corners)) {\n padding: ${shadowBlur * 2}px;\n margin: ${-(shadowBlur * 2) + margin}px;\n background: paint(smooth-corners);\n border-radius: 0;\n /* Custom property 는 CSSUnparsedValue 로만 잡혀서 사용하는 임시 속성 */\n box-shadow: none;\n\n ${hasBackgroundImage && css`\n border-image-source: var(--background-image);\n `}\n\n --smooth-corners: ${borderRadius};\n --smooth-corners-shadow: ${shadow};\n --smooth-corners-bg-color: ${backgroundColor};\n --smooth-corners-padding: ${shadowBlur * 2};\n --smooth-corners-radius-unit: ${typeof borderRadius === 'string' ? 'string' : 'number'};\n }\n `}\n`\n\ninterface BackgroundImageVariableOptions {\n imageUrl: string\n}\n\nexport const backgroundImageVariable = ({ imageUrl }: BackgroundImageVariableOptions): CSSProperties => ({\n // @ts-ignore\n '--background-image': `url(${imageUrl})`,\n})\n"],"names":["absoluteCenter","otherTransforms","css","centeredBackgroundImage","sizes","width","height","disableAutoMinimum","hideScrollbars","ellipsis","line","lineHeight","isNil","console","warn","smoothCorners","borderRadius","shadow","backgroundColor","hasBackgroundImage","shadowBlur","margin","SmoothCornersFeature","activated","backgroundImageVariable","imageUrl"],"mappings":";;;;;;AASaA,MAAAA,cAAc,GAAIC,eAAqC,IAAKC,6BAAI,CAAA;AAC7E;AACA;AACA;AACA,mCAAA,EAAqCD,eAAgB,CAAA;AACrD,EAAC;;AAED;MACaE,uBAAuB,GAAGA,CAA+B,GAAGC,KAA4B,KAA6B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,EAAYmB,MAAO,CAAA;AACnB,oBAAA,EAAsBH,eAAgB,CAAA;AACtC;AACA,EAAIC,EAAAA,kBAAkB,IAAIjB,6BAAI,CAAA;AAC9B;AACA;AACA,EAAI,CAAA,CAAA;AACJ;AACA,EAAIc,EAAAA,YAAY,IAAId,6BAAI,CAAA;AACxB,mBAAA,EAAqBc,YAAa,CAAA;AAClC,EAAI,CAAA,CAAA;AACJ;AACA,EAAA,EAAIM,4BAAoB,CAACC,SAAS,IAAIrB,6BAAI,CAAA;AAC1C;AACA,eAAiBkB,EAAAA,UAAU,GAAG,CAAE,CAAA;AAChC,cAAA,EAAgB,EAAEA,UAAU,GAAG,CAAC,CAAC,GAAGC,MAAO,CAAA;AAC3C;AACA;AACA;AACA;AACA;AACA,MAAQF,EAAAA,kBAAkB,IAAIjB,6BAAI,CAAA;AAClC;AACA,MAAQ,CAAA,CAAA;AACR;AACA,wBAAA,EAA0Bc,YAAa,CAAA;AACvC,+BAAA,EAAiCC,MAAO,CAAA;AACxC,iCAAA,EAAmCC,eAAgB,CAAA;AACnD,gCAAkCE,EAAAA,UAAU,GAAG,CAAE,CAAA;AACjD,oCAAA,EAAsC,OAAOJ,YAAY,KAAK,QAAQ,GAAG,QAAQ,GAAG,QAAS,CAAA;AAC7F;AACA,EAAI,CAAA,CAAA;AACJ,EAAC;AAMM,MAAMQ,uBAAuB,GAAGA,CAAC;AAAEC,EAAAA,QAAAA;AAAyC,CAAC,MAAqB;AACvG;EACA,oBAAoB,EAAG,OAAMA,QAAS,CAAA,CAAA,CAAA;AACxC,CAAC;;;;;;;;;;"}
1
+ {"version":3,"file":"Mixins.js","sources":["../../../src/foundation/Mixins.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\n\nimport type { SimpleInterpolation } from 'styled-components'\n\nimport { SmoothCornersFeature } from '~/src/features'\nimport { isNil } from '~/src/utils/typeUtils'\n\nimport { css } from './FoundationStyledComponent'\n\nexport const absoluteCenter = (otherTransforms?: SimpleInterpolation) => css`\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) ${otherTransforms};\n`\n\n// eslint-disable-next-line max-len\nexport const centeredBackgroundImage = <Type extends number | string>(...sizes: [Type] | [Type, Type]): ReturnType<typeof css> => {\n const [width, height = width] = sizes\n\n return css`\n background-image: var(--background-image);\n background-position: center;\n background-repeat: no-repeat;\n background-size: ${width}px, ${height}px;\n background-clip: content-box;\n `\n}\n\nexport const disableAutoMinimum = css`\n min-width: 0;\n min-height: 0;\n`\n\nexport const hideScrollbars = () => css`\n -ms-overflow-style: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n`\n\n/* line이 1이거나 undefined일때는 lineheight가 optional이지만, 1보다 큰 숫자일 경우 lineHeight를 명시하도록 합니다. */\ntype One = 1\nexport function ellipsis(line?: undefined, lineHeight?: undefined): ReturnType<typeof css>\nexport function ellipsis(line?: One, lineHeight?: undefined): ReturnType<typeof css>\nexport function ellipsis(line: number, lineHeight: number): ReturnType<typeof css>\nexport function ellipsis(line?: number, lineHeight?: number): ReturnType<typeof css> {\n if (isNil(line) || line <= 1) {\n return css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `\n }\n\n if (isNil(lineHeight)) {\n // eslint-disable-next-line no-console\n console.warn('lineHeight required')\n return css``\n }\n\n /* stylelint-disable value-no-vendor-prefix, property-no-vendor-prefix */\n return css`\n display: -webkit-box;\n max-height: ${(line * lineHeight)}rem;\n overflow: hidden;\n line-height: ${lineHeight}rem;\n text-overflow: ellipsis;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: ${line};\n `\n /* stylelint-enable value-no-vendor-prefix, property-no-vendor-prefix */\n}\n\ninterface SmoothCornersOptions {\n borderRadius?: number | string\n shadow?: string\n backgroundColor?: string\n hasBackgroundImage?: boolean\n shadowBlur?: number\n margin?: number\n}\n\nexport const smoothCorners = ({\n borderRadius = 0,\n shadow = '0 0 0 0 transparent',\n backgroundColor = 'white',\n hasBackgroundImage = false,\n shadowBlur = 0,\n margin = 0,\n}: SmoothCornersOptions) => css`\n margin: ${margin}px;\n background-color: ${backgroundColor};\n\n ${hasBackgroundImage && css`\n background-image: var(--background-image);\n background-size: cover;\n `}\n\n ${borderRadius && css`\n border-radius: ${borderRadius};\n `}\n\n ${SmoothCornersFeature.activated.get(globalThis) && css`\n @supports (background: paint(smooth-corners)) {\n padding: ${shadowBlur * 2}px;\n margin: ${-(shadowBlur * 2) + margin}px;\n background: paint(smooth-corners);\n border-radius: 0;\n /* Custom property 는 CSSUnparsedValue 로만 잡혀서 사용하는 임시 속성 */\n box-shadow: none;\n\n ${hasBackgroundImage && css`\n border-image-source: var(--background-image);\n `}\n\n --smooth-corners: ${borderRadius};\n --smooth-corners-shadow: ${shadow};\n --smooth-corners-bg-color: ${backgroundColor};\n --smooth-corners-padding: ${shadowBlur * 2};\n --smooth-corners-radius-unit: ${typeof borderRadius === 'string' ? 'string' : 'number'};\n }\n `}\n`\n\ninterface BackgroundImageVariableOptions {\n imageUrl: string\n}\n\nexport const backgroundImageVariable = ({ imageUrl }: BackgroundImageVariableOptions): CSSProperties => ({\n // @ts-ignore\n '--background-image': `url(${imageUrl})`,\n})\n"],"names":["absoluteCenter","otherTransforms","css","centeredBackgroundImage","sizes","width","height","disableAutoMinimum","hideScrollbars","ellipsis","line","lineHeight","isNil","console","warn","smoothCorners","borderRadius","shadow","backgroundColor","hasBackgroundImage","shadowBlur","margin","SmoothCornersFeature","activated","get","globalThis","backgroundImageVariable","imageUrl"],"mappings":";;;;;;AASaA,MAAAA,cAAc,GAAIC,eAAqC,IAAKC,6BAAI,CAAA;AAC7E;AACA;AACA;AACA,mCAAA,EAAqCD,eAAgB,CAAA;AACrD,EAAC;;AAED;MACaE,uBAAuB,GAAGA,CAA+B,GAAGC,KAA4B,KAA6B;EAChI,MAAM,CAACC,KAAK,EAAEC,MAAM,GAAGD,KAAK,CAAC,GAAGD,KAAK,CAAA;AAErC,EAAA,OAAOF,6BAAI,CAAA;AACb;AACA;AACA;AACA,qB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AI,CAAA,CAAA;AACJ;AACA,EAAIc,EAAAA,YAAY,IAAId,6BAAI,CAAA;AACxB,mBAAA,EAAqBc,YAAa,CAAA;AAClC,EAAI,CAAA,CAAA;AACJ;AACA,EAAIM,EAAAA,4BAAoB,CAACC,SAAS,CAACC,GAAG,CAACC,UAAU,CAAC,IAAIvB,6BAAI,CAAA;AAC1D;AACA,eAAiBkB,EAAAA,UAAU,GAAG,CAAE,CAAA;AAChC,cAAA,EAAgB,EAAEA,UAAU,GAAG,CAAC,CAAC,GAAGC,MAAO,CAAA;AAC3C;AACA;AACA;AACA;AACA;AACA,MAAQF,EAAAA,kBAAkB,IAAIjB,6BAAI,CAAA;AAClC;AACA,MAAQ,CAAA,CAAA;AACR;AACA,wBAAA,EAA0Bc,YAAa,CAAA;AACvC,+BAAA,EAAiCC,MAAO,CAAA;AACxC,iCAAA,EAAmCC,eAAgB,CAAA;AACnD,gCAAkCE,EAAAA,UAAU,GAAG,CAAE,CAAA;AACjD,oCAAA,EAAsC,OAAOJ,YAAY,KAAK,QAAQ,GAAG,QAAQ,GAAG,QAAS,CAAA;AAC7F;AACA,EAAI,CAAA,CAAA;AACJ,EAAC;AAMM,MAAMU,uBAAuB,GAAGA,CAAC;AAAEC,EAAAA,QAAAA;AAAyC,CAAC,MAAqB;AACvG;EACA,oBAAoB,EAAG,OAAMA,QAAS,CAAA,CAAA,CAAA;AACxC,CAAC;;;;;;;;;;"}
package/dist/cjs/index.js CHANGED
@@ -185,6 +185,10 @@ Object.defineProperty(exports, 'ServerStyleSheet', {
185
185
  enumerable: true,
186
186
  get: function () { return styled.ServerStyleSheet; }
187
187
  });
188
+ Object.defineProperty(exports, 'StyleSheetManager', {
189
+ enumerable: true,
190
+ get: function () { return styled.StyleSheetManager; }
191
+ });
188
192
  Object.defineProperty(exports, 'keyframes', {
189
193
  enumerable: true,
190
194
  get: function () { return styled.keyframes; }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -12,7 +12,7 @@ for (let i = 0; i < 256; ++i) {
12
12
  function unsafeStringify(arr, offset = 0) {
13
13
  // Note: Be careful editing this code! It's been tuned for performance
14
14
  // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
15
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
15
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
16
16
  }
17
17
 
18
18
  exports.unsafeStringify = unsafeStringify;
@@ -1 +1 @@
1
- {"version":3,"file":"stringify.js","sources":["../../../../../../../../node_modules/uuid/dist/esm-browser/stringify.js"],"sourcesContent":["import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;"],"names":["byteToHex","i","push","toString","slice","unsafeStringify","arr","offset","toLowerCase"],"mappings":";;AACA;AACA;AACA;AACA;;AAEA,MAAMA,SAAS,GAAG,EAAE,CAAA;AAEpB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,GAAG,EAAE,EAAEA,CAAC,EAAE;AAC5BD,EAAAA,SAAS,CAACE,IAAI,CAAC,CAACD,CAAC,GAAG,KAAK,EAAEE,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AACnD,CAAA;AAEO,SAASC,eAAeA,CAACC,GAAG,EAAEC,MAAM,GAAG,CAAC,EAAE;AAC/C;AACA;AACA,EAAA,OAAO,CAACP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,EAAEC,WAAW,EAAE,CAAA;AACpgB;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"stringify.js","sources":["../../../../../../../../node_modules/uuid/dist/esm-browser/stringify.js"],"sourcesContent":["import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;"],"names":["byteToHex","i","push","toString","slice","unsafeStringify","arr","offset"],"mappings":";;AACA;AACA;AACA;AACA;;AAEA,MAAMA,SAAS,GAAG,EAAE,CAAA;AAEpB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,GAAG,EAAE,EAAEA,CAAC,EAAE;AAC5BD,EAAAA,SAAS,CAACE,IAAI,CAAC,CAACD,CAAC,GAAG,KAAK,EAAEE,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AACnD,CAAA;AAEO,SAASC,eAAeA,CAACC,GAAG,EAAEC,MAAM,GAAG,CAAC,EAAE;AAC/C;AACA;AACA,EAAA,OAAOP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAA;AACpf;;;;","x_google_ignoreList":[0]}
@@ -2,14 +2,6 @@ let FeatureType = /*#__PURE__*/function (FeatureType) {
2
2
  FeatureType["SmoothCorners"] = "smooth-corners";
3
3
  return FeatureType;
4
4
  }({});
5
- class Feature {
6
- constructor(name) {
7
- this.name = name;
8
- }
9
- async activate() {
10
- return Promise.resolve(false);
11
- }
12
- }
13
5
 
14
- export { Feature, FeatureType };
6
+ export { FeatureType };
15
7
  //# sourceMappingURL=Feature.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Feature.mjs","sources":["../../../src/features/Feature.ts"],"sourcesContent":["export enum FeatureType {\n SmoothCorners = 'smooth-corners',\n}\n\nexport class Feature {\n name: FeatureType\n\n constructor(name: FeatureType) {\n this.name = name\n }\n\n async activate() {\n return Promise.resolve(false)\n }\n}\n"],"names":["FeatureType","Feature","constructor","name","activate","Promise","resolve"],"mappings":"AAAYA,IAAAA,WAAW,0BAAXA,WAAW,EAAA;EAAXA,WAAW,CAAA,eAAA,CAAA,GAAA,gBAAA,CAAA;AAAA,EAAA,OAAXA,WAAW,CAAA;AAAA,CAAA,CAAA,EAAA,EAAA;AAIhB,MAAMC,OAAO,CAAC;EAGnBC,WAAWA,CAACC,IAAiB,EAAE;IAC7B,IAAI,CAACA,IAAI,GAAGA,IAAI,CAAA;AAClB,GAAA;EAEA,MAAMC,QAAQA,GAAG;AACf,IAAA,OAAOC,OAAO,CAACC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC/B,GAAA;AACF;;;;"}
1
+ {"version":3,"file":"Feature.mjs","sources":["../../../src/features/Feature.ts"],"sourcesContent":["export enum FeatureType {\n SmoothCorners = 'smooth-corners',\n}\n\nexport interface Feature {\n readonly name: FeatureType\n activate: () => Promise<boolean>\n}\n"],"names":["FeatureType"],"mappings":"AAAYA,IAAAA,WAAW,0BAAXA,WAAW,EAAA;EAAXA,WAAW,CAAA,eAAA,CAAA,GAAA,gBAAA,CAAA;AAAA,EAAA,OAAXA,WAAW,CAAA;AAAA,CAAA,CAAA,EAAA;;;;"}
@@ -1,40 +1,57 @@
1
- import { FeatureType, Feature } from '../Feature.mjs';
1
+ import { FeatureType } from '../Feature.mjs';
2
2
  import { smoothCornersScript } from './smoothCornersScript.mjs';
3
3
 
4
4
  // eslint-disable-next-line no-restricted-imports
5
5
 
6
+ /**
7
+ * @see {@link https://fetch.spec.whatwg.org/#requestcredentials}
8
+ */
9
+
10
+ /**
11
+ * @see {@link https://html.spec.whatwg.org/multipage/worklets.html#worklets-worklet}
12
+ */
13
+
6
14
  /**
7
15
  * 🚨 This is an experimental feature! It may not be suitable for use in production.
8
16
  *
9
17
  * Instead of CSS border-radius, Use *Superellipse* masking using the CSS Houdini API.
10
18
  * When enabled, the feature will be applied to components with the `smoothCorners` property set to `true`.
11
19
  */
12
- class SmoothCornersFeature extends Feature {
20
+ class SmoothCornersFeature {
21
+ name = FeatureType.SmoothCorners;
22
+ globalObject = null;
23
+
13
24
  /**
14
25
  * @deprecated (@ed) Upcoming improvements
15
26
  * Changed to private property, and will be referenced via the useFeatureFlag context rather than directly externally.
16
27
  */
17
- activated = false;
18
- async activate() {
19
- if (!this.activated && typeof CSS !== 'undefined' && 'paintWorklet' in CSS) {
28
+ activated = new WeakMap([[globalThis, false]]);
29
+ updateCurrentGlobalObject(globalObject) {
30
+ this.globalObject = globalObject;
31
+ }
32
+ isGlobalObjectIdentical(globalObject) {
33
+ return Object.is(this.globalObject, globalObject);
34
+ }
35
+ supportCSSPaintWorklet(globalObject) {
36
+ return typeof globalObject.CSS !== 'undefined' && 'paintWorklet' in globalObject.CSS;
37
+ }
38
+ async activate(globalObject = globalThis) {
39
+ if (!this.isGlobalObjectIdentical(globalObject) && this.supportCSSPaintWorklet(globalObject)) {
20
40
  const workletURL = URL.createObjectURL(new Blob([smoothCornersScript], {
21
41
  type: 'application/javascript'
22
42
  }));
23
-
24
- // @ts-ignore
25
- const promise = CSS.paintWorklet.addModule(workletURL);
26
- return promise.then(() => {
27
- this.activated = true;
28
- return this.activated;
29
- }).catch(() => {
30
- this.activated = false;
31
- return this.activated;
32
- });
43
+ try {
44
+ await globalObject.CSS.paintWorklet.addModule(workletURL);
45
+ this.activated.set(globalObject, true);
46
+ } catch {
47
+ this.activated.set(globalObject, false);
48
+ }
33
49
  }
34
- return this.activated;
50
+ this.updateCurrentGlobalObject(globalObject);
51
+ return this.activated.get(globalObject);
35
52
  }
36
53
  }
37
- var SmoothCornersFeature$1 = new SmoothCornersFeature(FeatureType.SmoothCorners);
54
+ var SmoothCornersFeature$1 = new SmoothCornersFeature();
38
55
 
39
56
  export { SmoothCornersFeature$1 as default };
40
57
  //# sourceMappingURL=SmoothCornersFeature.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"SmoothCornersFeature.mjs","sources":["../../../../src/features/SmoothCornersFeature/SmoothCornersFeature.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport {\n Feature,\n FeatureType,\n} from '../Feature'\n\nimport { smoothCornersScript } from './smoothCornersScript'\n\n/**\n * 🚨 This is an experimental feature! It may not be suitable for use in production.\n *\n * Instead of CSS border-radius, Use *Superellipse* masking using the CSS Houdini API.\n * When enabled, the feature will be applied to components with the `smoothCorners` property set to `true`.\n */\nclass SmoothCornersFeature extends Feature {\n /**\n * @deprecated (@ed) Upcoming improvements\n * Changed to private property, and will be referenced via the useFeatureFlag context rather than directly externally.\n */\n activated = false\n\n async activate() {\n if (\n !this.activated\n && typeof CSS !== 'undefined'\n && 'paintWorklet' in CSS\n ) {\n const workletURL = URL.createObjectURL(\n new Blob([smoothCornersScript], { type: 'application/javascript' }),\n )\n\n // @ts-ignore\n const promise = CSS.paintWorklet.addModule(workletURL) as Promise<void>\n\n return promise\n .then(() => {\n this.activated = true\n return this.activated\n }).catch(() => {\n this.activated = false\n return this.activated\n })\n }\n\n return this.activated\n }\n}\n\nexport default new SmoothCornersFeature(FeatureType.SmoothCorners)\n"],"names":["SmoothCornersFeature","Feature","activated","activate","CSS","workletURL","URL","createObjectURL","Blob","smoothCornersScript","type","promise","paintWorklet","addModule","then","catch","FeatureType","SmoothCorners"],"mappings":";;;AAAA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,oBAAoB,SAASC,OAAO,CAAC;AACzC;AACF;AACA;AACA;AACEC,EAAAA,SAAS,GAAG,KAAK,CAAA;EAEjB,MAAMC,QAAQA,GAAG;AACf,IAAA,IACE,CAAC,IAAI,CAACD,SAAS,IACZ,OAAOE,GAAG,KAAK,WAAW,IAC1B,cAAc,IAAIA,GAAG,EACxB;AACA,MAAA,MAAMC,UAAU,GAAGC,GAAG,CAACC,eAAe,CACpC,IAAIC,IAAI,CAAC,CAACC,mBAAmB,CAAC,EAAE;AAAEC,QAAAA,IAAI,EAAE,wBAAA;AAAyB,OAAC,CACpE,CAAC,CAAA;;AAED;MACA,MAAMC,OAAO,GAAGP,GAAG,CAACQ,YAAY,CAACC,SAAS,CAACR,UAAU,CAAkB,CAAA;AAEvE,MAAA,OAAOM,OAAO,CACXG,IAAI,CAAC,MAAM;QACV,IAAI,CAACZ,SAAS,GAAG,IAAI,CAAA;QACrB,OAAO,IAAI,CAACA,SAAS,CAAA;AACvB,OAAC,CAAC,CAACa,KAAK,CAAC,MAAM;QACb,IAAI,CAACb,SAAS,GAAG,KAAK,CAAA;QACtB,OAAO,IAAI,CAACA,SAAS,CAAA;AACvB,OAAC,CAAC,CAAA;AACN,KAAA;IAEA,OAAO,IAAI,CAACA,SAAS,CAAA;AACvB,GAAA;AACF,CAAA;AAEA,6BAAe,IAAIF,oBAAoB,CAACgB,WAAW,CAACC,aAAa,CAAC;;;;"}
1
+ {"version":3,"file":"SmoothCornersFeature.mjs","sources":["../../../../src/features/SmoothCornersFeature/SmoothCornersFeature.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport {\n type Feature,\n FeatureType,\n} from '../Feature'\n\nimport { smoothCornersScript } from './smoothCornersScript'\n\n/**\n * @see {@link https://fetch.spec.whatwg.org/#requestcredentials}\n */\ntype RequestCredentials = 'omit' | 'same-origin' | 'include'\n\ntype WorkletOptions = {\n credentials: RequestCredentials\n}\n\n/**\n * @see {@link https://html.spec.whatwg.org/multipage/worklets.html#worklets-worklet}\n */\ninterface Worklet {\n addModule: (moduleURL: string, options?: WorkletOptions) => Promise<void>\n}\n\ndeclare global {\n namespace CSS {\n export const paintWorklet: Worklet\n }\n}\n\n/**\n * 🚨 This is an experimental feature! It may not be suitable for use in production.\n *\n * Instead of CSS border-radius, Use *Superellipse* masking using the CSS Houdini API.\n * When enabled, the feature will be applied to components with the `smoothCorners` property set to `true`.\n */\nclass SmoothCornersFeature implements Feature {\n readonly name = FeatureType.SmoothCorners\n\n private globalObject: typeof globalThis | null = null\n\n /**\n * @deprecated (@ed) Upcoming improvements\n * Changed to private property, and will be referenced via the useFeatureFlag context rather than directly externally.\n */\n activated: WeakMap<typeof globalThis, boolean> = new WeakMap([[globalThis, false]])\n\n private updateCurrentGlobalObject(globalObject: typeof globalThis) {\n this.globalObject = globalObject\n }\n\n private isGlobalObjectIdentical(globalObject: typeof globalThis) {\n return Object.is(this.globalObject, globalObject)\n }\n\n private supportCSSPaintWorklet(globalObject: typeof globalThis) {\n return typeof globalObject.CSS !== 'undefined' && 'paintWorklet' in globalObject.CSS\n }\n\n async activate(globalObject: typeof globalThis = globalThis) {\n if (!this.isGlobalObjectIdentical(globalObject) && this.supportCSSPaintWorklet(globalObject)) {\n const workletURL = URL.createObjectURL(\n new Blob([smoothCornersScript], { type: 'application/javascript' }),\n )\n\n try {\n await globalObject.CSS.paintWorklet.addModule(workletURL)\n this.activated.set(globalObject, true)\n } catch {\n this.activated.set(globalObject, false)\n }\n }\n\n this.updateCurrentGlobalObject(globalObject)\n\n return this.activated.get(globalObject) as boolean\n }\n}\n\nexport default new SmoothCornersFeature()\n"],"names":["SmoothCornersFeature","name","FeatureType","SmoothCorners","globalObject","activated","WeakMap","globalThis","updateCurrentGlobalObject","isGlobalObjectIdentical","Object","is","supportCSSPaintWorklet","CSS","activate","workletURL","URL","createObjectURL","Blob","smoothCornersScript","type","paintWorklet","addModule","set","get"],"mappings":";;;AAAA;;AAQA;AACA;AACA;;AAOA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,oBAAoB,CAAoB;EACnCC,IAAI,GAAGC,WAAW,CAACC,aAAa,CAAA;AAEjCC,EAAAA,YAAY,GAA6B,IAAI,CAAA;;AAErD;AACF;AACA;AACA;EACEC,SAAS,GAAwC,IAAIC,OAAO,CAAC,CAAC,CAACC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;EAE3EC,yBAAyBA,CAACJ,YAA+B,EAAE;IACjE,IAAI,CAACA,YAAY,GAAGA,YAAY,CAAA;AAClC,GAAA;EAEQK,uBAAuBA,CAACL,YAA+B,EAAE;IAC/D,OAAOM,MAAM,CAACC,EAAE,CAAC,IAAI,CAACP,YAAY,EAAEA,YAAY,CAAC,CAAA;AACnD,GAAA;EAEQQ,sBAAsBA,CAACR,YAA+B,EAAE;IAC9D,OAAO,OAAOA,YAAY,CAACS,GAAG,KAAK,WAAW,IAAI,cAAc,IAAIT,YAAY,CAACS,GAAG,CAAA;AACtF,GAAA;AAEA,EAAA,MAAMC,QAAQA,CAACV,YAA+B,GAAGG,UAAU,EAAE;AAC3D,IAAA,IAAI,CAAC,IAAI,CAACE,uBAAuB,CAACL,YAAY,CAAC,IAAI,IAAI,CAACQ,sBAAsB,CAACR,YAAY,CAAC,EAAE;AAC5F,MAAA,MAAMW,UAAU,GAAGC,GAAG,CAACC,eAAe,CACpC,IAAIC,IAAI,CAAC,CAACC,mBAAmB,CAAC,EAAE;AAAEC,QAAAA,IAAI,EAAE,wBAAA;AAAyB,OAAC,CACpE,CAAC,CAAA;MAED,IAAI;QACF,MAAMhB,YAAY,CAACS,GAAG,CAACQ,YAAY,CAACC,SAAS,CAACP,UAAU,CAAC,CAAA;QACzD,IAAI,CAACV,SAAS,CAACkB,GAAG,CAACnB,YAAY,EAAE,IAAI,CAAC,CAAA;AACxC,OAAC,CAAC,MAAM;QACN,IAAI,CAACC,SAAS,CAACkB,GAAG,CAACnB,YAAY,EAAE,KAAK,CAAC,CAAA;AACzC,OAAA;AACF,KAAA;AAEA,IAAA,IAAI,CAACI,yBAAyB,CAACJ,YAAY,CAAC,CAAA;AAE5C,IAAA,OAAO,IAAI,CAACC,SAAS,CAACmB,GAAG,CAACpB,YAAY,CAAC,CAAA;AACzC,GAAA;AACF,CAAA;AAEA,6BAAe,IAAIJ,oBAAoB,EAAE;;;;"}
@@ -1,6 +1,6 @@
1
1
  import React__default, { useContext, createContext, forwardRef } from 'react';
2
2
  import styled, { css, createGlobalStyle } from 'styled-components';
3
- export { ServerStyleSheet, keyframes } from 'styled-components';
3
+ export { ServerStyleSheet, StyleSheetManager, keyframes } from 'styled-components';
4
4
  import domElements from './utils/domElements.mjs';
5
5
 
6
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"FoundationStyledComponent.mjs","sources":["../../../src/foundation/FoundationStyledComponent.tsx"],"sourcesContent":["/**\n * NOTE:\n * 이 모듈은 Text, Icon 등 뿐 아니라 Colors, Elevation 등에서도 import 하고 있습니다.\n * 이로 인해 Colors(Elevation 등) -> ThemedStyledComponent -> Theme -> Colors(Elevation 등)\n * 의 Circular dependency 가 발생합니다.\n * 하지만 ThemedStyledComponent 에서 사용하는 Theme 은 단순한 interface 로\n * 동작에는 문제가 없으며, type checking 도 올바르게 됩니다.\n */\n\nimport React, {\n createContext,\n forwardRef,\n useContext,\n} from 'react'\n\nimport styled, {\n type AnyStyledComponent,\n type CSSObject,\n type FlattenInterpolation,\n type FlattenSimpleInterpolation,\n type GlobalStyleComponent,\n type Interpolation,\n type InterpolationFunction,\n ServerStyleSheet,\n type SimpleInterpolation,\n type StyledComponentInnerAttrs,\n type StyledComponentInnerComponent,\n type StyledComponentInnerOtherProps,\n type StyledInterface,\n type ThemedStyledFunction,\n type ThemedStyledProps,\n css as baseCSS,\n createGlobalStyle as baseCreateGlobalStyle,\n keyframes,\n} from 'styled-components'\n\nimport { type Foundation } from './Foundation'\nimport domElements from './utils/domElements'\n\n/**\n * When interpreting the `.mjs` extension in the Next.js environment,\n * default imported `styled` function are not interpreted correctly.\n *\n * We add `.default` to cover situation where the module is interpreted in CJS.\n *\n * This is code that can be removed when the major version of `styled-components` is updated (v6)\n * and `styled` functions are changed to named import.\n *\n * @see https://github.com/rollup/rollup/issues/4438\n * @see https://github.com/styled-components/styled-components/issues/115\n */\n// @ts-expect-error\nconst safetyStyledInNextJs = (styled.default ?? styled) as StyledInterface\n\nconst FoundationContext = createContext<Foundation | null>(null)\n\ninterface FoundationProviderProps {\n foundation: Foundation\n children: React.ReactNode\n}\n\nfunction FoundationProvider({\n foundation,\n children,\n}: FoundationProviderProps) {\n return (\n <FoundationContext.Provider value={foundation}>\n { children }\n </FoundationContext.Provider>\n )\n}\n\n/**\n * NOTE:\n * styled component 는 theme Context 를 갖고 있습니다. 하지만 이 context 를 사용할때는 반드시 'theme' 이라는 이름으로밖에 접근할 수 없습니다.\n * Theme 이라는 용어는 내부적으로 이미 사용하고 있거니와, styled 의 theme 에 해당하는 개념에 Mondrian 은 Foundation 이라는 이름을 붙여주었습니다.\n * 이 괴리를 해소하기 위해 styled 함수를 wrapping 하고 커스텀 context 를 강제 주입합니다.\n * 아래의 interface, type 들은 타입체크 에러를 해소하기 위해 작성되었습니다. 제거 가능한 방법을 찾을 경우 가급적 제거하는 것이 필요합니다.\n */\n\ntype FoundationStyledComponentFactories = {\n [TTag in keyof JSX.IntrinsicElements]: ThemedStyledFunction<TTag, Foundation, { foundation?: Foundation }>\n}\n\ninterface FoundationStyledInterface extends FoundationStyledComponentFactories {\n <C extends AnyStyledComponent>(component: C): ThemedStyledFunction<\n StyledComponentInnerComponent<C>,\n Foundation,\n StyledComponentInnerOtherProps<C> & { foundation?: Foundation },\n StyledComponentInnerAttrs<C>\n >\n <C extends keyof JSX.IntrinsicElements | React.ComponentType<any>>(\n // unfortunately using a conditional type to validate that it can receive a `theme?: Theme`\n // causes tests to fail in TS 3.1\n component: C\n ): ThemedStyledFunction<C, Foundation, { foundation?: Foundation }>\n}\n\nfunction templateFunctionGenerator(BaseComponentGenerator: ThemedStyledFunction<any, any, object, string | number | symbol>) {\n const customTemplateFn = (...args: TemplateStringsArray) => {\n // @ts-ignore\n const BaseComponent = BaseComponentGenerator(...args)\n const BaseRefComponent = forwardRef((props, ref) => {\n const currentFoundation = useContext(FoundationContext)\n return (\n <BaseComponent\n ref={ref}\n key={args.toString()}\n foundation={currentFoundation}\n {...props}\n />\n )\n })\n BaseRefComponent.toString = BaseComponent.toString\n return BaseRefComponent\n }\n customTemplateFn.attrs = (attrs) => templateFunctionGenerator(BaseComponentGenerator.attrs(attrs))\n customTemplateFn.withConfig = (config) => templateFunctionGenerator(BaseComponentGenerator.withConfig(config))\n return customTemplateFn\n}\n\n/* eslint-disable-next-line func-names */ /* @ts-ignore */\nconst FoundationStyled: FoundationStyledInterface = (tag) => {\n const tagTemplate = safetyStyledInNextJs(tag)\n return templateFunctionGenerator(tagTemplate)\n};\n\n(domElements as Array<AnyStyledComponent>).forEach(element => {\n FoundationStyled[element] = FoundationStyled(element)\n})\n\ninterface FoundationCSSInterface {\n (\n first: TemplateStringsArray | CSSObject,\n ...interpolations: SimpleInterpolation[]\n ): FlattenSimpleInterpolation\n (\n first:\n | TemplateStringsArray\n | CSSObject\n | InterpolationFunction<ThemedStyledProps<{ foundation?: Foundation }, Foundation>>,\n ...interpolations: Array<Interpolation<ThemedStyledProps<{ foundation?: Foundation }, Foundation>>>\n ): FlattenInterpolation<ThemedStyledProps<{ foundation?: Foundation }, Foundation>>\n <P extends object>(\n first:\n | TemplateStringsArray\n | CSSObject\n | InterpolationFunction<ThemedStyledProps<P & { foundation?: Foundation }, Foundation>>,\n ...interpolations: Array<Interpolation<ThemedStyledProps<P & { foundation?: Foundation }, Foundation>>>\n ): FlattenInterpolation<ThemedStyledProps<P & { foundation?: Foundation }, Foundation>>\n}\n\n/* eslint-disable-next-line func-names */\nconst FoundationCSS: FoundationCSSInterface = baseCSS\n\nfunction useFoundation() {\n return useContext(FoundationContext)\n}\n\ntype GlobalStyleProp = {\n global?: CSSObject\n}\n\ntype FoundationWithGlobalStyle = Foundation & GlobalStyleProp\ninterface CreateFoundationGlobalStyle {\n <P extends object>(\n first:\n | TemplateStringsArray\n | CSSObject\n | InterpolationFunction<ThemedStyledProps<P & { foundation?: FoundationWithGlobalStyle }, Foundation>>,\n ...interpolations: Array<Interpolation<ThemedStyledProps<P & { foundation?: FoundationWithGlobalStyle }, Foundation>>>\n ): GlobalStyleComponent<\n // @ts-ignore\n P & { foundation: FoundationWithGlobalStyle },\n ThemedStyledProps<P & { foundation: FoundationWithGlobalStyle }, Foundation>\n >\n}\n\n/* eslint-disable-next-line func-names */ /* @ts-ignore */\nconst createFoundationGlobalStyle: CreateFoundationGlobalStyle = baseCreateGlobalStyle\n\nexport type {\n GlobalStyleProp,\n}\n\nexport {\n createFoundationGlobalStyle as createGlobalStyle,\n FoundationStyled as styled,\n FoundationCSS as css,\n FoundationProvider,\n useFoundation,\n keyframes,\n ServerStyleSheet,\n}\n"],"names":["safetyStyledInNextJs","styled","default","FoundationContext","createContext","FoundationProvider","foundation","children","React","createElement","Provider","value","templateFunctionGenerator","BaseComponentGenerator","customTemplateFn","args","BaseComponent","BaseRefComponent","forwardRef","props","ref","currentFoundation","useContext","Object","assign","key","toString","attrs","withConfig","config","FoundationStyled","tag","tagTemplate","domElements","forEach","element","FoundationCSS","baseCSS","useFoundation","createFoundationGlobalStyle","baseCreateGlobalStyle"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAgCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,oBAAoB,GAAIC,MAAM,CAACC,OAAO,IAAID,MAA0B,CAAA;AAE1E,MAAME,iBAAiB,gBAAGC,aAAa,CAAoB,IAAI,CAAC,CAAA;AAOhE,SAASC,kBAAkBA,CAAC;EAC1BC,UAAU;AACVC,EAAAA,QAAAA;AACuB,CAAC,EAAE;AAC1B,EAAA,oBACEC,cAAA,CAAAC,aAAA,CAACN,iBAAiB,CAACO,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAEL,UAAAA;AAAW,GAAA,EAC1CC,QACwB,CAAC,CAAA;AAEjC,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA,SAASK,yBAAyBA,CAACC,sBAAwF,EAAE;AAC3H,EAAA,MAAMC,gBAAgB,GAAGA,CAAC,GAAGC,IAA0B,KAAK;AAC1D;AACA,IAAA,MAAMC,aAAa,GAAGH,sBAAsB,CAAC,GAAGE,IAAI,CAAC,CAAA;IACrD,MAAME,gBAAgB,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;AAClD,MAAA,MAAMC,iBAAiB,GAAGC,UAAU,CAACnB,iBAAiB,CAAC,CAAA;MACvD,oBACEK,cAAA,CAAAC,aAAA,CAACO,aAAa,EAAAO,MAAA,CAAAC,MAAA,CAAA;AACZJ,QAAAA,GAAG,EAAEA,GAAI;AACTK,QAAAA,GAAG,EAAEV,IAAI,CAACW,QAAQ,EAAG;AACrBpB,QAAAA,UAAU,EAAEe,iBAAAA;OACRF,EAAAA,KAAK,CACV,CAAC,CAAA;AAEN,KAAC,CAAC,CAAA;AACFF,IAAAA,gBAAgB,CAACS,QAAQ,GAAGV,aAAa,CAACU,QAAQ,CAAA;AAClD,IAAA,OAAOT,gBAAgB,CAAA;GACxB,CAAA;AACDH,EAAAA,gBAAgB,CAACa,KAAK,GAAIA,KAAK,IAAKf,yBAAyB,CAACC,sBAAsB,CAACc,KAAK,CAACA,KAAK,CAAC,CAAC,CAAA;AAClGb,EAAAA,gBAAgB,CAACc,UAAU,GAAIC,MAAM,IAAKjB,yBAAyB,CAACC,sBAAsB,CAACe,UAAU,CAACC,MAAM,CAAC,CAAC,CAAA;AAC9G,EAAA,OAAOf,gBAAgB,CAAA;AACzB,CAAA;;AAEA;AACMgB,MAAAA,gBAA2C,GAAIC,GAAG,IAAK;AAC3D,EAAA,MAAMC,WAAW,GAAGhC,oBAAoB,CAAC+B,GAAG,CAAC,CAAA;EAC7C,OAAOnB,yBAAyB,CAACoB,WAAW,CAAC,CAAA;AAC/C,EAAC;AAEAC,WAAW,CAA+BC,OAAO,CAACC,OAAO,IAAI;AAC5DL,EAAAA,gBAAgB,CAACK,OAAO,CAAC,GAAGL,gBAAgB,CAACK,OAAO,CAAC,CAAA;AACvD,CAAC,CAAC,CAAA;AAuBF;AACMC,MAAAA,aAAqC,GAAGC,IAAO;AAErD,SAASC,aAAaA,GAAG;EACvB,OAAOhB,UAAU,CAACnB,iBAAiB,CAAC,CAAA;AACtC,CAAA;AAqBA;AAA0C;AACpCoC,MAAAA,2BAAwD,GAAGC;;;;"}
1
+ {"version":3,"file":"FoundationStyledComponent.mjs","sources":["../../../src/foundation/FoundationStyledComponent.tsx"],"sourcesContent":["/**\n * NOTE:\n * 이 모듈은 Text, Icon 등 뿐 아니라 Colors, Elevation 등에서도 import 하고 있습니다.\n * 이로 인해 Colors(Elevation 등) -> ThemedStyledComponent -> Theme -> Colors(Elevation 등)\n * 의 Circular dependency 가 발생합니다.\n * 하지만 ThemedStyledComponent 에서 사용하는 Theme 은 단순한 interface 로\n * 동작에는 문제가 없으며, type checking 도 올바르게 됩니다.\n */\n\nimport React, {\n createContext,\n forwardRef,\n useContext,\n} from 'react'\n\nimport styled, {\n type AnyStyledComponent,\n type CSSObject,\n type FlattenInterpolation,\n type FlattenSimpleInterpolation,\n type GlobalStyleComponent,\n type Interpolation,\n type InterpolationFunction,\n ServerStyleSheet,\n type SimpleInterpolation,\n StyleSheetManager,\n type StyledComponentInnerAttrs,\n type StyledComponentInnerComponent,\n type StyledComponentInnerOtherProps,\n type StyledInterface,\n type ThemedStyledFunction,\n type ThemedStyledProps,\n css as baseCSS,\n createGlobalStyle as baseCreateGlobalStyle,\n keyframes,\n} from 'styled-components'\n\nimport { type Foundation } from './Foundation'\nimport domElements from './utils/domElements'\n\n/**\n * When interpreting the `.mjs` extension in the Next.js environment,\n * default imported `styled` function are not interpreted correctly.\n *\n * We add `.default` to cover situation where the module is interpreted in CJS.\n *\n * This is code that can be removed when the major version of `styled-components` is updated (v6)\n * and `styled` functions are changed to named import.\n *\n * @see https://github.com/rollup/rollup/issues/4438\n * @see https://github.com/styled-components/styled-components/issues/115\n */\n// @ts-expect-error\nconst safetyStyledInNextJs = (styled.default ?? styled) as StyledInterface\n\nconst FoundationContext = createContext<Foundation | null>(null)\n\ninterface FoundationProviderProps {\n foundation: Foundation\n children: React.ReactNode\n}\n\nfunction FoundationProvider({\n foundation,\n children,\n}: FoundationProviderProps) {\n return (\n <FoundationContext.Provider value={foundation}>\n { children }\n </FoundationContext.Provider>\n )\n}\n\n/**\n * NOTE:\n * styled component 는 theme Context 를 갖고 있습니다. 하지만 이 context 를 사용할때는 반드시 'theme' 이라는 이름으로밖에 접근할 수 없습니다.\n * Theme 이라는 용어는 내부적으로 이미 사용하고 있거니와, styled 의 theme 에 해당하는 개념에 Mondrian 은 Foundation 이라는 이름을 붙여주었습니다.\n * 이 괴리를 해소하기 위해 styled 함수를 wrapping 하고 커스텀 context 를 강제 주입합니다.\n * 아래의 interface, type 들은 타입체크 에러를 해소하기 위해 작성되었습니다. 제거 가능한 방법을 찾을 경우 가급적 제거하는 것이 필요합니다.\n */\n\ntype FoundationStyledComponentFactories = {\n [TTag in keyof JSX.IntrinsicElements]: ThemedStyledFunction<TTag, Foundation, { foundation?: Foundation }>\n}\n\ninterface FoundationStyledInterface extends FoundationStyledComponentFactories {\n <C extends AnyStyledComponent>(component: C): ThemedStyledFunction<\n StyledComponentInnerComponent<C>,\n Foundation,\n StyledComponentInnerOtherProps<C> & { foundation?: Foundation },\n StyledComponentInnerAttrs<C>\n >\n <C extends keyof JSX.IntrinsicElements | React.ComponentType<any>>(\n // unfortunately using a conditional type to validate that it can receive a `theme?: Theme`\n // causes tests to fail in TS 3.1\n component: C\n ): ThemedStyledFunction<C, Foundation, { foundation?: Foundation }>\n}\n\nfunction templateFunctionGenerator(BaseComponentGenerator: ThemedStyledFunction<any, any, object, string | number | symbol>) {\n const customTemplateFn = (...args: TemplateStringsArray) => {\n // @ts-ignore\n const BaseComponent = BaseComponentGenerator(...args)\n const BaseRefComponent = forwardRef((props, ref) => {\n const currentFoundation = useContext(FoundationContext)\n return (\n <BaseComponent\n ref={ref}\n key={args.toString()}\n foundation={currentFoundation}\n {...props}\n />\n )\n })\n BaseRefComponent.toString = BaseComponent.toString\n return BaseRefComponent\n }\n customTemplateFn.attrs = (attrs) => templateFunctionGenerator(BaseComponentGenerator.attrs(attrs))\n customTemplateFn.withConfig = (config) => templateFunctionGenerator(BaseComponentGenerator.withConfig(config))\n return customTemplateFn\n}\n\n/* eslint-disable-next-line func-names */ /* @ts-ignore */\nconst FoundationStyled: FoundationStyledInterface = (tag) => {\n const tagTemplate = safetyStyledInNextJs(tag)\n return templateFunctionGenerator(tagTemplate)\n};\n\n(domElements as Array<AnyStyledComponent>).forEach(element => {\n FoundationStyled[element] = FoundationStyled(element)\n})\n\ninterface FoundationCSSInterface {\n (\n first: TemplateStringsArray | CSSObject,\n ...interpolations: SimpleInterpolation[]\n ): FlattenSimpleInterpolation\n (\n first:\n | TemplateStringsArray\n | CSSObject\n | InterpolationFunction<ThemedStyledProps<{ foundation?: Foundation }, Foundation>>,\n ...interpolations: Array<Interpolation<ThemedStyledProps<{ foundation?: Foundation }, Foundation>>>\n ): FlattenInterpolation<ThemedStyledProps<{ foundation?: Foundation }, Foundation>>\n <P extends object>(\n first:\n | TemplateStringsArray\n | CSSObject\n | InterpolationFunction<ThemedStyledProps<P & { foundation?: Foundation }, Foundation>>,\n ...interpolations: Array<Interpolation<ThemedStyledProps<P & { foundation?: Foundation }, Foundation>>>\n ): FlattenInterpolation<ThemedStyledProps<P & { foundation?: Foundation }, Foundation>>\n}\n\n/* eslint-disable-next-line func-names */\nconst FoundationCSS: FoundationCSSInterface = baseCSS\n\nfunction useFoundation() {\n return useContext(FoundationContext)\n}\n\ntype GlobalStyleProp = {\n global?: CSSObject\n}\n\ntype FoundationWithGlobalStyle = Foundation & GlobalStyleProp\ninterface CreateFoundationGlobalStyle {\n <P extends object>(\n first:\n | TemplateStringsArray\n | CSSObject\n | InterpolationFunction<ThemedStyledProps<P & { foundation?: FoundationWithGlobalStyle }, Foundation>>,\n ...interpolations: Array<Interpolation<ThemedStyledProps<P & { foundation?: FoundationWithGlobalStyle }, Foundation>>>\n ): GlobalStyleComponent<\n // @ts-ignore\n P & { foundation: FoundationWithGlobalStyle },\n ThemedStyledProps<P & { foundation: FoundationWithGlobalStyle }, Foundation>\n >\n}\n\n/* eslint-disable-next-line func-names */ /* @ts-ignore */\nconst createFoundationGlobalStyle: CreateFoundationGlobalStyle = baseCreateGlobalStyle\n\nexport type {\n GlobalStyleProp,\n}\n\nexport {\n createFoundationGlobalStyle as createGlobalStyle,\n FoundationStyled as styled,\n FoundationCSS as css,\n FoundationProvider,\n useFoundation,\n keyframes,\n StyleSheetManager,\n ServerStyleSheet,\n}\n"],"names":["safetyStyledInNextJs","styled","default","FoundationContext","createContext","FoundationProvider","foundation","children","React","createElement","Provider","value","templateFunctionGenerator","BaseComponentGenerator","customTemplateFn","args","BaseComponent","BaseRefComponent","forwardRef","props","ref","currentFoundation","useContext","Object","assign","key","toString","attrs","withConfig","config","FoundationStyled","tag","tagTemplate","domElements","forEach","element","FoundationCSS","baseCSS","useFoundation","createFoundationGlobalStyle","baseCreateGlobalStyle"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAiCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,oBAAoB,GAAIC,MAAM,CAACC,OAAO,IAAID,MAA0B,CAAA;AAE1E,MAAME,iBAAiB,gBAAGC,aAAa,CAAoB,IAAI,CAAC,CAAA;AAOhE,SAASC,kBAAkBA,CAAC;EAC1BC,UAAU;AACVC,EAAAA,QAAAA;AACuB,CAAC,EAAE;AAC1B,EAAA,oBACEC,cAAA,CAAAC,aAAA,CAACN,iBAAiB,CAACO,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAEL,UAAAA;AAAW,GAAA,EAC1CC,QACwB,CAAC,CAAA;AAEjC,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA,SAASK,yBAAyBA,CAACC,sBAAwF,EAAE;AAC3H,EAAA,MAAMC,gBAAgB,GAAGA,CAAC,GAAGC,IAA0B,KAAK;AAC1D;AACA,IAAA,MAAMC,aAAa,GAAGH,sBAAsB,CAAC,GAAGE,IAAI,CAAC,CAAA;IACrD,MAAME,gBAAgB,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;AAClD,MAAA,MAAMC,iBAAiB,GAAGC,UAAU,CAACnB,iBAAiB,CAAC,CAAA;MACvD,oBACEK,cAAA,CAAAC,aAAA,CAACO,aAAa,EAAAO,MAAA,CAAAC,MAAA,CAAA;AACZJ,QAAAA,GAAG,EAAEA,GAAI;AACTK,QAAAA,GAAG,EAAEV,IAAI,CAACW,QAAQ,EAAG;AACrBpB,QAAAA,UAAU,EAAEe,iBAAAA;OACRF,EAAAA,KAAK,CACV,CAAC,CAAA;AAEN,KAAC,CAAC,CAAA;AACFF,IAAAA,gBAAgB,CAACS,QAAQ,GAAGV,aAAa,CAACU,QAAQ,CAAA;AAClD,IAAA,OAAOT,gBAAgB,CAAA;GACxB,CAAA;AACDH,EAAAA,gBAAgB,CAACa,KAAK,GAAIA,KAAK,IAAKf,yBAAyB,CAACC,sBAAsB,CAACc,KAAK,CAACA,KAAK,CAAC,CAAC,CAAA;AAClGb,EAAAA,gBAAgB,CAACc,UAAU,GAAIC,MAAM,IAAKjB,yBAAyB,CAACC,sBAAsB,CAACe,UAAU,CAACC,MAAM,CAAC,CAAC,CAAA;AAC9G,EAAA,OAAOf,gBAAgB,CAAA;AACzB,CAAA;;AAEA;AACMgB,MAAAA,gBAA2C,GAAIC,GAAG,IAAK;AAC3D,EAAA,MAAMC,WAAW,GAAGhC,oBAAoB,CAAC+B,GAAG,CAAC,CAAA;EAC7C,OAAOnB,yBAAyB,CAACoB,WAAW,CAAC,CAAA;AAC/C,EAAC;AAEAC,WAAW,CAA+BC,OAAO,CAACC,OAAO,IAAI;AAC5DL,EAAAA,gBAAgB,CAACK,OAAO,CAAC,GAAGL,gBAAgB,CAACK,OAAO,CAAC,CAAA;AACvD,CAAC,CAAC,CAAA;AAuBF;AACMC,MAAAA,aAAqC,GAAGC,IAAO;AAErD,SAASC,aAAaA,GAAG;EACvB,OAAOhB,UAAU,CAACnB,iBAAiB,CAAC,CAAA;AACtC,CAAA;AAqBA;AAA0C;AACpCoC,MAAAA,2BAAwD,GAAGC;;;;"}
@@ -81,7 +81,7 @@ const smoothCorners = ({
81
81
  border-radius: ${borderRadius};
82
82
  `}
83
83
 
84
- ${SmoothCornersFeature.activated && FoundationCSS`
84
+ ${SmoothCornersFeature.activated.get(globalThis) && FoundationCSS`
85
85
  @supports (background: paint(smooth-corners)) {
86
86
  padding: ${shadowBlur * 2}px;
87
87
  margin: ${-(shadowBlur * 2) + margin}px;
@@ -1 +1 @@
1
- {"version":3,"file":"Mixins.mjs","sources":["../../../src/foundation/Mixins.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\n\nimport type { SimpleInterpolation } from 'styled-components'\n\nimport { SmoothCornersFeature } from '~/src/features'\nimport { isNil } from '~/src/utils/typeUtils'\n\nimport { css } from './FoundationStyledComponent'\n\nexport const absoluteCenter = (otherTransforms?: SimpleInterpolation) => css`\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) ${otherTransforms};\n`\n\n// eslint-disable-next-line max-len\nexport const centeredBackgroundImage = <Type extends number | string>(...sizes: [Type] | [Type, Type]): ReturnType<typeof css> => {\n const [width, height = width] = sizes\n\n return css`\n background-image: var(--background-image);\n background-position: center;\n background-repeat: no-repeat;\n background-size: ${width}px, ${height}px;\n background-clip: content-box;\n `\n}\n\nexport const disableAutoMinimum = css`\n min-width: 0;\n min-height: 0;\n`\n\nexport const hideScrollbars = () => css`\n -ms-overflow-style: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n`\n\n/* line이 1이거나 undefined일때는 lineheight가 optional이지만, 1보다 큰 숫자일 경우 lineHeight를 명시하도록 합니다. */\ntype One = 1\nexport function ellipsis(line?: undefined, lineHeight?: undefined): ReturnType<typeof css>\nexport function ellipsis(line?: One, lineHeight?: undefined): ReturnType<typeof css>\nexport function ellipsis(line: number, lineHeight: number): ReturnType<typeof css>\nexport function ellipsis(line?: number, lineHeight?: number): ReturnType<typeof css> {\n if (isNil(line) || line <= 1) {\n return css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `\n }\n\n if (isNil(lineHeight)) {\n // eslint-disable-next-line no-console\n console.warn('lineHeight required')\n return css``\n }\n\n /* stylelint-disable value-no-vendor-prefix, property-no-vendor-prefix */\n return css`\n display: -webkit-box;\n max-height: ${(line * lineHeight)}rem;\n overflow: hidden;\n line-height: ${lineHeight}rem;\n text-overflow: ellipsis;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: ${line};\n `\n /* stylelint-enable value-no-vendor-prefix, property-no-vendor-prefix */\n}\n\ninterface SmoothCornersOptions {\n borderRadius?: number | string\n shadow?: string\n backgroundColor?: string\n hasBackgroundImage?: boolean\n shadowBlur?: number\n margin?: number\n}\n\nexport const smoothCorners = ({\n borderRadius = 0,\n shadow = '0 0 0 0 transparent',\n backgroundColor = 'white',\n hasBackgroundImage = false,\n shadowBlur = 0,\n margin = 0,\n}: SmoothCornersOptions) => css`\n margin: ${margin}px;\n background-color: ${backgroundColor};\n\n ${hasBackgroundImage && css`\n background-image: var(--background-image);\n background-size: cover;\n `}\n\n ${borderRadius && css`\n border-radius: ${borderRadius};\n `}\n\n ${SmoothCornersFeature.activated && css`\n @supports (background: paint(smooth-corners)) {\n padding: ${shadowBlur * 2}px;\n margin: ${-(shadowBlur * 2) + margin}px;\n background: paint(smooth-corners);\n border-radius: 0;\n /* Custom property 는 CSSUnparsedValue 로만 잡혀서 사용하는 임시 속성 */\n box-shadow: none;\n\n ${hasBackgroundImage && css`\n border-image-source: var(--background-image);\n `}\n\n --smooth-corners: ${borderRadius};\n --smooth-corners-shadow: ${shadow};\n --smooth-corners-bg-color: ${backgroundColor};\n --smooth-corners-padding: ${shadowBlur * 2};\n --smooth-corners-radius-unit: ${typeof borderRadius === 'string' ? 'string' : 'number'};\n }\n `}\n`\n\ninterface BackgroundImageVariableOptions {\n imageUrl: string\n}\n\nexport const backgroundImageVariable = ({ imageUrl }: BackgroundImageVariableOptions): CSSProperties => ({\n // @ts-ignore\n '--background-image': `url(${imageUrl})`,\n})\n"],"names":["absoluteCenter","otherTransforms","css","centeredBackgroundImage","sizes","width","height","disableAutoMinimum","hideScrollbars","ellipsis","line","lineHeight","isNil","console","warn","smoothCorners","borderRadius","shadow","backgroundColor","hasBackgroundImage","shadowBlur","margin","SmoothCornersFeature","activated","backgroundImageVariable","imageUrl"],"mappings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,EAAAA,eAAe,GAAG,OAAO;AACzBC,EAAAA,kBAAkB,GAAG,KAAK;AAC1BC,EAAAA,UAAU,GAAG,CAAC;AACdC,EAAAA,MAAM,GAAG,CAAA;AACW,CAAC,KAAKnB,aAAI,CAAA;AAChC,UAAA,EAAYmB,MAAO,CAAA;AACnB,oBAAA,EAAsBH,eAAgB,CAAA;AACtC;AACA,EAAIC,EAAAA,kBAAkB,IAAIjB,aAAI,CAAA;AAC9B;AACA;AACA,EAAI,CAAA,CAAA;AACJ;AACA,EAAIc,EAAAA,YAAY,IAAId,aAAI,CAAA;AACxB,mBAAA,EAAqBc,YAAa,CAAA;AAClC,EAAI,CAAA,CAAA;AACJ;AACA,EAAA,EAAIM,oBAAoB,CAACC,SAAS,IAAIrB,aAAI,CAAA;AAC1C;AACA,eAAiBkB,EAAAA,UAAU,GAAG,CAAE,CAAA;AAChC,cAAA,EAAgB,EAAEA,UAAU,GAAG,CAAC,CAAC,GAAGC,MAAO,CAAA;AAC3C;AACA;AACA;AACA;AACA;AACA,MAAQF,EAAAA,kBAAkB,IAAIjB,aAAI,CAAA;AAClC;AACA,MAAQ,CAAA,CAAA;AACR;AACA,wBAAA,EAA0Bc,YAAa,CAAA;AACvC,+BAAA,EAAiCC,MAAO,CAAA;AACxC,iCAAA,EAAmCC,eAAgB,CAAA;AACnD,gCAAkCE,EAAAA,UAAU,GAAG,CAAE,CAAA;AACjD,oCAAA,EAAsC,OAAOJ,YAAY,KAAK,QAAQ,GAAG,QAAQ,GAAG,QAAS,CAAA;AAC7F;AACA,EAAI,CAAA,CAAA;AACJ,EAAC;AAMM,MAAMQ,uBAAuB,GAAGA,CAAC;AAAEC,EAAAA,QAAAA;AAAyC,CAAC,MAAqB;AACvG;EACA,oBAAoB,EAAG,OAAMA,QAAS,CAAA,CAAA,CAAA;AACxC,CAAC;;;;"}
1
+ {"version":3,"file":"Mixins.mjs","sources":["../../../src/foundation/Mixins.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\n\nimport type { SimpleInterpolation } from 'styled-components'\n\nimport { SmoothCornersFeature } from '~/src/features'\nimport { isNil } from '~/src/utils/typeUtils'\n\nimport { css } from './FoundationStyledComponent'\n\nexport const absoluteCenter = (otherTransforms?: SimpleInterpolation) => css`\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) ${otherTransforms};\n`\n\n// eslint-disable-next-line max-len\nexport const centeredBackgroundImage = <Type extends number | string>(...sizes: [Type] | [Type, Type]): ReturnType<typeof css> => {\n const [width, height = width] = sizes\n\n return css`\n background-image: var(--background-image);\n background-position: center;\n background-repeat: no-repeat;\n background-size: ${width}px, ${height}px;\n background-clip: content-box;\n `\n}\n\nexport const disableAutoMinimum = css`\n min-width: 0;\n min-height: 0;\n`\n\nexport const hideScrollbars = () => css`\n -ms-overflow-style: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n`\n\n/* line이 1이거나 undefined일때는 lineheight가 optional이지만, 1보다 큰 숫자일 경우 lineHeight를 명시하도록 합니다. */\ntype One = 1\nexport function ellipsis(line?: undefined, lineHeight?: undefined): ReturnType<typeof css>\nexport function ellipsis(line?: One, lineHeight?: undefined): ReturnType<typeof css>\nexport function ellipsis(line: number, lineHeight: number): ReturnType<typeof css>\nexport function ellipsis(line?: number, lineHeight?: number): ReturnType<typeof css> {\n if (isNil(line) || line <= 1) {\n return css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `\n }\n\n if (isNil(lineHeight)) {\n // eslint-disable-next-line no-console\n console.warn('lineHeight required')\n return css``\n }\n\n /* stylelint-disable value-no-vendor-prefix, property-no-vendor-prefix */\n return css`\n display: -webkit-box;\n max-height: ${(line * lineHeight)}rem;\n overflow: hidden;\n line-height: ${lineHeight}rem;\n text-overflow: ellipsis;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: ${line};\n `\n /* stylelint-enable value-no-vendor-prefix, property-no-vendor-prefix */\n}\n\ninterface SmoothCornersOptions {\n borderRadius?: number | string\n shadow?: string\n backgroundColor?: string\n hasBackgroundImage?: boolean\n shadowBlur?: number\n margin?: number\n}\n\nexport const smoothCorners = ({\n borderRadius = 0,\n shadow = '0 0 0 0 transparent',\n backgroundColor = 'white',\n hasBackgroundImage = false,\n shadowBlur = 0,\n margin = 0,\n}: SmoothCornersOptions) => css`\n margin: ${margin}px;\n background-color: ${backgroundColor};\n\n ${hasBackgroundImage && css`\n background-image: var(--background-image);\n background-size: cover;\n `}\n\n ${borderRadius && css`\n border-radius: ${borderRadius};\n `}\n\n ${SmoothCornersFeature.activated.get(globalThis) && css`\n @supports (background: paint(smooth-corners)) {\n padding: ${shadowBlur * 2}px;\n margin: ${-(shadowBlur * 2) + margin}px;\n background: paint(smooth-corners);\n border-radius: 0;\n /* Custom property 는 CSSUnparsedValue 로만 잡혀서 사용하는 임시 속성 */\n box-shadow: none;\n\n ${hasBackgroundImage && css`\n border-image-source: var(--background-image);\n `}\n\n --smooth-corners: ${borderRadius};\n --smooth-corners-shadow: ${shadow};\n --smooth-corners-bg-color: ${backgroundColor};\n --smooth-corners-padding: ${shadowBlur * 2};\n --smooth-corners-radius-unit: ${typeof borderRadius === 'string' ? 'string' : 'number'};\n }\n `}\n`\n\ninterface BackgroundImageVariableOptions {\n imageUrl: string\n}\n\nexport const backgroundImageVariable = ({ imageUrl }: BackgroundImageVariableOptions): CSSProperties => ({\n // @ts-ignore\n '--background-image': `url(${imageUrl})`,\n})\n"],"names":["absoluteCenter","otherTransforms","css","centeredBackgroundImage","sizes","width","height","disableAutoMinimum","hideScrollbars","ellipsis","line","lineHeight","isNil","console","warn","smoothCorners","borderRadius","shadow","backgroundColor","hasBackgroundImage","shadowBlur","margin","SmoothCornersFeature","activated","get","globalThis","backgroundImageVariable","imageUrl"],"mappings":";;;;AASaA,MAAAA,cAAc,GAAIC,eAAqC,IAAKC,aAAI,CAAA;AAC7E;AACA;AACA;AACA,mCAAA,EAAqCD,eAAgB,CAAA;AACrD,EAAC;;AAED;MACaE,uBAAuB,GAAGA,CAA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AAA;AAChC,UAAA,EAAYmB,MAAO,CAAA;AACnB,oBAAA,EAAsBH,eAAgB,CAAA;AACtC;AACA,EAAIC,EAAAA,kBAAkB,IAAIjB,aAAI,CAAA;AAC9B;AACA;AACA,EAAI,CAAA,CAAA;AACJ;AACA,EAAIc,EAAAA,YAAY,IAAId,aAAI,CAAA;AACxB,mBAAA,EAAqBc,YAAa,CAAA;AAClC,EAAI,CAAA,CAAA;AACJ;AACA,EAAIM,EAAAA,oBAAoB,CAACC,SAAS,CAACC,GAAG,CAACC,UAAU,CAAC,IAAIvB,aAAI,CAAA;AAC1D;AACA,eAAiBkB,EAAAA,UAAU,GAAG,CAAE,CAAA;AAChC,cAAA,EAAgB,EAAEA,UAAU,GAAG,CAAC,CAAC,GAAGC,MAAO,CAAA;AAC3C;AACA;AACA;AACA;AACA;AACA,MAAQF,EAAAA,kBAAkB,IAAIjB,aAAI,CAAA;AAClC;AACA,MAAQ,CAAA,CAAA;AACR;AACA,wBAAA,EAA0Bc,YAAa,CAAA;AACvC,+BAAA,EAAiCC,MAAO,CAAA;AACxC,iCAAA,EAAmCC,eAAgB,CAAA;AACnD,gCAAkCE,EAAAA,UAAU,GAAG,CAAE,CAAA;AACjD,oCAAA,EAAsC,OAAOJ,YAAY,KAAK,QAAQ,GAAG,QAAQ,GAAG,QAAS,CAAA;AAC7F;AACA,EAAI,CAAA,CAAA;AACJ,EAAC;AAMM,MAAMU,uBAAuB,GAAGA,CAAC;AAAEC,EAAAA,QAAAA;AAAyC,CAAC,MAAqB;AACvG;EACA,oBAAoB,EAAG,OAAMA,QAAS,CAAA,CAAA,CAAA;AACxC,CAAC;;;;"}
@@ -25,7 +25,7 @@ export { absoluteCenter, backgroundImageVariable, centeredBackgroundImage, disab
25
25
  export { ThemeVars } from './foundation/ThemeVars.mjs';
26
26
  export { GlobalStyle } from './foundation/GlobalStyle.mjs';
27
27
  export { FoundationProvider, createGlobalStyle, css, styled, useFoundation } from './foundation/FoundationStyledComponent.mjs';
28
- export { ServerStyleSheet, keyframes } from 'styled-components';
28
+ export { ServerStyleSheet, StyleSheetManager, keyframes } from 'styled-components';
29
29
  export { AutoFocus } from './components/AutoFocus/AutoFocus.mjs';
30
30
  export { Avatar } from './components/Avatars/Avatar/Avatar.mjs';
31
31
  export { AvatarSize } from './components/Avatars/Avatar/Avatar.types.mjs';
@@ -10,7 +10,7 @@ for (let i = 0; i < 256; ++i) {
10
10
  function unsafeStringify(arr, offset = 0) {
11
11
  // Note: Be careful editing this code! It's been tuned for performance
12
12
  // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
13
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
13
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
14
14
  }
15
15
 
16
16
  export { unsafeStringify };
@@ -1 +1 @@
1
- {"version":3,"file":"stringify.mjs","sources":["../../../../../../../../node_modules/uuid/dist/esm-browser/stringify.js"],"sourcesContent":["import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;"],"names":["byteToHex","i","push","toString","slice","unsafeStringify","arr","offset","toLowerCase"],"mappings":"AACA;AACA;AACA;AACA;;AAEA,MAAMA,SAAS,GAAG,EAAE,CAAA;AAEpB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,GAAG,EAAE,EAAEA,CAAC,EAAE;AAC5BD,EAAAA,SAAS,CAACE,IAAI,CAAC,CAACD,CAAC,GAAG,KAAK,EAAEE,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AACnD,CAAA;AAEO,SAASC,eAAeA,CAACC,GAAG,EAAEC,MAAM,GAAG,CAAC,EAAE;AAC/C;AACA;AACA,EAAA,OAAO,CAACP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,GAAGP,SAAS,CAACM,GAAG,CAACC,MAAM,GAAG,EAAE,CAAC,CAAC,EAAEC,WAAW,EAAE,CAAA;AACpgB;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"stringify.mjs","sources":["../../../../../../../../node_modules/uuid/dist/esm-browser/stringify.js"],"sourcesContent":["import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;"],"names":["byteToHex","i","push","toString","slice","unsafeStringify","arr","offset"],"mappings":"AACA;AACA;AACA;AACA;;AAEA,MAAMA,SAAS,GAAG,EAAE,CAAA;AAEpB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,GAAG,EAAE,EAAEA,CAAC,EAAE;AAC5BD,EAAAA,SAAS,CAACE,IAAI,CAAC,CAACD,CAAC,GAAG,KAAK,EAAEE,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AACnD,CAA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declare class Feature {
5
- name: FeatureType;
6
- constructor(name: FeatureType);
7
- activate(): Promise<boolean>;
4
+ export interface Feature {
5
+ readonly name: FeatureType;
6
+ activate: () => Promise<boolean>;
8
7
  }
9
8
  //# sourceMappingURL=Feature.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Feature.d.ts","sourceRoot":"","sources":["../../../src/features/Feature.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,aAAa,mBAAmB;CACjC;AAED,qBAAa,OAAO;IAClB,IAAI,EAAE,WAAW,CAAA;gBAEL,IAAI,EAAE,WAAW;IAIvB,QAAQ;CAGf"}
1
+ {"version":3,"file":"Feature.d.ts","sourceRoot":"","sources":["../../../src/features/Feature.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,aAAa,mBAAmB;CACjC;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;CACjC"}
@@ -1,17 +1,40 @@
1
- import { Feature } from '../Feature';
1
+ import { type Feature, FeatureType } from '../Feature';
2
+ /**
3
+ * @see {@link https://fetch.spec.whatwg.org/#requestcredentials}
4
+ */
5
+ type RequestCredentials = 'omit' | 'same-origin' | 'include';
6
+ type WorkletOptions = {
7
+ credentials: RequestCredentials;
8
+ };
9
+ /**
10
+ * @see {@link https://html.spec.whatwg.org/multipage/worklets.html#worklets-worklet}
11
+ */
12
+ interface Worklet {
13
+ addModule: (moduleURL: string, options?: WorkletOptions) => Promise<void>;
14
+ }
15
+ declare global {
16
+ namespace CSS {
17
+ const paintWorklet: Worklet;
18
+ }
19
+ }
2
20
  /**
3
21
  * 🚨 This is an experimental feature! It may not be suitable for use in production.
4
22
  *
5
23
  * Instead of CSS border-radius, Use *Superellipse* masking using the CSS Houdini API.
6
24
  * When enabled, the feature will be applied to components with the `smoothCorners` property set to `true`.
7
25
  */
8
- declare class SmoothCornersFeature extends Feature {
26
+ declare class SmoothCornersFeature implements Feature {
27
+ readonly name = FeatureType.SmoothCorners;
28
+ private globalObject;
9
29
  /**
10
30
  * @deprecated (@ed) Upcoming improvements
11
31
  * Changed to private property, and will be referenced via the useFeatureFlag context rather than directly externally.
12
32
  */
13
- activated: boolean;
14
- activate(): Promise<boolean>;
33
+ activated: WeakMap<typeof globalThis, boolean>;
34
+ private updateCurrentGlobalObject;
35
+ private isGlobalObjectIdentical;
36
+ private supportCSSPaintWorklet;
37
+ activate(globalObject?: typeof globalThis): Promise<boolean>;
15
38
  }
16
39
  declare const _default: SmoothCornersFeature;
17
40
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"SmoothCornersFeature.d.ts","sourceRoot":"","sources":["../../../../src/features/SmoothCornersFeature/SmoothCornersFeature.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EAER,MAAM,YAAY,CAAA;AAInB;;;;;GAKG;AACH,cAAM,oBAAqB,SAAQ,OAAO;IACxC;;;OAGG;IACH,SAAS,UAAQ;IAEX,QAAQ;CAyBf;;AAED,wBAAkE"}
1
+ {"version":3,"file":"SmoothCornersFeature.d.ts","sourceRoot":"","sources":["../../../../src/features/SmoothCornersFeature/SmoothCornersFeature.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EACZ,WAAW,EACZ,MAAM,YAAY,CAAA;AAInB;;GAEG;AACH,KAAK,kBAAkB,GAAG,MAAM,GAAG,aAAa,GAAG,SAAS,CAAA;AAE5D,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,kBAAkB,CAAA;CAChC,CAAA;AAED;;GAEG;AACH,UAAU,OAAO;IACf,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1E;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACL,MAAM,YAAY,EAAE,OAAO,CAAA;KACnC;CACF;AAED;;;;;GAKG;AACH,cAAM,oBAAqB,YAAW,OAAO;IAC3C,QAAQ,CAAC,IAAI,6BAA4B;IAEzC,OAAO,CAAC,YAAY,CAAiC;IAErD;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC,OAAO,UAAU,EAAE,OAAO,CAAC,CAAqC;IAEnF,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,sBAAsB;IAIxB,QAAQ,CAAC,YAAY,GAAE,OAAO,UAAuB;CAkB5D;;AAED,wBAAyC"}
@@ -7,7 +7,7 @@
7
7
  * 동작에는 문제가 없으며, type checking 도 올바르게 됩니다.
8
8
  */
9
9
  import React from 'react';
10
- import { type AnyStyledComponent, type CSSObject, type FlattenInterpolation, type FlattenSimpleInterpolation, type GlobalStyleComponent, type Interpolation, type InterpolationFunction, ServerStyleSheet, type SimpleInterpolation, type StyledComponentInnerAttrs, type StyledComponentInnerComponent, type StyledComponentInnerOtherProps, type ThemedStyledFunction, type ThemedStyledProps, keyframes } from 'styled-components';
10
+ import { type AnyStyledComponent, type CSSObject, type FlattenInterpolation, type FlattenSimpleInterpolation, type GlobalStyleComponent, type Interpolation, type InterpolationFunction, ServerStyleSheet, type SimpleInterpolation, StyleSheetManager, type StyledComponentInnerAttrs, type StyledComponentInnerComponent, type StyledComponentInnerOtherProps, type ThemedStyledFunction, type ThemedStyledProps, keyframes } from 'styled-components';
11
11
  import { type Foundation } from './Foundation';
12
12
  interface FoundationProviderProps {
13
13
  foundation: Foundation;
@@ -71,5 +71,5 @@ interface CreateFoundationGlobalStyle {
71
71
  }
72
72
  declare const createFoundationGlobalStyle: CreateFoundationGlobalStyle;
73
73
  export type { GlobalStyleProp, };
74
- export { createFoundationGlobalStyle as createGlobalStyle, FoundationStyled as styled, FoundationCSS as css, FoundationProvider, useFoundation, keyframes, ServerStyleSheet, };
74
+ export { createFoundationGlobalStyle as createGlobalStyle, FoundationStyled as styled, FoundationCSS as css, FoundationProvider, useFoundation, keyframes, StyleSheetManager, ServerStyleSheet, };
75
75
  //# sourceMappingURL=FoundationStyledComponent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FoundationStyledComponent.d.ts","sourceRoot":"","sources":["../../../src/foundation/FoundationStyledComponent.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAIN,MAAM,OAAO,CAAA;AAEd,OAAe,EACb,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EAEnC,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EAGtB,SAAS,EACV,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAoB9C,UAAU,uBAAuB;IAC/B,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,iBAAS,kBAAkB,CAAC,EAC1B,UAAU,EACV,QAAQ,GACT,EAAE,uBAAuB,qBAMzB;AAED;;;;;;GAMG;AAEH,KAAK,kCAAkC,GAAG;KACvC,IAAI,IAAI,MAAM,GAAG,CAAC,iBAAiB,GAAG,oBAAoB,CAAC,IAAI,EAAE,UAAU,EAAE;QAAE,UAAU,CAAC,EAAE,UAAU,CAAA;KAAE,CAAC;CAC3G,CAAA;AAED,UAAU,yBAA0B,SAAQ,kCAAkC;IAC5E,CAAC,CAAC,SAAS,kBAAkB,EAAE,SAAS,EAAE,CAAC,GAAG,oBAAoB,CAClE,6BAA6B,CAAC,CAAC,CAAC,EAChC,UAAU,EACV,8BAA8B,CAAC,CAAC,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,UAAU,CAAA;KAAE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;KAAE,EAAE,UAAU,CAAC,CAAC,CAAA;CACxF;AAGD,QAAA,MAAM,aAAa,EAAE,sBAAgC,CAAA;AAErD,iBAAS,aAAa,sBAErB;AAED,KAAK,eAAe,GAAG;IACrB,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB,CAAA;AAED,KAAK,yBAAyB,GAAG,UAAU,GAAG,eAAe,CAAA;AAC7D,UAAU,2BAA2B;IACnC,CAAC,CAAC,SAAS,MAAM,EACf,KAAK,EACH,oBAAoB,GACpB,SAAS,GACT,qBAAqB,CAAC,iBAAiB,CAAC,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,yBAAyB,CAAA;KAAE,EAAE,UAAU,CAAC,CAAC,EACtG,GAAG,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,yBAAyB,CAAA;KAAE,EAAE,UAAU,CAAC,CAAC,CAAC,GACrH,oBAAoB,CAEvB,CAAC,GAAG;QAAE,UAAU,EAAE,yBAAyB,CAAA;KAAE,EAC7C,iBAAiB,CAAC,CAAC,GAAG;QAAE,UAAU,EAAE,yBAAyB,CAAA;KAAE,EAAE,UAAU,CAAC,CAC3E,CAAA;CACF;AAGD,QAAA,MAAM,2BAA2B,EAAE,2BAAmD,CAAA;AAEtF,YAAY,EACV,eAAe,GAChB,CAAA;AAED,OAAO,EACL,2BAA2B,IAAI,iBAAiB,EAChD,gBAAgB,IAAI,MAAM,EAC1B,aAAa,IAAI,GAAG,EACpB,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,gBAAgB,GACjB,CAAA"}
1
+ {"version":3,"file":"FoundationStyledComponent.d.ts","sourceRoot":"","sources":["../../../src/foundation/FoundationStyledComponent.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAIN,MAAM,OAAO,CAAA;AAEd,OAAe,EACb,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KA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BAAoB,GACpB,SAAS,GACT,qBAAqB,CAAC,iBAAiB,CAAC,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,yBAAyB,CAAA;KAAE,EAAE,UAAU,CAAC,CAAC,EACtG,GAAG,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,yBAAyB,CAAA;KAAE,EAAE,UAAU,CAAC,CAAC,CAAC,GACrH,oBAAoB,CAEvB,CAAC,GAAG;QAAE,UAAU,EAAE,yBAAyB,CAAA;KAAE,EAC7C,iBAAiB,CAAC,CAAC,GAAG;QAAE,UAAU,EAAE,yBAAyB,CAAA;KAAE,EAAE,UAAU,CAAC,CAC3E,CAAA;CACF;AAGD,QAAA,MAAM,2BAA2B,EAAE,2BAAmD,CAAA;AAEtF,YAAY,EACV,eAAe,GAChB,CAAA;AAED,OAAO,EACL,2BAA2B,IAAI,iBAAiB,EAChD,gBAAgB,IAAI,MAAM,EAC1B,aAAa,IAAI,GAAG,EACpB,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,gBAAgB,GACjB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@channel.io/bezier-react",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "description": "React components library that implements Bezier design system.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -63,7 +63,7 @@
63
63
  "@babel/preset-env": "^7.22.15",
64
64
  "@babel/preset-react": "^7.22.15",
65
65
  "@babel/preset-typescript": "^7.22.15",
66
- "@channel.io/bezier-icons": "^0.11.0",
66
+ "@channel.io/bezier-icons": "^0.12.0",
67
67
  "@mdx-js/react": "^1.6.22",
68
68
  "@rollup/plugin-alias": "^5.0.0",
69
69
  "@rollup/plugin-babel": "^6.0.3",
@@ -94,7 +94,7 @@
94
94
  "babel-loader": "^9.1.3",
95
95
  "babel-plugin-styled-components": "^2.1.4",
96
96
  "babel-preset-react-app": "^10.0.1",
97
- "chromatic": "^6.24.1",
97
+ "chromatic": "^7.0.0",
98
98
  "core-js": "^3.32.2",
99
99
  "eslint-config-bezier": "workspace:*",
100
100
  "eslint-plugin-storybook": "^0.6.13",
@@ -2,14 +2,7 @@ export enum FeatureType {
2
2
  SmoothCorners = 'smooth-corners',
3
3
  }
4
4
 
5
- export class Feature {
6
- name: FeatureType
7
-
8
- constructor(name: FeatureType) {
9
- this.name = name
10
- }
11
-
12
- async activate() {
13
- return Promise.resolve(false)
14
- }
5
+ export interface Feature {
6
+ readonly name: FeatureType
7
+ activate: () => Promise<boolean>
15
8
  }
@@ -1,49 +1,80 @@
1
1
  // eslint-disable-next-line no-restricted-imports
2
2
  import {
3
- Feature,
3
+ type Feature,
4
4
  FeatureType,
5
5
  } from '../Feature'
6
6
 
7
7
  import { smoothCornersScript } from './smoothCornersScript'
8
8
 
9
+ /**
10
+ * @see {@link https://fetch.spec.whatwg.org/#requestcredentials}
11
+ */
12
+ type RequestCredentials = 'omit' | 'same-origin' | 'include'
13
+
14
+ type WorkletOptions = {
15
+ credentials: RequestCredentials
16
+ }
17
+
18
+ /**
19
+ * @see {@link https://html.spec.whatwg.org/multipage/worklets.html#worklets-worklet}
20
+ */
21
+ interface Worklet {
22
+ addModule: (moduleURL: string, options?: WorkletOptions) => Promise<void>
23
+ }
24
+
25
+ declare global {
26
+ namespace CSS {
27
+ export const paintWorklet: Worklet
28
+ }
29
+ }
30
+
9
31
  /**
10
32
  * 🚨 This is an experimental feature! It may not be suitable for use in production.
11
33
  *
12
34
  * Instead of CSS border-radius, Use *Superellipse* masking using the CSS Houdini API.
13
35
  * When enabled, the feature will be applied to components with the `smoothCorners` property set to `true`.
14
36
  */
15
- class SmoothCornersFeature extends Feature {
37
+ class SmoothCornersFeature implements Feature {
38
+ readonly name = FeatureType.SmoothCorners
39
+
40
+ private globalObject: typeof globalThis | null = null
41
+
16
42
  /**
17
43
  * @deprecated (@ed) Upcoming improvements
18
44
  * Changed to private property, and will be referenced via the useFeatureFlag context rather than directly externally.
19
45
  */
20
- activated = false
21
-
22
- async activate() {
23
- if (
24
- !this.activated
25
- && typeof CSS !== 'undefined'
26
- && 'paintWorklet' in CSS
27
- ) {
46
+ activated: WeakMap<typeof globalThis, boolean> = new WeakMap([[globalThis, false]])
47
+
48
+ private updateCurrentGlobalObject(globalObject: typeof globalThis) {
49
+ this.globalObject = globalObject
50
+ }
51
+
52
+ private isGlobalObjectIdentical(globalObject: typeof globalThis) {
53
+ return Object.is(this.globalObject, globalObject)
54
+ }
55
+
56
+ private supportCSSPaintWorklet(globalObject: typeof globalThis) {
57
+ return typeof globalObject.CSS !== 'undefined' && 'paintWorklet' in globalObject.CSS
58
+ }
59
+
60
+ async activate(globalObject: typeof globalThis = globalThis) {
61
+ if (!this.isGlobalObjectIdentical(globalObject) && this.supportCSSPaintWorklet(globalObject)) {
28
62
  const workletURL = URL.createObjectURL(
29
63
  new Blob([smoothCornersScript], { type: 'application/javascript' }),
30
64
  )
31
65
 
32
- // @ts-ignore
33
- const promise = CSS.paintWorklet.addModule(workletURL) as Promise<void>
34
-
35
- return promise
36
- .then(() => {
37
- this.activated = true
38
- return this.activated
39
- }).catch(() => {
40
- this.activated = false
41
- return this.activated
42
- })
66
+ try {
67
+ await globalObject.CSS.paintWorklet.addModule(workletURL)
68
+ this.activated.set(globalObject, true)
69
+ } catch {
70
+ this.activated.set(globalObject, false)
71
+ }
43
72
  }
44
73
 
45
- return this.activated
74
+ this.updateCurrentGlobalObject(globalObject)
75
+
76
+ return this.activated.get(globalObject) as boolean
46
77
  }
47
78
  }
48
79
 
49
- export default new SmoothCornersFeature(FeatureType.SmoothCorners)
80
+ export default new SmoothCornersFeature()
@@ -0,0 +1,34 @@
1
+ import SmoothCornersFeature from './SmoothCornersFeature'
2
+
3
+ describe('SmoothCornersFeature', () => {
4
+ let addModule: jest.Mock
5
+
6
+ beforeEach(() => {
7
+ addModule = jest.fn(() => Promise.resolve())
8
+
9
+ Object.defineProperty(global, 'URL', {
10
+ value: {
11
+ createObjectURL: jest.fn(),
12
+ },
13
+ })
14
+
15
+ Object.defineProperty(global, 'CSS', {
16
+ value: {
17
+ paintWorklet: { addModule },
18
+ },
19
+ })
20
+ })
21
+
22
+ it('If the global objects are the same, activate should only be executed once.', async () => {
23
+ await SmoothCornersFeature.activate(globalThis)
24
+ await SmoothCornersFeature.activate(globalThis)
25
+ expect(addModule).toHaveBeenCalledTimes(1)
26
+ })
27
+
28
+ it('If the global object has changed, activate should be executed again.', async () => {
29
+ await SmoothCornersFeature.activate(globalThis)
30
+ expect(addModule).toHaveBeenCalledTimes(0)
31
+ await SmoothCornersFeature.activate({ ...globalThis })
32
+ expect(addModule).toHaveBeenCalledTimes(1)
33
+ })
34
+ })
@@ -23,6 +23,7 @@ import styled, {
23
23
  type InterpolationFunction,
24
24
  ServerStyleSheet,
25
25
  type SimpleInterpolation,
26
+ StyleSheetManager,
26
27
  type StyledComponentInnerAttrs,
27
28
  type StyledComponentInnerComponent,
28
29
  type StyledComponentInnerOtherProps,
@@ -190,5 +191,6 @@ export {
190
191
  FoundationProvider,
191
192
  useFoundation,
192
193
  keyframes,
194
+ StyleSheetManager,
193
195
  ServerStyleSheet,
194
196
  }
@@ -102,7 +102,7 @@ export const smoothCorners = ({
102
102
  border-radius: ${borderRadius};
103
103
  `}
104
104
 
105
- ${SmoothCornersFeature.activated && css`
105
+ ${SmoothCornersFeature.activated.get(globalThis) && css`
106
106
  @supports (background: paint(smooth-corners)) {
107
107
  padding: ${shadowBlur * 2}px;
108
108
  margin: ${-(shadowBlur * 2) + margin}px;