@ng-native/fabric 0.2.0 → 0.4.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.
@@ -119,6 +119,7 @@ function visibleShare(target) {
119
119
  const area = (frame.right - frame.left) * (frame.bottom - frame.top);
120
120
  return area > 0 ? (width * height) / area : 1;
121
121
  }
122
+ // Never reset: the globals it patches stay patched for the life of the process.
122
123
  let installed = false;
123
124
  /**
124
125
  * Let an engine node pass Angular's development check that a trigger is an `Element`, and give
@@ -136,7 +137,8 @@ export function installDeferTriggers() {
136
137
  const scope = globalThis;
137
138
  const existing = scope['Element'];
138
139
  if (existing) {
139
- const own = Function.prototype[Symbol.hasInstance];
140
+ // Its own check if it defines one, and the ordinary prototype walk if not.
141
+ const own = existing[Symbol.hasInstance];
140
142
  Object.defineProperty(existing, Symbol.hasInstance, {
141
143
  configurable: true,
142
144
  value(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"defer-triggers.js","sourceRoot":"","sources":["../src/defer-triggers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAqC,MAAM,aAAa,CAAC;AAE1F,sFAAsF;AACtF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,6BAA6B,CAAC,CAAC,CAAC;AAkBzE;;;;;;;;GAQG;AACH,MAAM,OAAO,0BAA0B;IACpB,QAAQ,CAAW;IACnB,SAAS,CAAS;IAClB,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IAE1D,YAAY,QAAkB,EAAE,OAAiB;QAC/C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;YACvC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAI,SAAsB,CAAC;YACtC,C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, for the\n * engine's nodes.\n *\n * Angular registers those three triggers on the element itself rather than through `Renderer2`:\n * it asserts in development that the element is an `Element`, listens with `addEventListener`,\n * and watches for visibility with a global `IntersectionObserver`. An engine node was none of\n * those, so the placeholder stayed forever and every render logged an assertion. The listeners\n * are on the node (`addEventListener` in `engine.ts`); this is the other two.\n *\n * `installDeferTriggers` runs once, from `mount()`, before anything renders.\n */\nimport { isEngineNode, viewNameOf, type EngineNode, type WindowFrame } from './engine.ts';\n\n/** The views a node scrolls inside of, and whose scrolling can bring it into view. */\nconst SCROLLERS = new Set(['ScrollView', 'AndroidHorizontalScrollView']);\n\ninterface Entry {\n readonly target: EngineNode;\n readonly isIntersecting: boolean;\n readonly intersectionRatio: number;\n}\n\ntype Callback = (entries: Entry[], observer: EngineIntersectionObserver) => void;\n\ninterface Options {\n readonly threshold?: number | readonly number[];\n}\n\ninterface Watched {\n readonly stops: (() => void)[];\n}\n\n/**\n * Visibility for engine nodes, from the layout and scroll events native already sends.\n *\n * A node is checked when it is observed, when it is laid out, and whenever a scroll view it sits\n * in scrolls. The check measures the node in window coordinates, clips it by each scroll view\n * around it and by the window, and reports it intersecting once the visible share reaches the\n * threshold: any of it by default, as the web does, and a node of no size counts once its position\n * is inside. `root` and `rootMargin` are not applied; the root is always the window.\n */\nexport class EngineIntersectionObserver {\n private readonly callback: Callback;\n private readonly threshold: number;\n private readonly watched = new Map<EngineNode, Watched>();\n\n constructor(callback: Callback, options?: Options) {\n this.callback = callback;\n const threshold = options?.threshold;\n this.threshold = Array.isArray(threshold)\n ? Math.min(...(threshold as number[]))\n : ((threshold as number | undefined) ?? 0);\n }\n\n observe(target: EngineNode): void {\n if (this.watched.has(target)) return;\n const check = () => this.check(target);\n const stops = [target.host!.setEventListener(target, 'topLayout', check)];\n for (let at = target.parent; at; at = at.parent) {\n if (!SCROLLERS.has(viewNameOf(at))) continue;\n stops.push(at.host!.setEventListener(at, 'topScroll', check));\n }\n this.watched.set(target, { stops });\n // A node laid out before it was observed sends no layout event of its own. Measured now,\n // after the commit that mounted it, and in a microtask, as an observer never calls back from\n // inside `observe`.\n queueMicrotask(check);\n }\n\n unobserve(target: EngineNode): void {\n const watched = this.watched.get(target);\n if (!watched) return;\n for (const stop of watched.stops) stop();\n this.watched.delete(target);\n }\n\n disconnect(): void {\n for (const target of [...this.watched.keys()]) this.unobserve(target);\n }\n\n takeRecords(): Entry[] {\n return [];\n }\n\n private check(target: EngineNode): void {\n if (!this.watched.has(target)) return;\n const ratio = visibleShare(target);\n if (ratio === null) return;\n const isIntersecting = this.threshold > 0 ? ratio >= this.threshold : ratio >= 0;\n if (isIntersecting) this.callback([{ target, isIntersecting, intersectionRatio: ratio }], this);\n }\n}\n\n/** A frame as its four edges. */\ninterface Box {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\nconst box = (frame: WindowFrame): Box => ({\n left: frame.x,\n top: frame.y,\n right: frame.x + frame.width,\n bottom: frame.y + frame.height,\n});\n\nfunction measured(node: EngineNode): Box | null {\n let found: Box | null = null;\n node.host!.measure(node, (frame) => (found = box(frame)));\n return found;\n}\n\nfunction clip(into: Box, by: Box): void {\n into.left = Math.max(into.left, by.left);\n into.top = Math.max(into.top, by.top);\n into.right = Math.min(into.right, by.right);\n into.bottom = Math.min(into.bottom, by.bottom);\n}\n\n/**\n * How much of the node is on screen, from 0 to 1; below 0 when none of it is, and null when it\n * has not been measured. Measuring is synchronous on the new architecture.\n */\nfunction visibleShare(target: EngineNode): number | null {\n const frame = measured(target);\n if (!frame) return null;\n const visible = { ...frame };\n for (let at = target.parent; at; at = at.parent) {\n if (!SCROLLERS.has(viewNameOf(at))) continue;\n const scroller = measured(at);\n if (scroller) clip(visible, scroller);\n }\n const window = (target.host as { viewport?: { width: number; height: number } }).viewport;\n if (window && window.width > 0 && window.height > 0) {\n clip(visible, { left: 0, top: 0, right: window.width, bottom: window.height });\n }\n const width = visible.right - visible.left;\n const height = visible.bottom - visible.top;\n if (width < 0 || height < 0) return -1;\n const area = (frame.right - frame.left) * (frame.bottom - frame.top);\n return area > 0 ? (width * height) / area : 1;\n}\n\ntype Constructor = abstract new (...args: never[]) => object;\n\n/** React Native's own `IntersectionObserver`, when its feature flag has installed one. */\ninterface NativeObserver {\n observe(target: unknown): void;\n unobserve(target: unknown): void;\n disconnect(): void;\n}\ntype NativeObserverClass = new (callback: unknown, options?: unknown) => NativeObserver;\n\nlet installed = false;\n\n/**\n * Let an engine node pass Angular's development check that a trigger is an `Element`, and give\n * `@defer (on viewport)` an `IntersectionObserver` that can watch one.\n *\n * React Native defines a global `Element` for its own DOM-like nodes, so an engine node is made to\n * answer `instanceof Element` as well, and nothing else about that class changes. Node has none,\n * and gets one that only engine nodes are instances of. An `IntersectionObserver` React Native\n * already has is kept for its own nodes; engine nodes are watched by the one above.\n */\nexport function installDeferTriggers(): void {\n if (installed) return;\n installed = true;\n const scope = globalThis as unknown as Record<string, unknown>;\n\n const existing = scope['Element'] as Constructor | undefined;\n if (existing) {\n const own = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(existing, Symbol.hasInstance, {\n configurable: true,\n value(this: Constructor, value: unknown): boolean {\n return (this === existing && isEngineNode(value)) || own.call(this, value);\n },\n });\n } else {\n scope['Element'] = class Element {\n static [Symbol.hasInstance](value: unknown): boolean {\n return isEngineNode(value);\n }\n };\n }\n\n const native = scope['IntersectionObserver'] as NativeObserverClass | undefined;\n if (!native) {\n scope['IntersectionObserver'] = EngineIntersectionObserver;\n return;\n }\n scope['IntersectionObserver'] = class extends EngineIntersectionObserver {\n private readonly args: [unknown, unknown];\n private other: NativeObserver | null = null;\n\n constructor(callback: Callback, options?: Options) {\n super(callback, options);\n this.args = [callback, options];\n }\n\n override observe(target: EngineNode): void {\n if (isEngineNode(target)) super.observe(target);\n else (this.other ??= new native(...this.args)).observe(target);\n }\n\n override unobserve(target: EngineNode): void {\n if (isEngineNode(target)) super.unobserve(target);\n else this.other?.unobserve(target);\n }\n\n override disconnect(): void {\n super.disconnect();\n this.other?.disconnect();\n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,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAClC,CAAC;QAEQ,OAAO,CAAC,MAAkB;YACjC,IAAI,YAAY,CAAC,MAAM,CAAC;gBAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;;gBAC3C,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACjE,CAAC;QAEQ,SAAS,CAAC,MAAkB;YACnC,IAAI,YAAY,CAAC,MAAM,CAAC;gBAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;;gBAC7C,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACrC,CAAC;QAEQ,UAAU;YACjB,KAAK,CAAC,UAAU,EAAE,CAAC;YACnB,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * What Angular's `@defer (on interaction | hover | viewport)` asks of a trigger element, for the\n * engine's nodes.\n *\n * Angular registers those three triggers on the element itself rather than through `Renderer2`:\n * it asserts in development that the element is an `Element`, listens with `addEventListener`,\n * and watches for visibility with a global `IntersectionObserver`. An engine node was none of\n * those, so the placeholder stayed forever and every render logged an assertion. The listeners\n * are on the node (`addEventListener` in `engine.ts`); this is the other two.\n *\n * `installDeferTriggers` runs once, from `mount()`, before anything renders.\n */\nimport { isEngineNode, viewNameOf, type EngineNode, type WindowFrame } from './engine.ts';\n\n/** The views a node scrolls inside of, and whose scrolling can bring it into view. */\nconst SCROLLERS = new Set(['ScrollView', 'AndroidHorizontalScrollView']);\n\ninterface Entry {\n readonly target: EngineNode;\n readonly isIntersecting: boolean;\n readonly intersectionRatio: number;\n}\n\ntype Callback = (entries: Entry[], observer: EngineIntersectionObserver) => void;\n\ninterface Options {\n readonly threshold?: number | readonly number[];\n}\n\ninterface Watched {\n readonly stops: (() => void)[];\n}\n\n/**\n * Visibility for engine nodes, from the layout and scroll events native already sends.\n *\n * A node is checked when it is observed, when it is laid out, and whenever a scroll view it sits\n * in scrolls. The check measures the node in window coordinates, clips it by each scroll view\n * around it and by the window, and reports it intersecting once the visible share reaches the\n * threshold: any of it by default, as the web does, and a node of no size counts once its position\n * is inside. `root` and `rootMargin` are not applied; the root is always the window.\n */\nexport class EngineIntersectionObserver {\n private readonly callback: Callback;\n private readonly threshold: number;\n private readonly watched = new Map<EngineNode, Watched>();\n\n constructor(callback: Callback, options?: Options) {\n this.callback = callback;\n const threshold = options?.threshold;\n this.threshold = Array.isArray(threshold)\n ? Math.min(...(threshold as number[]))\n : ((threshold as number | undefined) ?? 0);\n }\n\n observe(target: EngineNode): void {\n if (this.watched.has(target)) return;\n const check = () => this.check(target);\n const stops = [target.host!.setEventListener(target, 'topLayout', check)];\n for (let at = target.parent; at; at = at.parent) {\n if (!SCROLLERS.has(viewNameOf(at))) continue;\n stops.push(at.host!.setEventListener(at, 'topScroll', check));\n }\n this.watched.set(target, { stops });\n // A node laid out before it was observed sends no layout event of its own. Measured now,\n // after the commit that mounted it, and in a microtask, as an observer never calls back from\n // inside `observe`.\n queueMicrotask(check);\n }\n\n unobserve(target: EngineNode): void {\n const watched = this.watched.get(target);\n if (!watched) return;\n for (const stop of watched.stops) stop();\n this.watched.delete(target);\n }\n\n disconnect(): void {\n for (const target of [...this.watched.keys()]) this.unobserve(target);\n }\n\n takeRecords(): Entry[] {\n return [];\n }\n\n private check(target: EngineNode): void {\n if (!this.watched.has(target)) return;\n const ratio = visibleShare(target);\n if (ratio === null) return;\n const isIntersecting = this.threshold > 0 ? ratio >= this.threshold : ratio >= 0;\n if (isIntersecting) this.callback([{ target, isIntersecting, intersectionRatio: ratio }], this);\n }\n}\n\n/** A frame as its four edges. */\ninterface Box {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\nconst box = (frame: WindowFrame): Box => ({\n left: frame.x,\n top: frame.y,\n right: frame.x + frame.width,\n bottom: frame.y + frame.height,\n});\n\nfunction measured(node: EngineNode): Box | null {\n let found: Box | null = null;\n node.host!.measure(node, (frame) => (found = box(frame)));\n return found;\n}\n\nfunction clip(into: Box, by: Box): void {\n into.left = Math.max(into.left, by.left);\n into.top = Math.max(into.top, by.top);\n into.right = Math.min(into.right, by.right);\n into.bottom = Math.min(into.bottom, by.bottom);\n}\n\n/**\n * How much of the node is on screen, from 0 to 1; below 0 when none of it is, and null when it\n * has not been measured. Measuring is synchronous on the new architecture.\n */\nfunction visibleShare(target: EngineNode): number | null {\n const frame = measured(target);\n if (!frame) return null;\n const visible = { ...frame };\n for (let at = target.parent; at; at = at.parent) {\n if (!SCROLLERS.has(viewNameOf(at))) continue;\n const scroller = measured(at);\n if (scroller) clip(visible, scroller);\n }\n const window = (target.host as { viewport?: { width: number; height: number } }).viewport;\n if (window && window.width > 0 && window.height > 0) {\n clip(visible, { left: 0, top: 0, right: window.width, bottom: window.height });\n }\n const width = visible.right - visible.left;\n const height = visible.bottom - visible.top;\n if (width < 0 || height < 0) return -1;\n const area = (frame.right - frame.left) * (frame.bottom - frame.top);\n return area > 0 ? (width * height) / area : 1;\n}\n\ntype Constructor = abstract new (...args: never[]) => object;\n\n/** React Native's own `IntersectionObserver`, when its feature flag has installed one. */\ninterface NativeObserver {\n observe(target: unknown): void;\n unobserve(target: unknown): void;\n disconnect(): void;\n}\ntype NativeObserverClass = new (callback: unknown, options?: unknown) => NativeObserver;\n\n// Never reset: the globals it patches stay patched for the life of the process.\nlet installed = false;\n\n/**\n * Let an engine node pass Angular's development check that a trigger is an `Element`, and give\n * `@defer (on viewport)` an `IntersectionObserver` that can watch one.\n *\n * React Native defines a global `Element` for its own DOM-like nodes, so an engine node is made to\n * answer `instanceof Element` as well, and nothing else about that class changes. Node has none,\n * and gets one that only engine nodes are instances of. An `IntersectionObserver` React Native\n * already has is kept for its own nodes; engine nodes are watched by the one above.\n */\nexport function installDeferTriggers(): void {\n if (installed) return;\n installed = true;\n const scope = globalThis as unknown as Record<string, unknown>;\n\n const existing = scope['Element'] as Constructor | undefined;\n if (existing) {\n // Its own check if it defines one, and the ordinary prototype walk if not.\n const own = existing[Symbol.hasInstance];\n Object.defineProperty(existing, Symbol.hasInstance, {\n configurable: true,\n value(this: Constructor, value: unknown): boolean {\n return (this === existing && isEngineNode(value)) || own.call(this, value);\n },\n });\n } else {\n scope['Element'] = class Element {\n static [Symbol.hasInstance](value: unknown): boolean {\n return isEngineNode(value);\n }\n };\n }\n\n const native = scope['IntersectionObserver'] as NativeObserverClass | undefined;\n if (!native) {\n scope['IntersectionObserver'] = EngineIntersectionObserver;\n return;\n }\n scope['IntersectionObserver'] = class extends EngineIntersectionObserver {\n private readonly args: [unknown, unknown];\n private other: NativeObserver | null = null;\n\n constructor(callback: Callback, options?: Options) {\n super(callback, options);\n this.args = [callback, options];\n }\n\n override observe(target: EngineNode): void {\n if (isEngineNode(target)) super.observe(target);\n else (this.other ??= new native(...this.args)).observe(target);\n }\n\n override unobserve(target: EngineNode): void {\n if (isEngineNode(target)) super.unobserve(target);\n else this.other?.unobserve(target);\n }\n\n override disconnect(): void {\n super.disconnect();\n this.other?.disconnect();\n }\n };\n}\n"]}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * What HTML's text elements look like with no rule of the app's: the few a browser's own sheet
3
+ * styles that Tailwind's preflight leaves alone. A heading and a paragraph are not here: they are
4
+ * plain text, as preflight makes them, and the web host's reset says the same. `code` is in the
5
+ * font each platform uses for code, by the class the root carries for its platform, as
6
+ * `@ng-native/tailwind`'s `font-mono` is.
7
+ *
8
+ * `ELEMENT_STYLES` is `ELEMENT_STYLES_CSS` compiled, written out because the engine has no
9
+ * compiler. `element-styles.test.ts` fails when the two disagree.
10
+ */
11
+ import type { StyleSheet } from './css.ts';
12
+ export declare const ELEMENT_STYLES_CSS = "\nstrong, b { font-weight: bold }\nem, i, cite { font-style: italic }\nu { text-decoration-line: underline }\ns { text-decoration-line: line-through }\nsmall { font-size: 80% }\ncode { font-family: Courier New }\n.platform-ios code { font-family: Menlo }\n.platform-android code { font-family: monospace }\nmark { background-color: rgb(255, 255, 0); color: rgb(0, 0, 0) }\n";
13
+ export declare const ELEMENT_STYLES: StyleSheet;
14
+ /** The element names `ELEMENT_STYLES` has a rule for. */
15
+ export declare const STYLED_ELEMENTS: ReadonlySet<string>;
@@ -0,0 +1,103 @@
1
+ export const ELEMENT_STYLES_CSS = `
2
+ strong, b { font-weight: bold }
3
+ em, i, cite { font-style: italic }
4
+ u { text-decoration-line: underline }
5
+ s { text-decoration-line: line-through }
6
+ small { font-size: 80% }
7
+ code { font-family: Courier New }
8
+ .platform-ios code { font-family: Menlo }
9
+ .platform-android code { font-family: monospace }
10
+ mark { background-color: rgb(255, 255, 0); color: rgb(0, 0, 0) }
11
+ `;
12
+ export const ELEMENT_STYLES = {
13
+ rules: [
14
+ {
15
+ compounds: [{ classes: [], type: 'strong' }],
16
+ combinators: [],
17
+ specificity: 1,
18
+ order: 0,
19
+ declarations: { fontWeight: '700' },
20
+ },
21
+ {
22
+ compounds: [{ classes: [], type: 'b' }],
23
+ combinators: [],
24
+ specificity: 1,
25
+ order: 1,
26
+ declarations: { fontWeight: '700' },
27
+ },
28
+ {
29
+ compounds: [{ classes: [], type: 'em' }],
30
+ combinators: [],
31
+ specificity: 1,
32
+ order: 2,
33
+ declarations: { fontStyle: 'italic' },
34
+ },
35
+ {
36
+ compounds: [{ classes: [], type: 'i' }],
37
+ combinators: [],
38
+ specificity: 1,
39
+ order: 3,
40
+ declarations: { fontStyle: 'italic' },
41
+ },
42
+ {
43
+ compounds: [{ classes: [], type: 'cite' }],
44
+ combinators: [],
45
+ specificity: 1,
46
+ order: 4,
47
+ declarations: { fontStyle: 'italic' },
48
+ },
49
+ {
50
+ compounds: [{ classes: [], type: 'u' }],
51
+ combinators: [],
52
+ specificity: 1,
53
+ order: 5,
54
+ declarations: { textDecorationLine: 'underline' },
55
+ },
56
+ {
57
+ compounds: [{ classes: [], type: 's' }],
58
+ combinators: [],
59
+ specificity: 1,
60
+ order: 6,
61
+ declarations: { textDecorationLine: 'line-through' },
62
+ },
63
+ {
64
+ compounds: [{ classes: [], type: 'small' }],
65
+ combinators: [],
66
+ specificity: 1,
67
+ order: 7,
68
+ declarations: {},
69
+ deferred: [{ props: ['fontSize'], compute: { unit: 'em', factor: 0.8 } }],
70
+ },
71
+ {
72
+ compounds: [{ classes: [], type: 'code' }],
73
+ combinators: [],
74
+ specificity: 1,
75
+ order: 8,
76
+ declarations: { fontFamily: 'Courier New' },
77
+ },
78
+ {
79
+ compounds: [{ classes: [], type: 'mark' }],
80
+ combinators: [],
81
+ specificity: 1,
82
+ order: 11,
83
+ declarations: { backgroundColor: 'rgb(255, 255, 0)', color: 'rgb(0, 0, 0)' },
84
+ },
85
+ {
86
+ compounds: [{ classes: ['platform-ios'] }, { classes: [], type: 'code' }],
87
+ combinators: ['descendant'],
88
+ specificity: 1001,
89
+ order: 9,
90
+ declarations: { fontFamily: 'Menlo' },
91
+ },
92
+ {
93
+ compounds: [{ classes: ['platform-android'] }, { classes: [], type: 'code' }],
94
+ combinators: ['descendant'],
95
+ specificity: 1001,
96
+ order: 10,
97
+ declarations: { fontFamily: 'monospace' },
98
+ },
99
+ ],
100
+ };
101
+ /** The element names `ELEMENT_STYLES` has a rule for. */
102
+ export const STYLED_ELEMENTS = new Set(ELEMENT_STYLES.rules.map((rule) => rule.compounds.at(-1).type));
103
+ //# sourceMappingURL=element-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-styles.js","sourceRoot":"","sources":["../src/element-styles.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;CAUjC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE;QACL;YACE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;YAC5C,WAAW,EA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CAAC,EAAE,OAAO,EAAE,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;YAC7E,WAAW,EAAE,CAAC,YAAY,CAAC;YAC3B,WAAW,EAAE,IAAI;YACjB,KAAK,EAAE,EAAE;YACT,YAAY,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE;SAC1C;KACF;CACuB,CAAC;AAE3B,yDAAyD;AACzD,MAAM,CAAC,MAAM,eAAe,GAAwB,IAAI,GAAG,CACzD,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,IAAc,CAAC,CAC1E,CAAC","sourcesContent":["/**\n * What HTML's text elements look like with no rule of the app's: the few a browser's own sheet\n * styles that Tailwind's preflight leaves alone. A heading and a paragraph are not here: they are\n * plain text, as preflight makes them, and the web host's reset says the same. `code` is in the\n * font each platform uses for code, by the class the root carries for its platform, as\n * `@ng-native/tailwind`'s `font-mono` is.\n *\n * `ELEMENT_STYLES` is `ELEMENT_STYLES_CSS` compiled, written out because the engine has no\n * compiler. `element-styles.test.ts` fails when the two disagree.\n */\nimport type { StyleSheet } from './css.ts';\n\nexport const ELEMENT_STYLES_CSS = `\nstrong, b { font-weight: bold }\nem, i, cite { font-style: italic }\nu { text-decoration-line: underline }\ns { text-decoration-line: line-through }\nsmall { font-size: 80% }\ncode { font-family: Courier New }\n.platform-ios code { font-family: Menlo }\n.platform-android code { font-family: monospace }\nmark { background-color: rgb(255, 255, 0); color: rgb(0, 0, 0) }\n`;\n\nexport const ELEMENT_STYLES = {\n rules: [\n {\n compounds: [{ classes: [], type: 'strong' }],\n combinators: [],\n specificity: 1,\n order: 0,\n declarations: { fontWeight: '700' },\n },\n {\n compounds: [{ classes: [], type: 'b' }],\n combinators: [],\n specificity: 1,\n order: 1,\n declarations: { fontWeight: '700' },\n },\n {\n compounds: [{ classes: [], type: 'em' }],\n combinators: [],\n specificity: 1,\n order: 2,\n declarations: { fontStyle: 'italic' },\n },\n {\n compounds: [{ classes: [], type: 'i' }],\n combinators: [],\n specificity: 1,\n order: 3,\n declarations: { fontStyle: 'italic' },\n },\n {\n compounds: [{ classes: [], type: 'cite' }],\n combinators: [],\n specificity: 1,\n order: 4,\n declarations: { fontStyle: 'italic' },\n },\n {\n compounds: [{ classes: [], type: 'u' }],\n combinators: [],\n specificity: 1,\n order: 5,\n declarations: { textDecorationLine: 'underline' },\n },\n {\n compounds: [{ classes: [], type: 's' }],\n combinators: [],\n specificity: 1,\n order: 6,\n declarations: { textDecorationLine: 'line-through' },\n },\n {\n compounds: [{ classes: [], type: 'small' }],\n combinators: [],\n specificity: 1,\n order: 7,\n declarations: {},\n deferred: [{ props: ['fontSize'], compute: { unit: 'em', factor: 0.8 } }],\n },\n {\n compounds: [{ classes: [], type: 'code' }],\n combinators: [],\n specificity: 1,\n order: 8,\n declarations: { fontFamily: 'Courier New' },\n },\n {\n compounds: [{ classes: [], type: 'mark' }],\n combinators: [],\n specificity: 1,\n order: 11,\n declarations: { backgroundColor: 'rgb(255, 255, 0)', color: 'rgb(0, 0, 0)' },\n },\n {\n compounds: [{ classes: ['platform-ios'] }, { classes: [], type: 'code' }],\n combinators: ['descendant'],\n specificity: 1001,\n order: 9,\n declarations: { fontFamily: 'Menlo' },\n },\n {\n compounds: [{ classes: ['platform-android'] }, { classes: [], type: 'code' }],\n combinators: ['descendant'],\n specificity: 1001,\n order: 10,\n declarations: { fontFamily: 'monospace' },\n },\n ],\n} as unknown as StyleSheet;\n\n/** The element names `ELEMENT_STYLES` has a rule for. */\nexport const STYLED_ELEMENTS: ReadonlySet<string> = new Set(\n ELEMENT_STYLES.rules.map((rule) => rule.compounds.at(-1)!.type as string),\n);\n"]}