@tamagui/font 1.114.4 → 1.115.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.
@@ -0,0 +1,78 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ addFont: () => addFont
24
+ });
25
+ module.exports = __toCommonJS(src_exports);
26
+ var import_constants = require("@tamagui/constants"),
27
+ import_web = require("@tamagui/web");
28
+ function addFont(props) {
29
+ const config = (0, import_web.getConfig)(),
30
+ {
31
+ fontFamilyName: fontFamilyNameIn,
32
+ fontFamily: fontFamilyIn
33
+ } = props;
34
+ if (process.env.NODE_ENV === "development") {
35
+ if (!config) throw new Error("No config");
36
+ const fontFamily = config.fonts[fontFamilyNameIn];
37
+ if (!props.update && fontFamily) return {
38
+ fontFamily
39
+ };
40
+ }
41
+ config.fonts[fontFamilyNameIn] = fontFamilyIn;
42
+ const sep = process.env.NODE_ENV === "development" ? config.cssStyleSeparator || " " : "";
43
+ function declarationsToRuleSet(decs, selector = "") {
44
+ return `:root${selector} {${sep}${[...decs].join(`;${sep}`)}${sep}}`;
45
+ }
46
+ if (import_constants.isWeb) {
47
+ const fontFamilyToken = (0, import_web.createVariables)(fontFamilyIn, "f", !0),
48
+ parsedFontFamily = (0, import_web.parseFont)(fontFamilyToken),
49
+ fontFamilyNameParsed = `$${fontFamilyNameIn}`;
50
+ if (config.fontsParsed[fontFamilyNameParsed] = parsedFontFamily, props.insertCSS) {
51
+ const [ff_name, ff_language] = fontFamilyNameParsed.includes("_") ? fontFamilyNameParsed.split("_") : [fontFamilyNameParsed],
52
+ fontVars = (0, import_web.registerFontVariables)(parsedFontFamily),
53
+ fontDeclaration = {
54
+ [fontFamilyNameIn]: {
55
+ name: ff_name.slice(1),
56
+ declarations: fontVars,
57
+ language: ff_language
58
+ }
59
+ },
60
+ {
61
+ name,
62
+ declarations,
63
+ language = "default"
64
+ } = fontDeclaration[fontFamilyNameIn],
65
+ fontSelector = `.font_${name}`,
66
+ langSelector = `:root .t_lang-${name}-${language} ${fontSelector}`,
67
+ selectors = language === "default" ? ` ${fontSelector}, ${langSelector}` : langSelector,
68
+ cssRuleSets = declarationsToRuleSet(declarations, selectors),
69
+ id = `t_font_style_${fontFamilyNameIn}`,
70
+ existing = document.querySelector(`#${id}`),
71
+ style = document.createElement("style");
72
+ return style.id = id, style.appendChild(document.createTextNode(`${cssRuleSets}`)), document.head.appendChild(style), existing && existing.parentElement?.removeChild(existing), {
73
+ fontFamilyToken,
74
+ fontDeclaration
75
+ };
76
+ }
77
+ }
78
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/font",
3
- "version": "1.114.4",
3
+ "version": "1.115.0",
4
4
  "sideEffects": false,
5
5
  "source": "src/index.ts",
6
6
  "types": "./types/index.d.ts",
@@ -21,11 +21,11 @@
21
21
  "clean:build": "tamagui-build clean:build"
22
22
  },
23
23
  "dependencies": {
24
- "@tamagui/constants": "1.114.4",
25
- "@tamagui/web": "1.114.4"
24
+ "@tamagui/constants": "1.115.0",
25
+ "@tamagui/web": "1.115.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@tamagui/build": "1.114.4",
28
+ "@tamagui/build": "1.115.0",
29
29
  "react": "^18.2.0 || ^19.0.0"
30
30
  },
31
31
  "publishConfig": {
package/dist/cjs/index.js DELETED
@@ -1,56 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: !0 });
8
- }, __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from == "object" || typeof from == "function")
10
- for (let key of __getOwnPropNames(from))
11
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
- var src_exports = {};
16
- __export(src_exports, {
17
- addFont: () => addFont
18
- });
19
- module.exports = __toCommonJS(src_exports);
20
- var import_constants = require("@tamagui/constants"), import_web = require("@tamagui/web");
21
- function addFont(props) {
22
- const config = (0, import_web.getConfig)(), { fontFamilyName: fontFamilyNameIn, fontFamily: fontFamilyIn } = props;
23
- if (process.env.NODE_ENV === "development") {
24
- if (!config)
25
- throw new Error("No config");
26
- const fontFamily = config.fonts[fontFamilyNameIn];
27
- if (!props.update && fontFamily)
28
- return { fontFamily };
29
- }
30
- config.fonts[fontFamilyNameIn] = fontFamilyIn;
31
- const sep = process.env.NODE_ENV === "development" ? config.cssStyleSeparator || " " : "";
32
- function declarationsToRuleSet(decs, selector = "") {
33
- return `:root${selector} {${sep}${[...decs].join(`;${sep}`)}${sep}}`;
34
- }
35
- if (import_constants.isWeb) {
36
- const fontFamilyToken = (0, import_web.createVariables)(fontFamilyIn, "f", !0), parsedFontFamily = (0, import_web.parseFont)(fontFamilyToken), fontFamilyNameParsed = `$${fontFamilyNameIn}`;
37
- if (config.fontsParsed[fontFamilyNameParsed] = parsedFontFamily, props.insertCSS) {
38
- const [ff_name, ff_language] = fontFamilyNameParsed.includes("_") ? fontFamilyNameParsed.split("_") : [fontFamilyNameParsed], fontVars = (0, import_web.registerFontVariables)(parsedFontFamily), fontDeclaration = {
39
- [fontFamilyNameIn]: {
40
- name: ff_name.slice(1),
41
- declarations: fontVars,
42
- language: ff_language
43
- }
44
- }, {
45
- name,
46
- declarations,
47
- language = "default"
48
- } = fontDeclaration[fontFamilyNameIn], fontSelector = `.font_${name}`, langSelector = `:root .t_lang-${name}-${language} ${fontSelector}`, selectors = language === "default" ? ` ${fontSelector}, ${langSelector}` : langSelector, cssRuleSets = declarationsToRuleSet(declarations, selectors), id = `t_font_style_${fontFamilyNameIn}`, existing = document.querySelector(`#${id}`), style = document.createElement("style");
49
- return style.id = id, style.appendChild(document.createTextNode(`${cssRuleSets}`)), document.head.appendChild(style), existing && existing.parentElement?.removeChild(existing), {
50
- fontFamilyToken,
51
- fontDeclaration
52
- };
53
- }
54
- }
55
- }
56
- //# sourceMappingURL=index.js.map
File without changes