@oxyhq/bloom 0.87.1 → 0.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js +7 -12
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/commonjs/button/Button.web.js +2 -6
- package/lib/commonjs/button/Button.web.js.map +1 -1
- package/lib/commonjs/connection-dots/ConnectionDots.web.js +2 -6
- package/lib/commonjs/connection-dots/ConnectionDots.web.js.map +1 -1
- package/lib/commonjs/design-tokens/index.js +19 -0
- package/lib/commonjs/design-tokens/index.js.map +1 -1
- package/lib/commonjs/design-tokens/tokens-json.js +149 -0
- package/lib/commonjs/design-tokens/tokens-json.js.map +1 -0
- package/lib/commonjs/design-tokens/tokens.json +6681 -0
- package/lib/commonjs/dialog/Dialog.web.js +2 -6
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/fab/Fab.web.js +2 -6
- package/lib/commonjs/fab/Fab.web.js.map +1 -1
- package/lib/commonjs/fonts/apply-font-faces.web.js +8 -10
- package/lib/commonjs/fonts/apply-font-faces.web.js.map +1 -1
- package/lib/commonjs/frosted-icon-button/FrostedIconButton.web.js +2 -6
- package/lib/commonjs/frosted-icon-button/FrostedIconButton.web.js.map +1 -1
- package/lib/commonjs/loading/SpinnerIcon.web.js +2 -6
- package/lib/commonjs/loading/SpinnerIcon.web.js.map +1 -1
- package/lib/commonjs/styles/adopt-style-sheet.js +126 -0
- package/lib/commonjs/styles/adopt-style-sheet.js.map +1 -0
- package/lib/module/bottom-sheet/BottomSheetBase.js +7 -12
- package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/module/button/Button.web.js +2 -6
- package/lib/module/button/Button.web.js.map +1 -1
- package/lib/module/connection-dots/ConnectionDots.web.js +2 -6
- package/lib/module/connection-dots/ConnectionDots.web.js.map +1 -1
- package/lib/module/design-tokens/index.js +5 -0
- package/lib/module/design-tokens/index.js.map +1 -1
- package/lib/module/design-tokens/tokens-json.js +144 -0
- package/lib/module/design-tokens/tokens-json.js.map +1 -0
- package/lib/module/design-tokens/tokens.json +6681 -0
- package/lib/module/dialog/Dialog.web.js +2 -6
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/fab/Fab.web.js +2 -6
- package/lib/module/fab/Fab.web.js.map +1 -1
- package/lib/module/fonts/apply-font-faces.web.js +8 -10
- package/lib/module/fonts/apply-font-faces.web.js.map +1 -1
- package/lib/module/frosted-icon-button/FrostedIconButton.web.js +2 -6
- package/lib/module/frosted-icon-button/FrostedIconButton.web.js.map +1 -1
- package/lib/module/loading/SpinnerIcon.web.js +2 -6
- package/lib/module/loading/SpinnerIcon.web.js.map +1 -1
- package/lib/module/styles/adopt-style-sheet.js +121 -0
- package/lib/module/styles/adopt-style-sheet.js.map +1 -0
- package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/button/Button.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/connection-dots/ConnectionDots.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/design-tokens/index.d.ts +2 -0
- package/lib/typescript/commonjs/design-tokens/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/design-tokens/tokens-json.d.ts +85 -0
- package/lib/typescript/commonjs/design-tokens/tokens-json.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/fab/Fab.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/fonts/apply-font-faces.web.d.ts +5 -3
- package/lib/typescript/commonjs/fonts/apply-font-faces.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/frosted-icon-button/FrostedIconButton.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/loading/SpinnerIcon.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/styles/adopt-style-sheet.d.ts +22 -0
- package/lib/typescript/commonjs/styles/adopt-style-sheet.d.ts.map +1 -0
- package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/module/button/Button.web.d.ts.map +1 -1
- package/lib/typescript/module/connection-dots/ConnectionDots.web.d.ts.map +1 -1
- package/lib/typescript/module/design-tokens/index.d.ts +2 -0
- package/lib/typescript/module/design-tokens/index.d.ts.map +1 -1
- package/lib/typescript/module/design-tokens/tokens-json.d.ts +85 -0
- package/lib/typescript/module/design-tokens/tokens-json.d.ts.map +1 -0
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/fab/Fab.web.d.ts.map +1 -1
- package/lib/typescript/module/fonts/apply-font-faces.web.d.ts +5 -3
- package/lib/typescript/module/fonts/apply-font-faces.web.d.ts.map +1 -1
- package/lib/typescript/module/frosted-icon-button/FrostedIconButton.web.d.ts.map +1 -1
- package/lib/typescript/module/loading/SpinnerIcon.web.d.ts.map +1 -1
- package/lib/typescript/module/styles/adopt-style-sheet.d.ts +22 -0
- package/lib/typescript/module/styles/adopt-style-sheet.d.ts.map +1 -0
- package/package.json +4 -2
- package/src/__tests__/adopt-style-sheet.node.test.ts +21 -0
- package/src/__tests__/adopt-style-sheet.test.ts +165 -0
- package/src/__tests__/apply-font-faces.test.ts +32 -0
- package/src/__tests__/design-tokens-json.test.ts +112 -0
- package/src/__tests__/exports-map-contract.test.ts +5 -1
- package/src/__tests__/support/constructed-style-sheets.ts +68 -0
- package/src/bottom-sheet/BottomSheetBase.tsx +10 -14
- package/src/button/Button.web.tsx +2 -6
- package/src/connection-dots/ConnectionDots.web.tsx +2 -6
- package/src/design-tokens/index.ts +16 -0
- package/src/design-tokens/tokens-json.ts +214 -0
- package/src/design-tokens/tokens.json +6681 -0
- package/src/dialog/Dialog.web.tsx +2 -6
- package/src/fab/Fab.web.tsx +2 -6
- package/src/fonts/apply-font-faces.web.ts +11 -11
- package/src/frosted-icon-button/FrostedIconButton.web.tsx +2 -6
- package/src/loading/SpinnerIcon.web.tsx +2 -6
- package/src/styles/adopt-style-sheet.ts +131 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens-json.d.ts","sourceRoot":"","sources":["../../../../src/design-tokens/tokens-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAgBH,oFAAoF;AACpF,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,6FAA6F;AAC7F,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE;QACd,gEAAgE;QAChE,IAAI,EAAE,MAAM,CAAC;QACb,oDAAoD;QACpD,OAAO,EAAE,MAAM,CAAC;QAChB,sDAAsD;QACtD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,oEAAoE;QACpE,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1E,OAAO,EAAE;QAAE,KAAK,EAAE,WAAW,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChF,MAAM,EAAE;QAAE,KAAK,EAAE,WAAW,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/E,WAAW,EAAE;QAAE,KAAK,EAAE,WAAW,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpF,UAAU,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChE;AAiBD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAqBxD;AAqED,+CAA+C;AAC/C,wBAAgB,iBAAiB,IAAI,iBAAiB,CAkBrD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.web.d.ts","sourceRoot":"","sources":["../../../../src/dialog/Dialog.web.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Dialog.web.d.ts","sourceRoot":"","sources":["../../../../src/dialog/Dialog.web.tsx"],"names":[],"mappings":"AA4CA,OAAO,EAOL,4BAA4B,EAK7B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,YAAY,EAGZ,WAAW,EACZ,MAAM,SAAS,CAAC;AAmDjB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,2CAazD;AAobD,OAAO,EAAE,4BAA4B,EAAE,CAAC;AAkPxC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,GACV,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB,2CAgBA;AAkCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,8PAG5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fab.web.d.ts","sourceRoot":"","sources":["../../../../src/fab/Fab.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Fab.web.d.ts","sourceRoot":"","sources":["../../../../src/fab/Fab.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAMf,OAAO,KAAK,EAAgB,QAAQ,EAAuB,MAAM,SAAS,CAAC;AAE3E,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA+R3E,eAAO,MAAM,GAAG,sCAAwB,CAAC"}
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* Web-only. The native counterpart in `apply-font-faces.ts` is a no-op
|
|
5
5
|
* stub — native loads its fonts through `useFonts(FONT_ASSETS)`, so the file
|
|
6
6
|
* split keeps the web font payload out of the native bundle entirely.
|
|
7
|
-
* Idempotent: safe to call multiple times;
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Idempotent: safe to call multiple times; `adoptStyleSheet` keys the sheet by
|
|
8
|
+
* id, so repeat calls re-parse nothing. SSR-safe via its `typeof document`
|
|
9
|
+
* guard. `BloomThemeProvider` calls this on every mount by default, which is
|
|
10
|
+
* why it also has to survive a page whose CSP forbids inline styles — see
|
|
11
|
+
* `styles/adopt-style-sheet.ts`.
|
|
10
12
|
*
|
|
11
13
|
* The URLs come from `./font-urls.web`, which imports the `.woff2` files so
|
|
12
14
|
* the consuming bundler emits them as separate, cacheable assets. See that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-font-faces.web.d.ts","sourceRoot":"","sources":["../../../../src/fonts/apply-font-faces.web.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply-font-faces.web.d.ts","sourceRoot":"","sources":["../../../../src/fonts/apply-font-faces.web.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAerC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrostedIconButton.web.d.ts","sourceRoot":"","sources":["../../../../src/frosted-icon-button/FrostedIconButton.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FrostedIconButton.web.d.ts","sourceRoot":"","sources":["../../../../src/frosted-icon-button/FrostedIconButton.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAUf,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAqL7E,eAAO,MAAM,iBAAiB,oDAAsC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpinnerIcon.web.d.ts","sourceRoot":"","sources":["../../../../src/loading/SpinnerIcon.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"SpinnerIcon.web.d.ts","sourceRoot":"","sources":["../../../../src/loading/SpinnerIcon.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAKhE,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AA4CD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,8GAE7B,CAAC;AAiBF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAuClD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Make `css` apply to the document, under the identity `id`.
|
|
3
|
+
*
|
|
4
|
+
* Idempotent in both directions: calling it again with the same CSS re-parses
|
|
5
|
+
* nothing and adopts nothing twice (the usual case — every mount of every
|
|
6
|
+
* instance of a component calls it), and calling it with DIFFERENT CSS under
|
|
7
|
+
* the same id replaces the previous content in place (the theme-dependent case,
|
|
8
|
+
* `BottomSheetBase`'s scrollbar colours).
|
|
9
|
+
*
|
|
10
|
+
* No-op off the web, so a platform-neutral component can call it unguarded.
|
|
11
|
+
*/
|
|
12
|
+
export declare function adoptStyleSheet(id: string, css: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Detach the stylesheet `id`, whichever path installed it.
|
|
15
|
+
*
|
|
16
|
+
* Only for CSS whose lifetime is a component's — `BottomSheetBase` removes its
|
|
17
|
+
* scrollbar rules when the last sheet unmounts. The static per-component CSS is
|
|
18
|
+
* never dropped: it is the same bytes for the life of the page, and removing it
|
|
19
|
+
* on unmount would make a re-mount re-parse it.
|
|
20
|
+
*/
|
|
21
|
+
export declare function dropStyleSheet(id: string): void;
|
|
22
|
+
//# sourceMappingURL=adopt-style-sheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adopt-style-sheet.d.ts","sourceRoot":"","sources":["../../../../src/styles/adopt-style-sheet.ts"],"names":[],"mappings":"AAmEA;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CA+B7D;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAW/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetBase.d.ts","sourceRoot":"","sources":["../../../../src/bottom-sheet/BottomSheetBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAMH,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,SAAS,EACjB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"BottomSheetBase.d.ts","sourceRoot":"","sources":["../../../../src/bottom-sheet/BottomSheetBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAMH,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,SAAS,EACjB,MAAM,cAAc,CAAC;AAKtB,OAAiB,EACb,KAAK,aAAa,EAGlB,KAAK,WAAW,EAOnB,MAAM,yBAAyB,CAAC;AAyBjC,MAAM,WAAW,cAAc;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACrD;AAED,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;KAAE,KAAK,KAAK,CAAC,YAAY,GAAG,IAAI,CAA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;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC1D,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,eAAe,6FA8nB1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.web.d.ts","sourceRoot":"","sources":["../../../../src/button/Button.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KASN,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.web.d.ts","sourceRoot":"","sources":["../../../../src/button/Button.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KASN,MAAM,OAAO,CAAC;AAOf,OAAO,KAAK,EAAE,WAAW,EAA6B,MAAM,SAAS,CAAC;AAEtE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAkatE,eAAO,MAAM,MAAM,yCAA2B,CAAC;AAG/C,eAAO,MAAM,aAAa,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAEpE,CAAC;AAGH,eAAO,MAAM,eAAe,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAEtE,CAAC;AAGH,eAAO,MAAM,UAAU,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAEjE,CAAC;AAGH,eAAO,MAAM,WAAW,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAElE,CAAC;AAGH,eAAO,MAAM,aAAa,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAEpE,CAAC;AAGH,eAAO,MAAM,UAAU,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAEjE,CAAC;AAGH,eAAO,MAAM,aAAa,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAEpE,CAAC;AAGH,eAAO,MAAM,UAAU,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAEjE,CAAC;AAGH,eAAO,MAAM,iBAAiB,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAExE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionDots.web.d.ts","sourceRoot":"","sources":["../../../../src/connection-dots/ConnectionDots.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ConnectionDots.web.d.ts","sourceRoot":"","sources":["../../../../src/connection-dots/ConnectionDots.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAOzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AASnD;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,mOAKrC,CAAC;AAuFF,eAAO,MAAM,cAAc,iDAAgC,CAAC"}
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
export { bloomTailwindPreset } from './tailwind-preset';
|
|
22
22
|
export type { TailwindPreset, TailwindPresetThemeExtend, } from './tailwind-preset';
|
|
23
23
|
export { bloomThemeCss, bloomThemeBlock } from './theme-css';
|
|
24
|
+
export { bloomDesignTokens, renderBloomTokensJson, resolvedColorToHex, } from './tokens-json';
|
|
25
|
+
export type { BloomDesignTokens, DesignToken, PresetExtensions, PresetGroup, } from './tokens-json';
|
|
24
26
|
export { getPresetVars } from '../theme/preset-vars';
|
|
25
27
|
export type { ExplicitAccents } from '../theme/preset-vars';
|
|
26
28
|
export { buildSeedScopeVars } from '../theme/color-scope/seed-scope';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/design-tokens/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,YAAY,EACV,cA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**
|
|
2
|
+
* The machine-readable form of every Bloom design token, in W3C Design Tokens
|
|
3
|
+
* (DTCG) format.
|
|
4
|
+
*
|
|
5
|
+
* The CSS artifacts next to this file (`theme.css`, `bloomThemeCss()`) are the
|
|
6
|
+
* ALIAS layer and only make sense to a browser. A consumer that is not a
|
|
7
|
+
* browser — Astro codegens `SkColor` tables for Chromium's native UI so the
|
|
8
|
+
* toolbar and the WebUI pages cannot disagree about what "primary" is — needs
|
|
9
|
+
* the RESOLVED values, for every preset and both schemes, in a format it can
|
|
10
|
+
* read without running Bloom's colour engine. That is this file.
|
|
11
|
+
*
|
|
12
|
+
* Same single source as everything else: `getResolvedTokens`, i.e. the colour
|
|
13
|
+
* engine. `tokens.json` is generated from it by
|
|
14
|
+
* `scripts/generate-design-tokens-json.ts`, and
|
|
15
|
+
* `src/__tests__/design-tokens-json.test.ts` fails if the checked-in file is
|
|
16
|
+
* not byte-identical to a fresh render — so the JSON, the CSS and the runtime
|
|
17
|
+
* palette cannot drift from each other.
|
|
18
|
+
*/
|
|
19
|
+
/** One DTCG token. `$type` is inherited from the nearest group that declares it. */
|
|
20
|
+
export interface DesignToken {
|
|
21
|
+
$value: string | number;
|
|
22
|
+
$type?: string;
|
|
23
|
+
$description?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Bloom-specific metadata on a preset group, namespaced per the DTCG `$extensions` rule. */
|
|
26
|
+
export interface PresetExtensions {
|
|
27
|
+
'so.oxy.bloom': {
|
|
28
|
+
/** The brand seed the engine derived the whole palette from. */
|
|
29
|
+
seed: string;
|
|
30
|
+
/** The tonal scheme variant used with that seed. */
|
|
31
|
+
variant: string;
|
|
32
|
+
/** Who may pick the preset; absent means everyone. */
|
|
33
|
+
gate?: string;
|
|
34
|
+
/** Present when the preset forces a white label in both schemes. */
|
|
35
|
+
label?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface PresetGroup {
|
|
39
|
+
$description: string;
|
|
40
|
+
$extensions: PresetExtensions;
|
|
41
|
+
light: Record<string, DesignToken>;
|
|
42
|
+
dark: Record<string, DesignToken>;
|
|
43
|
+
}
|
|
44
|
+
export interface BloomDesignTokens {
|
|
45
|
+
$description: string;
|
|
46
|
+
color: {
|
|
47
|
+
$type: 'color';
|
|
48
|
+
$description: string;
|
|
49
|
+
} & Record<string, unknown>;
|
|
50
|
+
spacing: {
|
|
51
|
+
$type: 'dimension';
|
|
52
|
+
$description: string;
|
|
53
|
+
} & Record<string, unknown>;
|
|
54
|
+
radius: {
|
|
55
|
+
$type: 'dimension';
|
|
56
|
+
$description: string;
|
|
57
|
+
} & Record<string, unknown>;
|
|
58
|
+
borderWidth: {
|
|
59
|
+
$type: 'dimension';
|
|
60
|
+
$description: string;
|
|
61
|
+
} & Record<string, unknown>;
|
|
62
|
+
typography: {
|
|
63
|
+
$description: string;
|
|
64
|
+
} & Record<string, unknown>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Turn one resolved token value into an sRGB hex string.
|
|
68
|
+
*
|
|
69
|
+
* The engine emits exactly two forms — `rgb(r g b)` for opaque tokens and
|
|
70
|
+
* `rgba(r, g, b, a)` for the translucent `-subtle` family. Anything else is a
|
|
71
|
+
* change in the engine's output that this file has not been taught about, and
|
|
72
|
+
* throwing at generation time is the only way that surfaces: a silently
|
|
73
|
+
* passed-through CSS string would end up in a C++ colour table as garbage.
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolvedColorToHex(value: string): string;
|
|
76
|
+
/** The whole token file, as a plain object. */
|
|
77
|
+
export declare function bloomDesignTokens(): BloomDesignTokens;
|
|
78
|
+
/**
|
|
79
|
+
* The exact bytes of `design-tokens/tokens.json`.
|
|
80
|
+
*
|
|
81
|
+
* Both the generator script and the drift test call this, so neither can be
|
|
82
|
+
* right about the file while the other is wrong.
|
|
83
|
+
*/
|
|
84
|
+
export declare function renderBloomTokensJson(): string;
|
|
85
|
+
//# sourceMappingURL=tokens-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1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AE,KAAK,EAAE,WAAW,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpF,UAAU,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChE;AAiBD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAqBxD;AAqED,+CAA+C;AAC/C,wBAAgB,iBAAiB,IAAI,iBAAiB,CAkBrD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.web.d.ts","sourceRoot":"","sources":["../../../../src/dialog/Dialog.web.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Dialog.web.d.ts","sourceRoot":"","sources":["../../../../src/dialog/Dialog.web.tsx"],"names":[],"mappings":"AA4CA,OAAO,EAOL,4BAA4B,EAK7B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,YAAY,EAGZ,WAAW,EACZ,MAAM,SAAS,CAAC;AAmDjB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,2CAazD;AAobD,OAAO,EAAE,4BAA4B,EAAE,CAAC;AAkPxC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,GACV,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB,2CAgBA;AAkCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,8PAG5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fab.web.d.ts","sourceRoot":"","sources":["../../../../src/fab/Fab.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Fab.web.d.ts","sourceRoot":"","sources":["../../../../src/fab/Fab.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAMf,OAAO,KAAK,EAAgB,QAAQ,EAAuB,MAAM,SAAS,CAAC;AAE3E,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA+R3E,eAAO,MAAM,GAAG,sCAAwB,CAAC"}
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* Web-only. The native counterpart in `apply-font-faces.ts` is a no-op
|
|
5
5
|
* stub — native loads its fonts through `useFonts(FONT_ASSETS)`, so the file
|
|
6
6
|
* split keeps the web font payload out of the native bundle entirely.
|
|
7
|
-
* Idempotent: safe to call multiple times;
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Idempotent: safe to call multiple times; `adoptStyleSheet` keys the sheet by
|
|
8
|
+
* id, so repeat calls re-parse nothing. SSR-safe via its `typeof document`
|
|
9
|
+
* guard. `BloomThemeProvider` calls this on every mount by default, which is
|
|
10
|
+
* why it also has to survive a page whose CSP forbids inline styles — see
|
|
11
|
+
* `styles/adopt-style-sheet.ts`.
|
|
10
12
|
*
|
|
11
13
|
* The URLs come from `./font-urls.web`, which imports the `.woff2` files so
|
|
12
14
|
* the consuming bundler emits them as separate, cacheable assets. See that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-font-faces.web.d.ts","sourceRoot":"","sources":["../../../../src/fonts/apply-font-faces.web.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply-font-faces.web.d.ts","sourceRoot":"","sources":["../../../../src/fonts/apply-font-faces.web.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAerC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrostedIconButton.web.d.ts","sourceRoot":"","sources":["../../../../src/frosted-icon-button/FrostedIconButton.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FrostedIconButton.web.d.ts","sourceRoot":"","sources":["../../../../src/frosted-icon-button/FrostedIconButton.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAUf,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAqL7E,eAAO,MAAM,iBAAiB,oDAAsC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpinnerIcon.web.d.ts","sourceRoot":"","sources":["../../../../src/loading/SpinnerIcon.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"SpinnerIcon.web.d.ts","sourceRoot":"","sources":["../../../../src/loading/SpinnerIcon.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAKhE,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AA4CD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,8GAE7B,CAAC;AAiBF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAuClD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Make `css` apply to the document, under the identity `id`.
|
|
3
|
+
*
|
|
4
|
+
* Idempotent in both directions: calling it again with the same CSS re-parses
|
|
5
|
+
* nothing and adopts nothing twice (the usual case — every mount of every
|
|
6
|
+
* instance of a component calls it), and calling it with DIFFERENT CSS under
|
|
7
|
+
* the same id replaces the previous content in place (the theme-dependent case,
|
|
8
|
+
* `BottomSheetBase`'s scrollbar colours).
|
|
9
|
+
*
|
|
10
|
+
* No-op off the web, so a platform-neutral component can call it unguarded.
|
|
11
|
+
*/
|
|
12
|
+
export declare function adoptStyleSheet(id: string, css: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Detach the stylesheet `id`, whichever path installed it.
|
|
15
|
+
*
|
|
16
|
+
* Only for CSS whose lifetime is a component's — `BottomSheetBase` removes its
|
|
17
|
+
* scrollbar rules when the last sheet unmounts. The static per-component CSS is
|
|
18
|
+
* never dropped: it is the same bytes for the life of the page, and removing it
|
|
19
|
+
* on unmount would make a re-mount re-parse it.
|
|
20
|
+
*/
|
|
21
|
+
export declare function dropStyleSheet(id: string): void;
|
|
22
|
+
//# sourceMappingURL=adopt-style-sheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adopt-style-sheet.d.ts","sourceRoot":"","sources":["../../../../src/styles/adopt-style-sheet.ts"],"names":[],"mappings":"AAmEA;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CA+B7D;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAW/C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/bloom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.0",
|
|
4
4
|
"packageManager": "bun@1.3.14",
|
|
5
5
|
"description": "Bloom UI — Oxy ecosystem component library for React Native + Expo + Web",
|
|
6
6
|
"main": "lib/commonjs/index.js",
|
|
@@ -1386,6 +1386,7 @@
|
|
|
1386
1386
|
}
|
|
1387
1387
|
},
|
|
1388
1388
|
"./design-tokens/theme.css": "./src/design-tokens/theme.css",
|
|
1389
|
+
"./design-tokens/tokens.json": "./src/design-tokens/tokens.json",
|
|
1389
1390
|
"./package.json": "./package.json"
|
|
1390
1391
|
},
|
|
1391
1392
|
"files": [
|
|
@@ -1454,7 +1455,8 @@
|
|
|
1454
1455
|
"scripts": {
|
|
1455
1456
|
"generate:exports": "node scripts/generate-platform-exports.mjs",
|
|
1456
1457
|
"generate:theme-css": "bun scripts/generate-theme-css.ts",
|
|
1457
|
-
"
|
|
1458
|
+
"generate:tokens-json": "bun scripts/generate-design-tokens-json.ts",
|
|
1459
|
+
"prebuild": "node scripts/generate-platform-exports.mjs && bun scripts/generate-theme-css.ts && bun scripts/generate-design-tokens-json.ts",
|
|
1458
1460
|
"build": "bob build",
|
|
1459
1461
|
"postbuild": "node scripts/verify-package.mjs",
|
|
1460
1462
|
"verify:package": "node scripts/verify-package.mjs",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment node
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { adoptStyleSheet, dropStyleSheet } from '../styles/adopt-style-sheet';
|
|
6
|
+
|
|
7
|
+
/* Centralising the injection also centralised the `typeof document` guard that
|
|
8
|
+
* used to sit in each fork. It has to stay: `adoptStyleSheet` is reached from a
|
|
9
|
+
* platform-neutral component (`BottomSheetBase`) and from every server render,
|
|
10
|
+
* where throwing would take the whole page down rather than lose a stylesheet.
|
|
11
|
+
* Needs its own file — jest picks the environment per file. */
|
|
12
|
+
describe('adoptStyleSheet with no document (native / SSR)', () => {
|
|
13
|
+
it('the environment under test genuinely has no document', () => {
|
|
14
|
+
expect(typeof document).toBe('undefined');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('is a no-op rather than a throw', () => {
|
|
18
|
+
expect(() => adoptStyleSheet('bloom-test', '.x {}')).not.toThrow();
|
|
19
|
+
expect(() => dropStyleSheet('bloom-test')).not.toThrow();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
installConstructedStyleSheets,
|
|
7
|
+
type ConstructedStyleSheetsHarness,
|
|
8
|
+
} from './support/constructed-style-sheets';
|
|
9
|
+
|
|
10
|
+
type AdoptStyleSheetModule = typeof import('../styles/adopt-style-sheet');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A fresh copy of the module per test. It keeps the sheets it has constructed in
|
|
14
|
+
* a module-scope registry, so without this a later test would see the previous
|
|
15
|
+
* one's sheet and the idempotence cases would prove nothing.
|
|
16
|
+
*/
|
|
17
|
+
function freshModule(): AdoptStyleSheetModule {
|
|
18
|
+
let loaded: AdoptStyleSheetModule | undefined;
|
|
19
|
+
jest.isolateModules(() => {
|
|
20
|
+
loaded = require('../styles/adopt-style-sheet') as AdoptStyleSheetModule;
|
|
21
|
+
});
|
|
22
|
+
if (!loaded) throw new Error('adopt-style-sheet failed to load');
|
|
23
|
+
return loaded;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
describe('adoptStyleSheet — constructed stylesheets (the CSP-safe path)', () => {
|
|
27
|
+
let harness: ConstructedStyleSheetsHarness;
|
|
28
|
+
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
document.head.innerHTML = '';
|
|
31
|
+
harness = installConstructedStyleSheets();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
afterEach(() => {
|
|
35
|
+
harness.uninstall();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/* THE point of the whole change. A `<style>` element carrying text content is
|
|
39
|
+
* what `style-src 'self'` blocks, silently — so "no style element" is the
|
|
40
|
+
* assertion that fails if the adoption branch is ever removed, and it is the
|
|
41
|
+
* only one a CSP can tell apart. */
|
|
42
|
+
it('applies the CSS through an adopted sheet, creating no <style> element', () => {
|
|
43
|
+
const { adoptStyleSheet } = freshModule();
|
|
44
|
+
|
|
45
|
+
adoptStyleSheet('bloom-test', '.x { color: red; }');
|
|
46
|
+
|
|
47
|
+
expect(document.querySelectorAll('style')).toHaveLength(0);
|
|
48
|
+
expect(harness.adopted()).toHaveLength(1);
|
|
49
|
+
expect(harness.adopted()[0]?.cssText).toBe('.x { color: red; }');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('repeat calls with the same CSS re-parse nothing and adopt nothing twice', () => {
|
|
53
|
+
const { adoptStyleSheet } = freshModule();
|
|
54
|
+
|
|
55
|
+
adoptStyleSheet('bloom-test', '.x { color: red; }');
|
|
56
|
+
adoptStyleSheet('bloom-test', '.x { color: red; }');
|
|
57
|
+
adoptStyleSheet('bloom-test', '.x { color: red; }');
|
|
58
|
+
|
|
59
|
+
expect(harness.adopted()).toHaveLength(1);
|
|
60
|
+
expect(harness.adopted()[0]?.replaceSyncCalls).toBe(1);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('new CSS under the same id replaces the sheet content in place', () => {
|
|
64
|
+
const { adoptStyleSheet } = freshModule();
|
|
65
|
+
|
|
66
|
+
adoptStyleSheet('bloom-test', '.x { color: red; }');
|
|
67
|
+
const first = harness.adopted()[0];
|
|
68
|
+
adoptStyleSheet('bloom-test', '.x { color: blue; }');
|
|
69
|
+
|
|
70
|
+
expect(harness.adopted()).toHaveLength(1);
|
|
71
|
+
expect(harness.adopted()[0]).toBe(first);
|
|
72
|
+
expect(harness.adopted()[0]?.cssText).toBe('.x { color: blue; }');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('keeps one sheet per id', () => {
|
|
76
|
+
const { adoptStyleSheet } = freshModule();
|
|
77
|
+
|
|
78
|
+
adoptStyleSheet('bloom-a', '.a {}');
|
|
79
|
+
adoptStyleSheet('bloom-b', '.b {}');
|
|
80
|
+
|
|
81
|
+
expect(harness.adopted()).toHaveLength(2);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
/* A consumer that owns `document.adoptedStyleSheets` can reassign it — a
|
|
85
|
+
* framework swapping its own sheets, a test resetting the document. Bloom's
|
|
86
|
+
* CSS has to come back, and without re-parsing. */
|
|
87
|
+
it('re-adopts the same sheet after the document list is reset', () => {
|
|
88
|
+
const { adoptStyleSheet } = freshModule();
|
|
89
|
+
|
|
90
|
+
adoptStyleSheet('bloom-test', '.x {}');
|
|
91
|
+
const first = harness.adopted()[0];
|
|
92
|
+
document.adoptedStyleSheets = [];
|
|
93
|
+
adoptStyleSheet('bloom-test', '.x {}');
|
|
94
|
+
|
|
95
|
+
expect(harness.adopted()).toHaveLength(1);
|
|
96
|
+
expect(harness.adopted()[0]).toBe(first);
|
|
97
|
+
expect(harness.adopted()[0]?.replaceSyncCalls).toBe(1);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('dropStyleSheet un-adopts only its own sheet', () => {
|
|
101
|
+
const { adoptStyleSheet, dropStyleSheet } = freshModule();
|
|
102
|
+
|
|
103
|
+
adoptStyleSheet('bloom-a', '.a {}');
|
|
104
|
+
adoptStyleSheet('bloom-b', '.b {}');
|
|
105
|
+
dropStyleSheet('bloom-a');
|
|
106
|
+
|
|
107
|
+
expect(harness.adopted()).toHaveLength(1);
|
|
108
|
+
expect(harness.adopted()[0]?.cssText).toBe('.b {}');
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('a dropped id can be adopted again', () => {
|
|
112
|
+
const { adoptStyleSheet, dropStyleSheet } = freshModule();
|
|
113
|
+
|
|
114
|
+
adoptStyleSheet('bloom-test', '.x {}');
|
|
115
|
+
dropStyleSheet('bloom-test');
|
|
116
|
+
adoptStyleSheet('bloom-test', '.y {}');
|
|
117
|
+
|
|
118
|
+
expect(harness.adopted()).toHaveLength(1);
|
|
119
|
+
expect(harness.adopted()[0]?.cssText).toBe('.y {}');
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
describe('adoptStyleSheet — <style> fallback', () => {
|
|
124
|
+
beforeEach(() => {
|
|
125
|
+
document.head.innerHTML = '';
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
/* Plain jsdom: no `adoptedStyleSheets`, no `replaceSync`. Same for a browser
|
|
129
|
+
* older than Chrome 73 / Safari 16.4 / Firefox 101. The CSS still has to
|
|
130
|
+
* apply — under a permissive CSP, which is what those pages have. */
|
|
131
|
+
it('the environment under test genuinely lacks the constructed API', () => {
|
|
132
|
+
expect('adoptedStyleSheets' in document).toBe(false);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('creates one <style> element carrying the CSS', () => {
|
|
136
|
+
const { adoptStyleSheet } = freshModule();
|
|
137
|
+
|
|
138
|
+
adoptStyleSheet('bloom-test', '.x { color: red; }');
|
|
139
|
+
|
|
140
|
+
const element = document.getElementById('bloom-test');
|
|
141
|
+
expect(element?.tagName).toBe('STYLE');
|
|
142
|
+
expect(element?.textContent).toBe('.x { color: red; }');
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('does not duplicate the element across calls, and updates its content', () => {
|
|
146
|
+
const { adoptStyleSheet } = freshModule();
|
|
147
|
+
|
|
148
|
+
adoptStyleSheet('bloom-test', '.x { color: red; }');
|
|
149
|
+
adoptStyleSheet('bloom-test', '.x { color: blue; }');
|
|
150
|
+
|
|
151
|
+
expect(document.querySelectorAll('style#bloom-test')).toHaveLength(1);
|
|
152
|
+
expect(document.getElementById('bloom-test')?.textContent).toBe(
|
|
153
|
+
'.x { color: blue; }',
|
|
154
|
+
);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('dropStyleSheet removes the element', () => {
|
|
158
|
+
const { adoptStyleSheet, dropStyleSheet } = freshModule();
|
|
159
|
+
|
|
160
|
+
adoptStyleSheet('bloom-test', '.x {}');
|
|
161
|
+
dropStyleSheet('bloom-test');
|
|
162
|
+
|
|
163
|
+
expect(document.getElementById('bloom-test')).toBeNull();
|
|
164
|
+
});
|
|
165
|
+
});
|
|
@@ -9,7 +9,12 @@
|
|
|
9
9
|
// resolution; here we reach for it explicitly so the test exercises the
|
|
10
10
|
// actual implementation under jsdom.
|
|
11
11
|
import { applyFontFaces } from '../fonts/apply-font-faces.web';
|
|
12
|
+
import { installConstructedStyleSheets } from './support/constructed-style-sheets';
|
|
12
13
|
|
|
14
|
+
/* jsdom has no constructed-stylesheet API, so everything in this block
|
|
15
|
+
* exercises `adoptStyleSheet`'s `<style>` fallback. The CSP-safe path a real
|
|
16
|
+
* browser takes is asserted in the last block, and in
|
|
17
|
+
* `adopt-style-sheet.test.ts`. */
|
|
13
18
|
describe('applyFontFaces (web)', () => {
|
|
14
19
|
beforeEach(() => {
|
|
15
20
|
document.head.innerHTML = '';
|
|
@@ -71,6 +76,33 @@ describe('applyFontFaces (web)', () => {
|
|
|
71
76
|
});
|
|
72
77
|
});
|
|
73
78
|
|
|
79
|
+
/* The font faces are the one injection `BloomThemeProvider` performs by
|
|
80
|
+
* default, so they are the first thing a page under `style-src 'self'` loses —
|
|
81
|
+
* and it loses them silently, as text rendered in the fallback family with no
|
|
82
|
+
* console output. Everything else Bloom injects is per-component; this is
|
|
83
|
+
* every consumer, every page. */
|
|
84
|
+
describe('applyFontFaces under a page that forbids inline styles', () => {
|
|
85
|
+
it('adopts a constructed sheet and creates no <style> element', () => {
|
|
86
|
+
document.head.innerHTML = '';
|
|
87
|
+
const harness = installConstructedStyleSheets();
|
|
88
|
+
try {
|
|
89
|
+
let fonts: typeof import('../fonts/apply-font-faces.web') | undefined;
|
|
90
|
+
jest.isolateModules(() => {
|
|
91
|
+
fonts = require('../fonts/apply-font-faces.web') as typeof fonts;
|
|
92
|
+
});
|
|
93
|
+
fonts?.applyFontFaces();
|
|
94
|
+
|
|
95
|
+
expect(document.querySelectorAll('style')).toHaveLength(0);
|
|
96
|
+
expect(harness.adopted()).toHaveLength(1);
|
|
97
|
+
const css = harness.adopted()[0]?.cssText ?? '';
|
|
98
|
+
expect(css.match(/@font-face\s*{/g) ?? []).toHaveLength(4);
|
|
99
|
+
expect(css).toMatch(/--bloom-font-sans:/);
|
|
100
|
+
} finally {
|
|
101
|
+
harness.uninstall();
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
74
106
|
describe('applyFontFaces (native stub)', () => {
|
|
75
107
|
beforeEach(() => {
|
|
76
108
|
document.head.innerHTML = '';
|