@tamagui/font 1.135.4-1761749240853 → 1.135.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.native.js +35 -53
- package/dist/cjs/index.native.js.map +6 -1
- package/package.json +4 -18
package/dist/cjs/index.native.js
CHANGED
|
@@ -1,77 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
6
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: !0
|
|
22
|
-
}), mod);
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
16
|
var index_exports = {};
|
|
24
17
|
__export(index_exports, {
|
|
25
18
|
addFont: () => addFont
|
|
26
19
|
});
|
|
27
20
|
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
var import_constants = require("@tamagui/constants"),
|
|
29
|
-
import_web = require("@tamagui/web");
|
|
21
|
+
var import_constants = require("@tamagui/constants"), import_web = require("@tamagui/web");
|
|
30
22
|
function addFont(props) {
|
|
31
|
-
var config = (0, import_web.getConfig)(),
|
|
32
|
-
{
|
|
33
|
-
fontFamilyName: fontFamilyNameIn,
|
|
34
|
-
fontFamily: fontFamilyIn
|
|
35
|
-
} = props;
|
|
23
|
+
var config = (0, import_web.getConfig)(), { fontFamilyName: fontFamilyNameIn, fontFamily: fontFamilyIn } = props;
|
|
36
24
|
if (process.env.NODE_ENV === "development") {
|
|
37
|
-
if (!config)
|
|
25
|
+
if (!config)
|
|
26
|
+
throw new Error("No config");
|
|
38
27
|
var fontFamily = config.fonts[fontFamilyNameIn];
|
|
39
|
-
if (!props.update && fontFamily)
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
if (!props.update && fontFamily)
|
|
29
|
+
return {
|
|
30
|
+
fontFamily
|
|
31
|
+
};
|
|
42
32
|
}
|
|
43
33
|
config.fonts[fontFamilyNameIn] = fontFamilyIn;
|
|
44
34
|
var sep = process.env.NODE_ENV === "development" ? config.cssStyleSeparator || " " : "";
|
|
45
35
|
function declarationsToRuleSet(decs) {
|
|
46
36
|
var selector = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
47
|
-
return `:root${selector} {${sep}${[
|
|
37
|
+
return `:root${selector} {${sep}${[
|
|
38
|
+
...decs
|
|
39
|
+
].join(`;${sep}`)}${sep}}`;
|
|
48
40
|
}
|
|
49
41
|
if (import_constants.isWeb) {
|
|
50
|
-
var fontFamilyToken = (0, import_web.createVariables)(fontFamilyIn, "f", !0),
|
|
51
|
-
parsedFontFamily = (0, import_web.parseFont)(fontFamilyToken),
|
|
52
|
-
fontFamilyNameParsed = `$${fontFamilyNameIn}`;
|
|
42
|
+
var fontFamilyToken = (0, import_web.createVariables)(fontFamilyIn, "f", !0), parsedFontFamily = (0, import_web.parseFont)(fontFamilyToken), fontFamilyNameParsed = `$${fontFamilyNameIn}`;
|
|
53
43
|
if (config.fontsParsed[fontFamilyNameParsed] = parsedFontFamily, props.insertCSS) {
|
|
54
|
-
var [ff_name, ff_language] = fontFamilyNameParsed.includes("_") ? fontFamilyNameParsed.split("_") : [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
{
|
|
64
|
-
name,
|
|
65
|
-
declarations,
|
|
66
|
-
language = "default"
|
|
67
|
-
} = fontDeclaration[fontFamilyNameIn],
|
|
68
|
-
fontSelector = `.font_${name}`,
|
|
69
|
-
langSelector = `:root .t_lang-${name}-${language} ${fontSelector}`,
|
|
70
|
-
selectors = language === "default" ? ` ${fontSelector}, ${langSelector}` : langSelector,
|
|
71
|
-
cssRuleSets = declarationsToRuleSet(declarations, selectors),
|
|
72
|
-
id = `t_font_style_${fontFamilyNameIn}`,
|
|
73
|
-
existing = document.querySelector(`#${id}`),
|
|
74
|
-
style = document.createElement("style");
|
|
44
|
+
var [ff_name, ff_language] = fontFamilyNameParsed.includes("_") ? fontFamilyNameParsed.split("_") : [
|
|
45
|
+
fontFamilyNameParsed
|
|
46
|
+
], fontVars = (0, import_web.registerFontVariables)(parsedFontFamily), fontDeclaration = {
|
|
47
|
+
[fontFamilyNameIn]: {
|
|
48
|
+
name: ff_name.slice(1),
|
|
49
|
+
declarations: fontVars,
|
|
50
|
+
language: ff_language
|
|
51
|
+
}
|
|
52
|
+
}, { name, declarations, language = "default" } = 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");
|
|
75
53
|
if (style.id = id, style.appendChild(document.createTextNode(`${cssRuleSets}`)), document.head.appendChild(style), existing) {
|
|
76
54
|
var _existing_parentElement;
|
|
77
55
|
(_existing_parentElement = existing.parentElement) === null || _existing_parentElement === void 0 || _existing_parentElement.removeChild(existing);
|
|
@@ -83,4 +61,8 @@ function addFont(props) {
|
|
|
83
61
|
}
|
|
84
62
|
}
|
|
85
63
|
}
|
|
86
|
-
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
addFont
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB,+BACtB,aAA6E;AACtE,SAAS,QAAQ,OACxB;AACI,MAAI,aAAS,sBAAU,GACnB,EAAE,gBAAgB,kBAAkB,YAAY,aAAa,IAAI;AACrE,MAAI,QAAQ,IAAI,aAAa,eAAe;AACxC,QAAI,CAAC;AACD,YAAM,IAAI,MAAM,WAAW;AAE/B,QAAI,aAAa,OAAO,MAAM,gBAAgB;AAC9C,QAAI,CAAC,MAAM,UAAU;AACjB,aAAO;AAAA,QACH;AAAA,MACJ;AAAA,EAER;AACA,SAAO,MAAM,gBAAgB,IAAI;AACjC,MAAI,MAAM,QAAQ,IAAI,aAAa,gBAAgB,OAAO,qBAAqB,MAAM;AACrF,WAAS,sBAAsB,MAAM;AACjC,QAAI,WAAW,UAAU,SAAS,KAAK,UAAU,CAAC,MAAM,SAAS,UAAU,CAAC,IAAI;AAChF,WAAO,QAAQ,QAAQ,KAAK,GAAG,GAAG;AAAA,MAC9B,GAAG;AAAA,IACP,EAAE,KAAK,IAAI,GAAG,EAAE,CAAC,GAAG,GAAG;AAAA,EAC3B;AACA,MAAI,wBAAO;AACP,QAAI,sBAAkB,4BAAgB,cAAc,KAAK,EAAI,GACzD,uBA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|
6
5
|
"source": "src/index.ts",
|
|
7
6
|
"types": "./types/index.d.ts",
|
|
@@ -12,19 +11,6 @@
|
|
|
12
11
|
"types",
|
|
13
12
|
"dist"
|
|
14
13
|
],
|
|
15
|
-
"exports": {
|
|
16
|
-
"./package.json": "./package.json",
|
|
17
|
-
".": {
|
|
18
|
-
"react-native": {
|
|
19
|
-
"import": "./dist/esm/index.native.js",
|
|
20
|
-
"require": "./dist/cjs/index.native.js"
|
|
21
|
-
},
|
|
22
|
-
"types": "./types/index.d.ts",
|
|
23
|
-
"import": "./dist/esm/index.mjs",
|
|
24
|
-
"require": "./dist/cjs/index.cjs",
|
|
25
|
-
"default": "./dist/cjs/index.native.js"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
14
|
"scripts": {
|
|
29
15
|
"build": "tamagui-build",
|
|
30
16
|
"watch": "tamagui-build --watch",
|
|
@@ -34,11 +20,11 @@
|
|
|
34
20
|
"clean:build": "tamagui-build clean:build"
|
|
35
21
|
},
|
|
36
22
|
"dependencies": {
|
|
37
|
-
"@tamagui/constants": "1.135.4
|
|
38
|
-
"@tamagui/web": "1.135.4
|
|
23
|
+
"@tamagui/constants": "1.135.4",
|
|
24
|
+
"@tamagui/web": "1.135.4"
|
|
39
25
|
},
|
|
40
26
|
"devDependencies": {
|
|
41
|
-
"@tamagui/build": "1.135.4
|
|
27
|
+
"@tamagui/build": "1.135.4",
|
|
42
28
|
"react": "*"
|
|
43
29
|
},
|
|
44
30
|
"publishConfig": {
|