{"id":13447810,"url":"https://github.com/glyphic-co/textblock","last_synced_at":"2025-03-22T01:31:23.580Z","repository":{"id":34052262,"uuid":"89535580","full_name":"glyphic-co/textblock","owner":"glyphic-co","description":"Continuously responsive typesetting — Demo:","archived":false,"fork":false,"pushed_at":"2024-09-29T22:40:41.000Z","size":9626,"stargazers_count":551,"open_issues_count":10,"forks_count":16,"subscribers_count":8,"default_branch":"development","last_synced_at":"2025-03-15T06:33:09.692Z","etag":null,"topics":["fluid","progressive-enhancement","responsive","responsive-design","typesetting","typesetting-system","typography"],"latest_commit_sha":null,"homepage":"https://textblock.io","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glyphic-co.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-26T23:30:08.000Z","updated_at":"2025-03-11T15:42:19.000Z","dependencies_parsed_at":"2022-08-24T13:21:25.483Z","dependency_job_id":null,"html_url":"https://github.com/glyphic-co/textblock","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glyphic-co%2Ftextblock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glyphic-co%2Ftextblock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glyphic-co%2Ftextblock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glyphic-co%2Ftextblock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glyphic-co","download_url":"https://codeload.github.com/glyphic-co/textblock/tar.gz/refs/heads/development","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244893450,"owners_count":20527594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fluid","progressive-enhancement","responsive","responsive-design","typesetting","typesetting-system","typography"],"created_at":"2024-07-31T05:01:27.434Z","updated_at":"2025-03-22T01:31:23.256Z","avatar_url":"https://github.com/glyphic-co.png","language":"JavaScript","readme":"# Textblock\n\nA javascript tool for adjusting size, leading, and grades to cast continuously responsive typography. It works over your current CSS as a progressive enhancement.\n\nThe script calculates your setting based on minimum and maximum values for font size, line height, variable grades, and container width:\n\n- minimum/maximum font size\n- minimum/maximum line height\n- minimum/maximum container width\n- minimum/maximum grades (variable fonts only)\n\n## To initialize, add the element to be resized (required)\n\n### With Vanilla JS\n\n1. Include the main script and\n2. target elements using JS notation:\n\n```HTML\n\u003cscript src=\"textblock.min.js\"\u003e\u003c/script\u003e\n\n\u003cscript\u003e\n  Textblock([{\n    target: \".some-element\"\n  }]);\n\u003c/script\u003e\n```\n### As a Node Module (shown here for React)\n\n1. Add to modules with `npm install --save textblock`,\n2. include the module, and\n3. apply to elements within `componentDidMount()` as needed:\n\n```JS\nimport Textblock from 'textblock';\n\ncomponentDidMount() {\n  Textblock([{\n    target: \".some-element\"\n  }]);\n}\n```\n\n## Parameters\n\n- **`target`** (required  ): The element that should be resized `\".your‑class\"`, `\"#some-id p\"`\n- **`minWidth`**: default `320`\n- **`maxWidth`**: default `960`\n- **`minWidth_FontSize`**: default `1.0`\n- **`maxWidth_FontSize`**: default `1.8`\n- **`minWidth_LineHeight`**: default `1.33` (unitless values only)\n- **`maxWidth_LineHeight`**: default `1.25` (unitless values only)\n- **`minWidth_VariableGrade`**: A variable font weight for the small size, for example `450`\n- **`maxWidth_VariableGrade`**: A variable font weight for the large size, i.e. `400`\n- **`container`**: The container width to measure. Defaults to `\"parent\"` and can alternately be set to `\"self\"`.\n- **`fontSize_Units`**: default `em`\n\nFor a better sense of context, set your root em to `10px` with `html { font-size: 62.5%; }`. This makes your em units base 10 so `2.4em` = `24px`. But any number will do because once you start adjusting the min/max numbers, the experience is more visual than calculated. And if you prefer a more scientific approach, Textblock gives you the control you need for setting systems like modular scales.\n\nIf you’re using variable fonts, the `minWidth_VariableGrade` / `maxWidth_VariableGrade` parameters provide a way to simulate grades (micro-variations in weight to set smaller sizes slightly bolder).\n\n## Example Including Extra Parameters\n\n```JS\nTextblock([{\n target: \".some-class\",\n minWidth: 280,\n maxWidth: 800,\n minWidth_FontSize: 1.9,\n maxWidth_FontSize: 2.6,\n minWidth_LineHeight: 1.33,\n maxWidth_LineHeight: 1.25,\n minWidth_VariableGrade: 366,\n maxWidth_VariableGrade: 300,\n container: \"self\",\n fontSize_Units: \"rem\"\n}]);\n```\n\n## Multiple Elements with Different Settings\n\n```JS\nTextblock([\n {\n  target: \".some-class\",\n  minWidth_FontSize: 1.9,\n  maxWidth_FontSize: 2.6\n },\n {\n  target: \".another-class\",\n  minWidth_FontSize: 2.4,\n  maxWidth_FontSize: 3.6,\n  minWidth_VariableGrade: 450,\n  maxWidth_VariableGrade: 400,\n  container: \"self\"\n }\n]);\n```\n","funding_links":[],"categories":["JavaScript","🌐 Web Development - Frontend"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglyphic-co%2Ftextblock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglyphic-co%2Ftextblock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglyphic-co%2Ftextblock/lists"}