OPEN_GRID API - v1.6.0
    Preparing search index...

    Function applyTypography

    • 프리셋을 적용한다. 코어 무수정 경로.

      두 경로가 있고, 능력이 다르다. 정직하게 밝힌다.

      1. targetHTMLElement(그리드 컨테이너 = .og-container)이면 data-og-typography 속성을 붙인다. typography.css 의 프리셋 블록·밀도 복합 셀렉터(광학 크기)·:lang() 한자 분기까지 전부 살아난다. 이 경로가 완전판이며, open-grid-typography.css 로드가 전제다 (값을 인라인하지 않는 이유: 인라인은 복합 셀렉터 보정을 덮어버린다).
      2. target그리드 인스턴스이면 공개 setThemeVar() 로 9개 토큰을 인라인 주입한다. OpenGrid 는 컨테이너 요소를 반환하는 공개 접근자를 제공하지 않으므로(2026-08 조사 결과: _container 는 private, 공개 표면에 getter 없음) 속성을 붙일 방법이 없다. 따라서 [data-og-typography="dense-scan"][data-og-density="compact"] 같은 속성 조건부 규칙과 cjk-doc:lang() 분기는 작동하지 않는다. 그 사실을 경고로 반환한다.

      완전 적용이 필요하면 컨테이너 요소를 직접 넘겨라(document.querySelector('#myGrid')).

      Apply a preset. Requires no core modification.

      There are two paths and they are not equally capable — stated plainly.

      1. An HTMLElement target (the grid container, .og-container) gets the data-og-typography attribute, so every CSS rule works, including density compound selectors (optical sizing) and the :lang() Han-unification split. This is the full path.
      2. A grid instance target gets the nine tokens injected inline via the public setThemeVar(). OpenGrid exposes no public accessor for its container element (verified 2026-08: _container is private with no public getter), so the attribute cannot be set. Attribute-conditional rules therefore do not apply; this is returned as a warning.

      プリセットを適用します。コアの修正は要りません。

      経路は2つあり、能力が違います。正直に明かします。

      1. targetHTMLElement(グリッドのコンテナ = .og-container)なら data-og-typography 属性を付けます。typography.css のプリセットブロック・密度の複合セレクター(オプティカルサイズ)・ :lang() の漢字の分岐まですべて生きます。この経路が完全版であり、 open-grid-typography.css の読み込みが前提です(値をインライン化しない理由: インラインは 複合セレクターの補正を上書きしてしまいます)。
      2. targetグリッドインスタンスなら、公開 API の setThemeVar() で9個のトークンを インライン注入します。OpenGrid はコンテナ要素を返す公開アクセサーを提供しないため (2026-08 の調査結果: _container は private で、公開表面に getter はありません)、 属性を付ける手段がありません。 したがって [data-og-typography="dense-scan"][data-og-density="compact"] のような属性条件付き規則と、 cjk-doc:lang() の分岐は働きません。 その事実を警告として返します。

      完全に適用したいときは、コンテナ要素を直接渡してください(document.querySelector('#myGrid'))。

      应用预设。不需要修改核心。

      有两条路径,能力并不相同。这里如实说明。

      1. targetHTMLElement(表格容器 = .og-container)时,加上 data-og-typography 属性。 typography.css 的预设块、密度复合选择器(光学尺寸)、:lang() 的汉字分支全部生效。 这条路径才是完整版,前提是加载了 open-grid-typography.css(不把值内联的理由: 内联会 覆盖复合选择器的修正)。
      2. target表格实例时,通过公开的 setThemeVar() 内联注入9个令牌。OpenGrid 不提供返回 容器元素的公开访问器(2026-08 核实: _container 是 private,公开表面上没有 getter),因此 没有办法加上属性。于是 [data-og-typography="dense-scan"][data-og-density="compact"] 这类 属性条件规则,以及 cjk-doc:lang() 分支都不起作用。这个事实会作为警告返回。

      需要完全应用时,请直接传入容器元素(document.querySelector('#myGrid'))。

      Parameters

      • target: HTMLElement | TypographyGridTarget

        그리드 컨테이너 요소 또는 그리드 인스턴스

        The grid container element, or a grid instance

        グリッドのコンテナ要素、またはグリッドインスタンス

        表格容器元素,或表格实例

      • id: string

        프리셋 id('default' 는 축 해제)

        Preset id ('default' clears the axis)

        プリセット id('default' は軸の解除)

        预设 id('default' 为解除该轴)

      Returns TypographyApplyResult

      적용 경로 + 정직 고지

      The path taken plus honest notices

      適用した経路 + 正直な注意書き

      采用的路径 + 如实告知

      target 이 요소도 그리드도 아니면 Error

      Throws when the target is neither an element nor a grid

      target が要素でもグリッドでもなければ Error

      target 既不是元素也不是表格时抛出 Error

      import { applyTypography } from 'open-grid/typography';
      import 'open-grid/dist/open-grid-typography.css';

      applyTypography(document.querySelector('#grid .og-container')!, 'ledger'); // 완전 적용
      applyTypography(grid, 'ledger'); // 변수만 — 경고 1건 반환